Make the EOF be an auxiliary symbol

This way, it couldn’t conflict if a user had a rule called “__END__”
This commit is contained in:
Max Brunsfeld 2014-02-10 18:53:01 -08:00
parent 15c9e2d398
commit 3cb65c9c81
6 changed files with 659 additions and 670 deletions

View file

@ -77,19 +77,6 @@ describe("building parse and lex tables", []() {
CharacterSet({ {'a', 'z'}, {'A', 'Z'} }, true),
})));
});
it("accepts when the start symbol is reduced", [&]() {
AssertThat(parse_state(1).actions, Equals(map<Symbol, parse_actions>({
{ Symbol("__END__"), parse_actions({ ParseAction::Accept() }) }
})));
});
it("has the right next states", [&]() {
AssertThat(parse_state(2).actions, Equals(map<Symbol, parse_actions>({
{ Symbol("plus"), parse_actions({ ParseAction::Shift(3) }) },
{ Symbol("__END__"), parse_actions({ ParseAction::Reduce(Symbol("expression"), { false }) }) },
})));
});
});
END_TEST