Skip to content

Commit

Permalink
Replace NewParser with Parser #6
Browse files Browse the repository at this point in the history
- Parse some escape characters
  • Loading branch information
junk0612 committed Oct 17, 2023
1 parent 80de546 commit 1bacaa6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/lrama/new_lexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def lex_token
return [:TAG, build_token(type: Token::Tag, s_value: @scanner.matched)]
when @scanner.scan(/'.'/)
return [:CHARACTER, build_token(type: Token::Char, s_value: @scanner.matched)]
when @scanner.scan(/'\\\\'|'\\t'|'\\f'|'\\r'|'\\n'|'\\13'/)
when @scanner.scan(/'\\\\'|'\\b'|'\\t'|'\\f'|'\\r'|'\\n'|'\\v'|'\\13'/)
return [:CHARACTER, build_token(type: Token::Char, s_value: @scanner.matched)]
when @scanner.scan(/"/)
return [:STRING, %Q("#{@scanner.scan_until(/"/)})]
Expand Down
18 changes: 9 additions & 9 deletions spec/lrama/new_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ class : keyword_class
end

describe "symbol number" do
xit "is not duplicated" do
it "is not duplicated" do
y = <<~INPUT
%{
// Prologue
Expand Down Expand Up @@ -900,7 +900,7 @@ class : keyword_class tSTRING keyword_end { code 1 }
])
end

xit "tokens after precedence declarations have greater number than tokens defined by precedence declarations" do
it "tokens after precedence declarations have greater number than tokens defined by precedence declarations" do
y = <<~INPUT
%{
// Prologue
Expand Down Expand Up @@ -950,7 +950,7 @@ class : keyword_class tSTRING keyword_end { code 1 }

describe "user codes" do
describe "" do
xit "is not duplicated" do
it "is not duplicated" do
y = <<~INPUT
%{
// Prologue
Expand Down Expand Up @@ -1060,7 +1060,7 @@ class : keyword_class tSTRING keyword_end { code 1 }
])
end

xit "can parse action with %empty" do
it "can parse action with %empty" do
y = <<~INPUT
%{
// Prologue
Expand Down Expand Up @@ -1146,7 +1146,7 @@ class : keyword_class tSTRING keyword_end { code 1 }
end

context "includes named references" do
xit "can parse" do
it "can parse" do
y = <<~INPUT
%{
// Prologue
Expand Down Expand Up @@ -1279,7 +1279,7 @@ class : keyword_class tSTRING keyword_end { code 1 }
end

context "includes invalid named references" do
xit "raise an error" do
it "raise an error" do
y = <<~INPUT
%{
// Prologue
Expand Down Expand Up @@ -1319,7 +1319,7 @@ class : keyword_class tSTRING keyword_end { code 1 }
end

describe "#fill_symbol_number" do
xit "fills token_id of Token::Char" do
it "fills token_id of Token::Char" do
y = <<~INPUT
%{
// Prologue
Expand Down Expand Up @@ -1372,7 +1372,7 @@ class : keyword_class tSTRING keyword_end ;

describe "#normalize_rules" do
describe "referring_symbol" do
xit "uses a tag specified in code" do
it "uses a tag specified in code" do
y = <<~INPUT
%{
// Prologue
Expand Down Expand Up @@ -1411,7 +1411,7 @@ class : keyword_class tSTRING keyword_end

describe "Grammar#validate!" do
describe "#validate_no_declared_type_reference!" do
xit "raises error when referred nterm, term and action have no tag so that type is not declared" do
it "raises error when referred nterm, term and action have no tag so that type is not declared" do
y = <<~INPUT
%{
// Prologue
Expand Down

0 comments on commit 1bacaa6

Please sign in to comment.