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

Add octal-prefix grammar to support "0o" and "0O" #258

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ramsey
Copy link
Member

@ramsey ramsey commented Feb 23, 2024

No description provided.

@chairping
Copy link

chairping commented Feb 23, 2024 via email

@@ -440,9 +440,12 @@ decimal-literal::
decimal-literal digit

octal-literal::
'0'
octal-prefix octal-digit
Copy link
Member

Choose a reason for hiding this comment

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

It seems like a plain 0 now doesn't match any of the rules anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

Plain 0 is included in octal-prefix.

Copy link
Member

Choose a reason for hiding this comment

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

It is, but it now has to be followed by octal-digit, so only 00 would be valid, not plain 0.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I see what you’re saying. Under what circumstances should a single digit 0 be interpreted as octal and not decimal?

Copy link
Member Author

Choose a reason for hiding this comment

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

(Regardless of my question, I think removing the plain 0 by itself was an oversight on my part and not intentional.)

Copy link
Member

Choose a reason for hiding this comment

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

For 0 the decimal and octal interpretation is the same, so it doesn't really matter which it is, as long as it's one of them. In the grammar it's probably easier to express as octal.

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