-
Notifications
You must be signed in to change notification settings - Fork 3
/
TokenList.hpp
65 lines (51 loc) · 1.24 KB
/
TokenList.hpp
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
63
64
65
#ifndef SoftWire_TokenList_hpp
#define SoftWire_TokenList_hpp
namespace SoftWire
{
class Macro;
class Token;
class TokenList
{
public:
TokenList();
~TokenList();
// Properties of current token (pointer)
bool isEndOfFile() const;
bool isEndOfLine() const;
bool isIdentifier(const char *compareString = 0) const;
bool isInteger() const;
bool isReal() const;
bool isPunctuator(char c = 0) const;
bool isLiteral() const;
bool isConstant() const;
const char *getString() const;
char getChar() const;
int getInteger() const;
float getReal() const;
const Token ¤t() const;
const Token &lookAhead(int n = 1) const;
const Token &advance(int n = 1);
void append(const Token &token);
void erase(int n = 1);
void overwrite(const Token &token);
void insertBefore(const Token &token);
void insertAfter(const Token &token);
void paste(TokenList &tokenList);
void expand(Macro ¯o);
void rewind();
bool isEmpty() const;
private:
class TokenLink
{
public:
TokenLink();
~TokenLink();
Token *token;
TokenLink *next;
};
TokenLink *head;
TokenLink *tail;
TokenLink *pointer;
};
}
#endif // SoftWire_TokenList_hpp