diff --git a/spec/compiler/build_tables/item_set_transitions_spec.cc b/spec/compiler/build_tables/item_set_transitions_spec.cc index dcaf6b0c..3ec84e1e 100644 --- a/spec/compiler/build_tables/item_set_transitions_spec.cc +++ b/spec/compiler/build_tables/item_set_transitions_spec.cc @@ -7,7 +7,7 @@ using namespace build_tables; START_TEST -describe("item set transitions", []() { +describe("lexical item set transitions", []() { PreparedGrammar grammar({}, {}); describe("when two items in the set have transitions on the same character", [&]() { @@ -29,4 +29,26 @@ describe("item set transitions", []() { }); }); +describe("syntactic item set transitions", [&]() { + PreparedGrammar grammar({ + { "A", blank() }, + { "B", i_token(21) }, + }, {}); + + it("computes the closure of the new item sets", [&]() { + ParseItemSet set1({ + ParseItem(Symbol(0), seq({ i_token(22), i_sym(1) }), 3, Symbol(23, SymbolOptionToken)), + }); + + SymTransitions sym_transitions; + + AssertThat(sym_transitions(set1, grammar), Equals(map({ + { Symbol(22, SymbolOptionToken), ParseItemSet({ + ParseItem(Symbol(0), i_sym(1), 4, Symbol(23, SymbolOptionToken)), + ParseItem(Symbol(1), i_token(21), 0, Symbol(23, SymbolOptionToken)) + }) }, + }))); + }); +}); + END_TEST \ No newline at end of file