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

Fix an error for using parameterizing rules with own stack in semantic action #399

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

ydah
Copy link
Collaborator

@ydah ydah commented Apr 26, 2024

This PR fixes error.

tool/lrama/lib/lrama/grammar/code/rule_action.rb:58:in 'Integer#+': nil can't be coerced into Integer (TypeError)

…c action

```
tool/lrama/lib/lrama/grammar/code/rule_action.rb:58:in 'Integer#+': nil can't be coerced into Integer (TypeError)
```
@ydah ydah force-pushed the fix-error-when-use-own-stack branch from b3a1e4b to 6e36867 Compare April 26, 2024 15:02
@@ -25,6 +25,7 @@ static int yyerror(YYLTYPE *loc, const char *str);
{
$$ = $1 + $2;
printf("(%d, %d)\n", $1, $2);
Copy link
Collaborator

Choose a reason for hiding this comment

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

[note] $n could be used with skip_preprocess_references: true because Reference#index is set by #scan_reference then no need to fill index by #numberize_references (#preprocess_references)

return Lrama::Grammar::Reference.new(type: :dollar, number: Integer(scanner[2]), index: Integer(scanner[2]), ex_tag: tag, first_column: start, last_column: scanner.pos)

@yui-knk yui-knk merged commit 95ab3e9 into ruby:master Apr 26, 2024
16 checks passed
@yui-knk
Copy link
Collaborator

yui-knk commented Apr 26, 2024

LGTM! Thank you!

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.

None yet

2 participants