From be5e406c9619c039d3a1c7f3618baef605f8d1e8 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 21 Jan 2014 23:33:26 -0800 Subject: [PATCH] Do less work when loading build_tables spec --- spec/compiler/build_tables/perform_spec.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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]; };