Skip to content

Commit

Permalink
Use NewParser in spec files if possible
Browse files Browse the repository at this point in the history
We are migrating Lrama's parser from hand written parser to
LR parser generated by Racc. Replacing Parser with NewParser
to prevent regression.
  • Loading branch information
yui-knk committed Oct 16, 2023
1 parent dfeb6b7 commit 1273f91
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions spec/lrama/context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe "basic" do
it do
y = File.read(fixture_path("context/basic.y"))
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute
context = Lrama::Context.new(states)
Expand Down Expand Up @@ -181,7 +181,7 @@
%%
INPUT

grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute
context = Lrama::Context.new(states)
Expand Down Expand Up @@ -230,7 +230,7 @@
%%
INPUT

grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute
context = Lrama::Context.new(states)
Expand Down
26 changes: 13 additions & 13 deletions spec/lrama/states_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe '#compute' do
it "basic" do
y = File.read(fixture_path("common/basic.y"))
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -298,7 +298,7 @@ class go to state 5

it '#State#accessing_symbol' do
y = File.read(fixture_path("common/basic.y"))
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -338,7 +338,7 @@ class go to state 5
describe '#reads_relation' do
it do
y = File.read(fixture_path("states/reads_relation.y"))
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -605,7 +605,7 @@ class go to state 5
describe '#includes_relation' do
it do
y = File.read(fixture_path("states/includes_relation.y"))
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -904,7 +904,7 @@ class go to state 5
%%
INPUT
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -973,7 +973,7 @@ class go to state 5
%%
INPUT
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -1063,7 +1063,7 @@ class go to state 5
%%
INPUT
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -1180,7 +1180,7 @@ class go to state 5
%%
INPUT
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -1426,7 +1426,7 @@ class go to state 5
%%
INPUT
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -1598,7 +1598,7 @@ class go to state 5
%%
INPUT
grammar = Lrama::Parser.new(y).parse
grammar = Lrama::NewParser.new(y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down Expand Up @@ -1816,7 +1816,7 @@ class : keyword_class tSTRING keyword_end %prec tPLUS
end

it "has errors for r/r conflicts" do
grammar = Lrama::Parser.new(header + y).parse
grammar = Lrama::NewParser.new(header + y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand All @@ -1840,7 +1840,7 @@ class : keyword_class tSTRING keyword_end %prec tPLUS
end

it "has errors for s/r conflicts and r/r conflicts" do
grammar = Lrama::Parser.new(header + y).parse
grammar = Lrama::NewParser.new(header + y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand All @@ -1864,7 +1864,7 @@ class : keyword_class tSTRING keyword_end %prec tPLUS
end

it "has warns for s/r conflicts and r/r conflicts" do
grammar = Lrama::Parser.new(header + y).parse
grammar = Lrama::NewParser.new(header + y).parse
states = Lrama::States.new(grammar, warning)
states.compute

Expand Down

0 comments on commit 1273f91

Please sign in to comment.