Return a lexer error on unexpected input - close #3

This commit is contained in:
josh committed 2023-07-08 10:36:58 -04:00
1 parent ecef933255
commit 83a4037740
2 files changed
+42

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import testparser;
import std.stdio;
int main()
{
return 0;
}
unittest
{
string input = `x`;
auto parser = new Testparser.Parser(input);
assert(parser.parse() == Testparser.P_UNEXPECTED_INPUT);
input = `123`;
parser = new Testparser.Parser(input);
assert(parser.parse() == Testparser.P_SUCCESS);
assert(parser.result == 123u);
}