diff --git a/assets/parser.d.erb b/assets/parser.d.erb index 05adf63..eeb16d1 100644 --- a/assets/parser.d.erb +++ b/assets/parser.d.erb @@ -3,12 +3,10 @@ * * This file is generated by Propane. */ - <% if @grammar.modulename %> -module <%= @grammar.modulename %>; +module <%= @grammar.modulename %>; <% end %> -import std.stdio; /************************************************************************** * User code blocks @@ -913,16 +911,6 @@ public size_t <%= @grammar.prefix %>parse(<%= @grammar.prefix %>context_t * cont continue; } - /* Error, unexpected token. */ - write("Unexpected token "); - if (token != INVALID_TOKEN_ID) - { - writeln(<%= @grammar.prefix %>token_names[token]); - } - else - { - writeln("{other}"); - } /* A token was successfully lexed, so the input text position was * advanced. However, this is an unexpected token, so we want to reset * the context text position to point to the token rather than the text diff --git a/spec/propane_spec.rb b/spec/propane_spec.rb index 4af9ca3..bd88982 100644 --- a/spec/propane_spec.rb +++ b/spec/propane_spec.rb @@ -228,6 +228,9 @@ EOF it "executes user code when matching lexer token" do write_grammar <> token abc << writeln("abc!"); >> @@ -251,6 +254,9 @@ EOF it "supports a pattern statement" do write_grammar <> token abc; /def/ << writeln("def!"); @@ -272,6 +278,9 @@ EOF it "supports returning tokens from pattern code blocks" do write_grammar <> token abc; /def/ << writeln("def!"); @@ -295,6 +304,9 @@ EOF it "supports lexer modes" do write_grammar <> token abc; token def; tokenid string; @@ -328,6 +340,9 @@ EOF it "executes user code associated with a parser rule" do write_grammar <> token a; token b; Start -> A B << @@ -393,6 +408,9 @@ EOF it "provides matched text to user code blocks" do write_grammar <> token id /[a-zA-Z_][a-zA-Z0-9_]*/ << writeln("Matched token is ", match); >>