-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoken.h
62 lines (48 loc) · 1.56 KB
/
token.h
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
55
56
57
58
59
60
61
62
// ****************************************************************************
// ****************************************************************************
// token.h
// ****************************************************************************
//
// ****************************************************************************
// ****************************************************************************
// ****************************************************************************
// Defines
// ****************************************************************************
#ifndef H_TOKEN
#define H_TOKEN
// ****************************************************************************
// State Class
// ****************************************************************************
class Token {
public:
enum Type {
NONE,
Operator,
PrimType,
StmtWord,
Paren,
Identifier,
BoolConst,
RealConst,
IntConst,
StrConst,
END
};
Token(Token::Type type,
const comString& spelling,
UINT line);
const Type getType() const {return m_type;}
const comString& getSpelling() const {return m_spelling;}
UINT getLine() const {return m_line;}
comString& printable(comString& buf);
static void init();
static const comString& getTypeName(Type type) {return m_typeNames[type];}
static const comString& getExample(Type type) {return m_examples[type];}
private:
Type m_type;
comString m_spelling;
UINT m_line;
static comString m_typeNames[Token::END];
static comString m_examples[Token::END];
};
#endif