aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parser.cpp')
-rw-r--r--parser.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/parser.cpp b/parser.cpp
index 3178421..1ce6e2c 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -33,7 +33,7 @@ macro_execute(const gchar *macro)
State::State()
{
- for (int i = 0; i < MAX_TRANSITIONS; i++)
+ for (guint i = 0; i < G_N_ELEMENTS(transitions); i++)
transitions[i] = NULL;
}
@@ -64,6 +64,20 @@ State::input(gchar chr)
return TRUE;
}
+State *
+State::get_next_state(gchar chr)
+{
+ State *next = NULL;
+ guint upper = g_ascii_toupper(chr);
+
+ if (upper < G_N_ELEMENTS(transitions))
+ next = transitions[upper];
+ if (!next)
+ next = custom(chr);
+
+ return next;
+}
+
StateStart::StateStart() : State()
{
transitions['\0'] = this;