Skip to content

Commit

Permalink
Update parser
Browse files Browse the repository at this point in the history
  • Loading branch information
junk0612 committed Sep 25, 2023
1 parent acf5589 commit 3972ed8
Show file tree
Hide file tree
Showing 5 changed files with 372 additions and 283 deletions.
2 changes: 1 addition & 1 deletion lib/lrama/grammar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def nterms
def extract_references
@_rules.each do |lhs, rhs, _|
rhs.each_with_index do |token, index|
next if token.type != Lrama::Lexer::Token::User_code
next if token.class == Lrama::Grammar::Symbol || token.type != Lrama::Lexer::Token::User_code

scanner = StringScanner.new(token.s_value)
references = []
Expand Down
4 changes: 3 additions & 1 deletion lib/lrama/new_lexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def lex_c_code
@line += 1
@head = @scanner.pos + 1
when @scanner.scan(/"/)
code += %Q("#{@scanner.scan_until(/"/)[0..-2]}")
matched = @scanner.scan_until(/"/)[0..-2]
code += %Q("#{matched}")
@line += matched.count("\n")
else
code += @scanner.getch
end
Expand Down
Loading

0 comments on commit 3972ed8

Please sign in to comment.