Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace NewParser with Parser #6 #137

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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