1
2
3
4
5
6 #ifndef SOULNG_LEXER_TOKEN_INCLUDED
7 #define SOULNG_LEXER_TOKEN_INCLUDED
8 #include <soulng/lexer/Lexeme.hpp>
9 #include <vector>
10 #include <string>
11
12 namespace soulng { namespace lexer {
13
14 const int CONTINUE_TOKEN = -2;
15 const int INVALID_TOKEN = -1;
16 const int END_TOKEN = 0;
17
18 struct Token
19 {
20 Token() : id(INVALID_TOKEN), match(), line(1) { }
21 Token(int id_) : id(id_), match(), line(1) { }
22 Token(int id_, const Lexeme& match_, int line_) : id(id_), match(match_), line(line_) { }
23 int id;
24 Lexeme match;
25 int line;
26 };
27
28 bool NoWhiteSpaceBetweenTokens(const Token& first, const Token& second);
29
30 std::string GetEndTokenInfo();
31
32 struct TokenLine
33 {
34 TokenLine() : startState(0), endState(0) {}
35 int TokenIndex(int columnNumber) const;
36 std::vector<Token> tokens;
37 int startState;
38 int endState;
39 };
40
41 } }
42
43 #endif // SOULNG_LEXER_TOKEN_INCLUDED