Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where the number of tags in the split_off method didn't match the actual number of enum variants in the GrammarTags enum. The fix involves moving the Empty tag to the end of the enum and adjusting the array size accordingly.
- Relocated the
Emptytag from first to last position in theGrammarTagsenum - Updated array size calculation in
split_offmethod to account for all enum variants - Bumped version number to reflect the bug fix
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| rusty_lr_parser/src/parser/parser_expanded.rs | Generated code with moved Empty tag and corrected array size |
| rusty_lr_parser/src/emit.rs | Template code that generates the parser with the tag reordering and array size fix |
| rusty_lr_parser/Cargo.toml | Version bump to 3.59.1 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| let stack_len = stack_names_in_order.len(); | ||
| let split_off_count_init_stream = quote! { | ||
| let mut __counts: [u8; #stack_len] = [0; #stack_len]; | ||
| let mut __counts: [u8; #stack_len+1] = [0; #stack_len+1]; |
There was a problem hiding this comment.
The expression #stack_len+1 should use parentheses for clarity: #(#stack_len + 1) to make the operator precedence explicit in the macro expansion.
Suggested change
| let mut __counts: [u8; #stack_len+1] = [0; #stack_len+1]; | |
| let mut __counts: [u8; #(stack_len + 1)] = [0; #(stack_len + 1)]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.