Use PrecedenceRange in build_lex_table
This commit is contained in:
parent
11a1ea8dfe
commit
5455fb977f
5 changed files with 37 additions and 40 deletions
|
|
@ -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());
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue