Skip to content

Commit

Permalink
Merge pull request #134 from junk0612/replace-new-parser-5
Browse files Browse the repository at this point in the history
Replace NewParser with Parser #5
  • Loading branch information
yui-knk committed Oct 17, 2023
2 parents da4a6cd + 80de546 commit 15c3e0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions lib/lrama/new_lexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ def lex_c_code
code += @scanner.matched
newline
when @scanner.scan(/"/)
matched = @scanner.scan_until(/"/)[0..-2]
code += %Q("#{matched}")
matched = @scanner.scan_until(/"/)
code += %Q("#{matched})
@line += matched.count("\n")
when @scanner.scan(/'/)
matched = @scanner.scan_until(/'/)
code += %Q('#{matched})
else
code += @scanner.getch
end
Expand Down
8 changes: 4 additions & 4 deletions spec/lrama/new_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ class : keyword_class { code 4 } tSTRING '?' keyword_end %prec tEQ { code 5 } {
end

describe "\" in user code" do
xit do
it do
y = header + <<~INPUT
%%
Expand All @@ -818,13 +818,13 @@ class : keyword_class
expect(codes[0].s_value).to eq(<<-STR.chomp)
func("}");
STR
end
end

describe "' in user code" do
xit do
it do
y = header + <<~INPUT
%%
Expand All @@ -845,7 +845,7 @@ class : keyword_class
expect(codes[0].s_value).to eq(<<-STR.chomp)
func('}');
STR
end
end
Expand Down

0 comments on commit 15c3e0d

Please sign in to comment.