From 9154865ac31c41895ce1ac0842cd8aad277cb08b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 5 Apr 2015 02:37:25 +0200 Subject: output: fix emission of terminal case conditions --- src/output.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/output.cpp b/src/output.cpp index 1b4d6d8..4af9a1c 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -34,7 +34,7 @@ namespace solar { output_t::output_t(const generator_t *generator0, const char *header, const char *source) : prefix_str("parse_"), - token_prefix_str("TOKEN_"), + token_prefix_str("TOK_"), stack_size(100), generator(generator0) { header_file = std::fopen(header, "w"); @@ -107,7 +107,7 @@ void output_t::emit_state_shift(unsigned i) { if (token.get_type() == SYMBOL_TYPE_CHAR) std::fprintf(source_file, "\t\t\tcase '%c':\n", token.get_value()[0]); else - std::fprintf(source_file, "\t\t\tcase %u:\n", tokens[token.get_value()]); + std::fprintf(source_file, "\t\t\tcase %s%s:\n", token_prefix(), token.get_value().c_str()); std::fprintf(source_file, "\t\t\t\tparser->stack[++parser->top].state = %u;\n", unsigned(it->second)); std::fprintf(source_file, "\t\t\t\treturn 1;\n\n"); -- cgit v1.2.3