Mercurial > repo
comparison interps/rail/src/MultiLexer.h @ 996:859f9b4339e6
<Gregor> tar xf egobot.tar.xz
author | HackBot |
---|---|
date | Sun, 09 Dec 2012 19:30:08 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
995:6883f5911eb7 | 996:859f9b4339e6 |
---|---|
1 // MultiLexer.h | |
2 | |
3 #ifndef MULTI_LEXER_H_RAIL_1 | |
4 #define MULTI_LEXER_H_RAIL_1 | |
5 | |
6 class MultiLexer | |
7 { | |
8 public: | |
9 MultiLexer(); | |
10 void reset(void); | |
11 void add(char letter); | |
12 | |
13 bool isStarted(void) const; | |
14 bool isDone(void) const; | |
15 bool isFunction(void) const; | |
16 bool isConstant(void) const; | |
17 bool isUse(void) const; | |
18 bool isBind(void) const; | |
19 std::string const & getToken(void) const; | |
20 private: | |
21 void inFunction(char letter); | |
22 void inConstant(char letter); | |
23 void inUse(char letter); | |
24 void inBind(char letter); | |
25 void tooManyLetters(char letter); | |
26 private: | |
27 enum StateT | |
28 { | |
29 EMPTY=0, | |
30 | |
31 FUNCTION_BEGIN, | |
32 FUNCTION_END, | |
33 | |
34 CONSTANT_BEGIN, | |
35 CONSTANT_END, | |
36 ESCAPE_BEGIN, | |
37 ESCAPE_END, | |
38 | |
39 VARIABLE_BEGIN, | |
40 USE_BEGIN, | |
41 USE_END, | |
42 BIND_BEGIN, | |
43 BIND_MIDDLE, | |
44 BIND_END | |
45 }; | |
46 private: | |
47 std::string token; | |
48 StateT state; | |
49 char openChar; | |
50 char closeChar; | |
51 }; | |
52 | |
53 #endif |