-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Yul grammar changes. #5524
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
Yul grammar changes. #5524
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -559,8 +559,7 @@ regular strings in native encoding. For code, | |||||
|
||||||
Grammar:: | ||||||
|
||||||
TopLevelObject = 'object' '{' Code? ( Object | Data )* '}' | ||||||
Object = 'object' StringLiteral '{' Code? ( Object | Data )* '}' | ||||||
Object = 'object' StringLiteral '{' Code ( Object | Data )* '}' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think an object has exactly one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But I don't think code is mandatory, should make it optional then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR is suggesting that it should be :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having exactly one |
||||||
Code = 'code' Block | ||||||
Data = 'data' StringLiteral ( HexLiteral | StringLiteral ) | ||||||
HexLiteral = 'hex' ('"' ([0-9a-fA-F]{2})* '"' | '\'' ([0-9a-fA-F]{2})* '\'') | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is code not optional?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be
'object' StringLiteral '{' (Code | Object | Data )+ '}'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not allow multiple code blocks - what happens to control flow at the end of the first code block? If you want to refer to code as data, you should wrap it inside a sub-object.
About objects without code: Do you see a use-case? We can allow it at some later point, if we want, but for now, I would require code - the code itself can be empty, though.