Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code review nits for semver grammar #303

Merged
merged 3 commits into from
Jun 22, 2022
Merged

Conversation

hildjj
Copy link
Contributor

@hildjj hildjj commented Jun 20, 2022

See conversation in #300

numericIdentifier
= '0' / (positiveDigit digit*)
= n:('0' / $(positiveDigit digit*)) { return parseInt(n, 10); }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formally should parse be BigInt(n) instead of parseInt(n, 10).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh, I guess. We don't have to worry about IE anymore.

= [1-9]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any other places where [1-9] is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to stay as close as possible to the original grammar.

@hildjj
Copy link
Contributor Author

hildjj commented Jun 20, 2022

@dselman look good, make sense?

@MarcelBolten
Copy link
Contributor

When I copy-paste the grammar into https://peggyjs.org/online.html (Firefox 101.0.1 or edge 102.0.1245.44) and add 0.0.4 as input I get:

{
   "major": [ERROR],
   "minor": [ERROR],
   "patch": [ERROR],
   "pre": null,
   "build": null
}

Changing BigInt() back to parseInt() all works fine. Is it due to jsDump?

@hildjj
Copy link
Contributor Author

hildjj commented Jun 21, 2022

Is it due to jsDump?

Probably. We could switch to node-inspect-extracted, at least I know that works.

@hildjj
Copy link
Contributor Author

hildjj commented Jun 21, 2022

Yes, getting rid of jsDump seemed to fix this for me. I will cherry-pick that change over to the docs branch when we're done.

@hildjj hildjj merged commit 8df4350 into peggyjs:semver-grammar Jun 22, 2022
@hildjj hildjj deleted the nits branch June 22, 2022 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants