Handle shifting states after reducing
This commit is contained in:
1 parent
84c4a16ce6
commit
f2cc5b112e
4 files changed
+57
-9
No files matched your search
@@ -74,10 +74,13 @@ EOF
|
||||
write_grammar <<EOF
|
||||
token a
|
||||
token b
|
||||
drop \\s+
|
||||
Start -> a R1;
|
||||
Start -> b R1;
|
||||
R1 -> b;
|
||||
EOF
|
||||
build_parser
|
||||
compile("spec/test_d_lexer2.d")
|
||||
run
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,22 @@
|
||||
import testparser;
|
||||
import std.stdio;
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
string input = "a";
|
||||
auto parser = new Testparser.Parser(cast(const(ubyte) *)input.ptr, input.length);
|
||||
assert(parser.parse() == false);
|
||||
|
||||
input = "a b";
|
||||
parser = new Testparser.Parser(cast(const(ubyte) *)input.ptr, input.length);
|
||||
assert(parser.parse() == true);
|
||||
|
||||
input = "bb";
|
||||
parser = new Testparser.Parser(cast(const(ubyte) *)input.ptr, input.length);
|
||||
assert(parser.parse() == true);
|
||||
}
|
||||
Reference in new issue
Block a user