summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-04-05 02:37:25 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-04-05 02:37:25 +0200
commit9154865ac31c41895ce1ac0842cd8aad277cb08b (patch)
treed926a9b71131c9994a358aff5e72f518475aacee
parent96dd0ebd2618df6ed0c1acf795e9a7054592b566 (diff)
downloadsolar-9154865ac31c41895ce1ac0842cd8aad277cb08b.tar
solar-9154865ac31c41895ce1ac0842cd8aad277cb08b.zip
output: fix emission of terminal case conditions
-rw-r--r--src/output.cpp4
1 files 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");