diff --git a/spec/compiler/build_tables/perform_spec.cpp b/spec/compiler/build_tables/perform_spec.cpp index 37232b89..552a11c8 100644 --- a/spec/compiler/build_tables/perform_spec.cpp +++ b/spec/compiler/build_tables/perform_spec.cpp @@ -36,16 +36,22 @@ describe("building parse and lex tables", []() { { "right-paren", str(")") } }); - pair tables = perform(grammar, lex_grammar); - ParseTable table = tables.first; - LexTable lex_table = tables.second; + + ParseTable table; + LexTable lex_table; + + before_each([&]() { + pair tables = perform(grammar, lex_grammar); + table = tables.first; + lex_table = tables.second; + }); function parse_state = [&](size_t index) { return table.states[index]; }; function lex_state = [&](size_t parse_state_index) { - size_t index = table.states[parse_state_index].lex_state_index; + long index = table.states[parse_state_index].lex_state_index; return lex_table.states[index]; };