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 custom union id in ebnf definition #79

Merged
merged 3 commits into from
Jan 8, 2024

Conversation

homura
Copy link
Contributor

@homura homura commented Dec 12, 2023

sync with this update #65

@@ -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,
Copy link
Collaborator

@eval-exec eval-exec Dec 28, 2023

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:

number_greater_than_zero = @{ nonzero ~ digit* }
number_greater_or_equal_than_zero = @{ zero | number_greater_than_zero}

custom_union_item_decl = {
identifier ~ (brk)* ~ ":" ~ (brk)* ~
number_greater_or_equal_than_zero ~ (brk)* ~
field_end
}

union_decl = {
"union" ~ (brk)+ ~ identifier ~ (brk)* ~
"{" ~ (brk)* ~
((item_decl | custom_union_item_decl) ~ (brk)*)+ ~
"}"
}

Copy link
Contributor Author

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

Copy link
Collaborator

@yangby-cryptape yangby-cryptape left a 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).

@quake quake merged commit c03e59c into nervosnetwork:master Jan 8, 2024
6 checks passed
@homura homura deleted the custom-union-id branch January 9, 2024 05:28
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.

4 participants