Skip to content

Commit

Permalink
Merge pull request #122 from junk0612/replace-new-parser-2
Browse files Browse the repository at this point in the history
Replace NewParser With Parser #2
  • Loading branch information
yui-knk authored Oct 15, 2023
2 parents 06c87ff + 8e3cfbb commit 0f0a16b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/lrama/new_lexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def lex_token
when @scanner.scan(/\/\//)
@scanner.scan_until(/\n/)
newline
when @scanner.scan(/%empty/)
# noop
else
break
end
Expand Down
4 changes: 2 additions & 2 deletions lib/lrama/new_parser.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ rule

rhs_list: rhs
{
result = [{rhs: val[0], lineno: val[0].first&.line || @lexer.line}]
result = [{rhs: val[0], lineno: val[0].first&.line || @lexer.line - 1}]
}
| rhs_list "|" rhs
{
result = val[0].append({rhs: val[2], lineno: val[2].first&.line || @lexer.line})
result = val[0].append({rhs: val[2], lineno: val[2].first&.line || @lexer.line - 1})
}
| rhs_list ";"

Expand Down
2 changes: 1 addition & 1 deletion spec/lrama/new_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
])
end

xit "nullable" do
it "nullable" do
y = File.read(fixture_path("common/nullable.y"))
grammar = Lrama::NewParser.new(y).parse

Expand Down

0 comments on commit 0f0a16b

Please sign in to comment.