Use PrecedenceRange in build_lex_table

This commit is contained in:
Max Brunsfeld 2015-10-05 18:02:59 -07:00
parent 11a1ea8dfe
commit 5455fb977f
5 changed files with 37 additions and 40 deletions

View file

@ -22,19 +22,19 @@ describe("LexConflictManager", []() {
Symbol sym3(2, true);
it("favors non-errors over lexical errors", [&]() {
update = conflict_manager.resolve(LexAction::Advance(2, {0}), LexAction::Error());
update = conflict_manager.resolve(LexAction::Advance(2, {0, 0}), LexAction::Error());
AssertThat(update, IsTrue());
update = conflict_manager.resolve(LexAction::Error(), LexAction::Advance(2, {0}));
update = conflict_manager.resolve(LexAction::Error(), LexAction::Advance(2, {0, 0}));
AssertThat(update, IsFalse());
});
describe("accept-token/advance conflicts", [&]() {
it("prefers the advance", [&]() {
update = conflict_manager.resolve(LexAction::Advance(1, { 0 }), LexAction::Accept(sym3, 3));
update = conflict_manager.resolve(LexAction::Advance(1, { 0, 0 }), LexAction::Accept(sym3, 3));
AssertThat(update, IsTrue());
update = conflict_manager.resolve(LexAction::Accept(sym3, 3), LexAction::Advance(1, { 0 }));
update = conflict_manager.resolve(LexAction::Accept(sym3, 3), LexAction::Advance(1, { 0, 0 }));
AssertThat(update, IsFalse());
});
});