aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/parser.h b/parser.h
new file mode 100644
index 0000000..11a6d56
--- /dev/null
+++ b/parser.h
@@ -0,0 +1,45 @@
+#ifndef __PARSER_H
+#define __PARSER_H
+
+#include <glib.h>
+#include <glib/gprintf.h>
+
+#include "sciteco.h"
+
+class State {
+protected:
+ /* static transitions */
+ State *transitions[MAX_TRANSITIONS];
+
+public:
+ State();
+
+ inline State *&
+ operator [](int i)
+ {
+ return transitions[i];
+ }
+
+ static gboolean input(gchar chr);
+
+ inline State *
+ get_next_state(gchar chr)
+ {
+ return transitions[(int)g_ascii_toupper(chr)] ? : custom(chr);
+ }
+
+ virtual State *
+ custom(gchar chr)
+ {
+ return NULL;
+ }
+};
+
+class StateStart : public State {
+public:
+ StateStart();
+
+ State *custom(gchar chr);
+};
+
+#endif