blob: 11a6d5686792cb4fe5e78f6dfac053f75aa9cd67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
|