diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-06 20:42:40 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-06 20:42:40 +0100 |
commit | 8cd29b9b30400e4275f1a65744cd0b3c2669cc98 (patch) | |
tree | f6297b44f6b7d9d6546311878070383d2d064f45 /parser.h | |
download | sciteco-8cd29b9b30400e4275f1a65744cd0b3c2669cc98.tar.gz |
initial commit of SciTECO based on THECO
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 45 |
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 |