diff options
Diffstat (limited to 'src/experimental/lexer.h')
-rw-r--r-- | src/experimental/lexer.h | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/experimental/lexer.h b/src/experimental/lexer.h index 69f4106..273f3cf 100644 --- a/src/experimental/lexer.h +++ b/src/experimental/lexer.h | |||
@@ -12,47 +12,47 @@ | |||
12 | 12 | ||
13 | namespace Bu | 13 | namespace Bu |
14 | { | 14 | { |
15 | class Stream; | 15 | class Stream; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * The base class for creating a lexical analyzer. This is designed to work | 18 | * The base class for creating a lexical analyzer. This is designed to work |
19 | * in tandem with the Bu::Parser class, which uses this to tokenize textual | 19 | * in tandem with the Bu::Parser class, which uses this to tokenize textual |
20 | * input. It can be used by just about anything that cares about tokens | 20 | * input. It can be used by just about anything that cares about tokens |
21 | * more than raw input, though. | 21 | * more than raw input, though. |
22 | */ | 22 | */ |
23 | class Lexer | 23 | class Lexer |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | Lexer(); | 26 | Lexer(); |
27 | virtual ~Lexer(); | 27 | virtual ~Lexer(); |
28 | 28 | ||
29 | typedef int TokenType; | 29 | typedef int TokenType; |
30 | 30 | ||
31 | class Token | 31 | class Token |
32 | { | 32 | { |
33 | public: | 33 | public: |
34 | Token(); | 34 | Token(); |
35 | Token( TokenType iToken ); | 35 | Token( TokenType iToken ); |
36 | 36 | ||
37 | template<class t> | 37 | template<class t> |
38 | Token( TokenType iToken, const t &v ) : | 38 | Token( TokenType iToken, const t &v ) : |
39 | iToken( iToken )//, | 39 | iToken( iToken )//, |
40 | // vExtra( v ) | 40 | // vExtra( v ) |
41 | { | 41 | { |
42 | vExtra = v; | 42 | vExtra = v; |
43 | } | 43 | } |
44 | TokenType iToken; | 44 | TokenType iToken; |
45 | Bu::Variant vExtra; | 45 | Bu::Variant vExtra; |
46 | int iStartCol; | 46 | int iStartCol; |
47 | int iStartRow; | 47 | int iStartRow; |
48 | int iEndCol; | 48 | int iEndCol; |
49 | int iEndRow; | 49 | int iEndRow; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | virtual Token *nextToken()=0; | 52 | virtual Token *nextToken()=0; |
53 | 53 | ||
54 | virtual Bu::String tokenToString( const Token &t ); | 54 | virtual Bu::String tokenToString( const Token &t ); |
55 | }; | 55 | }; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #endif | 58 | #endif |