Do not consume lookahead token when reducing

This commit is contained in:
josh committed 2022-06-25 21:35:54 -04:00
1 parent f2cc5b112e
commit 2fbe13e071
3 files changed
+41 -3

No files matched your search

+2
View File
@@ -68,6 +68,8 @@ R1 -> a b;
R2 -> a b;
EOF
build_parser
compile("spec/test_d_lexer3.d")
run
end
it "handles reducing a rule that could be arrived at from multiple states" do
+18
View File
@@ -0,0 +1,18 @@
import testparser;
import std.stdio;
int main()
{
return 0;
}
unittest
{
string input = "aba";
auto parser = new Testparser.Parser(cast(const(ubyte) *)input.ptr, input.length);
assert(parser.parse() == true);
input = "abb";
parser = new Testparser.Parser(cast(const(ubyte) *)input.ptr, input.length);
assert(parser.parse() == true);
}