Disable parser debug output

This commit is contained in:
Josh Holtrop 2022-09-27 12:33:23 -04:00
parent 48704295bb
commit a4c5546876
2 changed files with 21 additions and 23 deletions

View File

@ -432,14 +432,14 @@ class <%= @classname %>
{ {
if (shifts[i].symbol == symbol) if (shifts[i].symbol == symbol)
{ {
if (symbol < _TOKEN_COUNT) // if (symbol < _TOKEN_COUNT)
{ // {
writeln("Shifting ", token_names[symbol]); // writeln("Shifting ", token_names[symbol]);
} // }
else // else
{ // {
writeln("Shifting rule set ", symbol); // writeln("Shifting rule set ", symbol);
} // }
return shifts[i].state; return shifts[i].state;
} }
} }
@ -455,19 +455,19 @@ class <%= @classname %>
if ((reduces[i].token == token) || if ((reduces[i].token == token) ||
(reduces[i].token == _TOKEN_NONE)) (reduces[i].token == _TOKEN_NONE))
{ {
write("Reducing rule ", reduces[i].rule, ", rule set ", reduces[i].rule_set, " lookahead "); // write("Reducing rule ", reduces[i].rule, ", rule set ", reduces[i].rule_set, " lookahead ");
if (token < _TOKEN_COUNT) // if (token < _TOKEN_COUNT)
{ // {
writeln(token_names[token]); // writeln(token_names[token]);
} // }
else if (token == _TOKEN_EOF) // else if (token == _TOKEN_EOF)
{ // {
writeln("{EOF}"); // writeln("{EOF}");
} // }
else // else
{ // {
writeln("{other}"); // writeln("{other}");
} // }
return i; return i;
} }
} }

View File

@ -11,10 +11,8 @@ unittest
string input = "abcdef"; string input = "abcdef";
auto parser = new Testparser.Parser(cast(const(ubyte) *)input.ptr, input.length); auto parser = new Testparser.Parser(cast(const(ubyte) *)input.ptr, input.length);
assert(parser.parse() == true); assert(parser.parse() == true);
writeln("pass1");
input = "abcabcdef"; input = "abcabcdef";
parser = new Testparser.Parser(cast(const(ubyte) *)input.ptr, input.length); parser = new Testparser.Parser(cast(const(ubyte) *)input.ptr, input.length);
assert(parser.parse() == true); assert(parser.parse() == true);
writeln("pass2");
} }