-
Notifications
You must be signed in to change notification settings - Fork 23
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 custom union id in ebnf definition #79
Conversation
docs/grammar/grammar.ebnf
Outdated
@@ -29,15 +29,18 @@ item_decl = identifier, break_opt, | |||
field_decl = identifier, break_opt, ":", break_opt, | |||
identifier, break_opt, | |||
field_end; | |||
custom_union_item_decl = identifier, break_opt, ":", break_opt, | |||
number, break_opt, |
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.
custom_union_item_decl
allow 0
as custom ID, it should be number_greater_or_equal_than_zero
here.
Ref:
molecule/tools/codegen/src/grammar.pest
Lines 12 to 13 in 1b3bfe2
number_greater_than_zero = @{ nonzero ~ digit* } | |
number_greater_or_equal_than_zero = @{ zero | number_greater_than_zero} |
molecule/tools/codegen/src/grammar.pest
Lines 31 to 35 in 1b3bfe2
custom_union_item_decl = { | |
identifier ~ (brk)* ~ ":" ~ (brk)* ~ | |
number_greater_or_equal_than_zero ~ (brk)* ~ | |
field_end | |
} |
molecule/tools/codegen/src/grammar.pest
Lines 49 to 54 in 1b3bfe2
union_decl = { | |
"union" ~ (brk)+ ~ identifier ~ (brk)* ~ | |
"{" ~ (brk)* ~ | |
((item_decl | custom_union_item_decl) ~ (brk)*)+ ~ | |
"}" | |
} |
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.
thx for the tip, improved
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.
The naming looks not good (number_greater_or_equal_than_zero
).
sync with this update #65