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

View File

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