blob: 007b9429dd8dfe0a469192956753d788126fb50d (
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
46
47
48
49
50
51
52
53
|
#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];
inline void
init(const gchar *chars, State &state)
{
while (*chars)
transitions[(int)*chars++] = &state;
}
inline void
init(const gchar *chars)
{
init(chars, *this);
}
public:
State();
static bool input(gchar chr);
State *get_next_state(gchar chr);
protected:
static bool eval_colon(void);
virtual State *
custom(gchar chr)
{
return NULL;
}
};
class StateStart : public State {
public:
StateStart();
private:
void move(gint64 n);
void move_lines(gint64 n);
State *custom(gchar chr);
};
#endif
|