blob: 193a22b6dc849b20c9518e8c4be296754366c40f (
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
54
|
#ifndef LEXER_H
#define LEXER_H
#include <bu/stream.h>
class Token;
class Lexer
{
public:
Lexer( Bu::Stream &rIn );
virtual ~Lexer();
enum Mode
{
modeNormal,
modeCommand,
};
void setMode( Mode e ) { eMode = e; }
Mode getMode() const { return eMode; }
void nextToken();
int getScale() const { return iScale; }
void setScale( int i ) { iScale = i; }
int getRadix() const { return iRadix; }
void setRadix( int i );
Token &operator[]( int iIdx );
private:
void fillToken();
Token nextTokenNormal();
Token nextTokenCommand();
private:
Bu::Stream &rIn;
Bu::String sBuf;
int iBufPos;
int iScale;
int iRadix;
char numRangeTop;
char ascRangeTop;
Mode eMode;
int iLookAheadSize;
int iLookAheadUsed;
int iLookAheadStart;
Token *aLookAhead;
};
#endif
|