Skip to content

Commit

Permalink
Merge pull request #301 from yui-knk/at_zero
Browse files Browse the repository at this point in the history
Add test case for `@0` translation
  • Loading branch information
yui-knk authored Dec 21, 2023
2 parents 7b05f36 + e040531 commit 6f5d567
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/lrama/grammar/code_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
rule3: expr '+' expr[expr-right] { $1 + $[expr-right]; }
;
rule4: expr '+' expr[expr-right] { @1 + @[expr-right]; }
rule4: expr '+' expr[expr-right] { @1 + @[expr-right]; @0; }
;
rule5: expr '+' expr { $1 + $<integer>3; }
Expand Down Expand Up @@ -169,7 +169,7 @@

it "translats '@n' to '(yylsp)' with index" do
code = grammar.rules.find {|r| r.lhs.id.s_value == "rule4" }
expect(code.translated_code).to eq(" (yylsp[-2]) + (yylsp[0]); ")
expect(code.translated_code).to eq(" (yylsp[-2]) + (yylsp[0]); (yylsp[-3]); ")
end

it "respects explicit tag in a rule" do
Expand Down

0 comments on commit 6f5d567

Please sign in to comment.