1
2
3
4
5
6 #include <soulng/lexer/Token.hpp>
7
8 namespace soulng { namespace lexer {
9
10 bool NoWhiteSpaceBetweenTokens(const Token& first, const Token& second)
11 {
12 if (first.match.end == second.match.begin) return true;
13 return false;
14 }
15
16 std::string GetEndTokenInfo()
17 {
18 return "end of file";
19 }
20
21 int TokenLine::TokenIndex(int columnNumber) const
22 {
23 int col = 1;
24 int index = 0;
25 for (const Token& token : tokens)
26 {
27 int len = token.match.end - token.match.begin;
28 if (columnNumber >= col && columnNumber < col + len)
29 {
30 return index;
31 }
32 col += len;
33 ++index;
34 }
35 return -1;
36 }
37
38 } }