From 7dbb2831b81ff0174054d30b1fc105b2113c272d Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 8 Nov 2012 01:20:37 +0100 Subject: added support for labels, including the goto label table * uses BSD tree macros, might later be abstracted to a C++ table class --- parser.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'parser.cpp') diff --git a/parser.cpp b/parser.cpp index afcff41..4519c75 100644 --- a/parser.cpp +++ b/parser.cpp @@ -8,9 +8,7 @@ gint macro_pc = 0; -static struct { - StateStart start; -} states; +States states; static State *current_state = &states.start; @@ -19,10 +17,7 @@ static struct { bool at; } modifiers = {false, false}; -static enum Mode { - MODE_NORMAL = 0, - MODE_PARSE_ONLY -} mode = MODE_NORMAL; +enum Mode mode = MODE_NORMAL; /* FIXME: perhaps integrate into Mode */ static bool skip_else = false; @@ -34,6 +29,8 @@ static bool skip_else = false; static gint nest_level = 0; +gchar *strings[2] = {NULL, NULL}; + bool macro_execute(const gchar *macro) { @@ -113,6 +110,8 @@ StateStart::StateStart() : State() { transitions['\0'] = this; init(" \r\n\v"); + + transitions['!'] = &states.label; } void @@ -426,4 +425,3 @@ StateStart::custom(gchar chr) return this; } - -- cgit v1.2.3