From 8cd29b9b30400e4275f1a65744cd0b3c2669cc98 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 6 Nov 2012 20:42:40 +0100 Subject: initial commit of SciTECO based on THECO --- parser.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 parser.h (limited to 'parser.h') 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 +#include + +#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 -- cgit v1.2.3