| 62 bool peekNextType (Token req); |
62 bool peekNextType (Token req); |
| 63 String peekNextString (int a = 1); |
63 String peekNextString (int a = 1); |
| 64 String describeCurrentPosition(); |
64 String describeCurrentPosition(); |
| 65 String describeTokenPosition(); |
65 String describeTokenPosition(); |
| 66 |
66 |
| 67 static Lexer* getCurrentLexer(); |
67 static Lexer* GetCurrentLexer(); |
| 68 |
68 |
| 69 inline bool hasValidToken() const |
69 inline bool hasValidToken() const |
| 70 { |
70 { |
| 71 return (m_tokenPosition < m_tokens.end() and m_tokenPosition >= m_tokens.begin()); |
71 return (m_tokenPosition < m_tokens.end() and m_tokenPosition >= m_tokens.begin()); |
| 72 } |
72 } |
| 101 { |
101 { |
| 102 m_tokenPosition = m_tokens.begin() + pos; |
102 m_tokenPosition = m_tokens.begin() + pos; |
| 103 } |
103 } |
| 104 |
104 |
| 105 // If @tok is given, describes the token. If not, describes @tok_type. |
105 // If @tok is given, describes the token. If not, describes @tok_type. |
| 106 static inline String describeTokenType (Token toktype) |
106 static inline String DescribeTokenType (Token toktype) |
| 107 { |
107 { |
| 108 return describeTokenPrivate (toktype, null); |
108 return DescribeTokenPrivate (toktype, null); |
| 109 } |
109 } |
| 110 |
110 |
| 111 static inline String describeToken (TokenInfo* tok) |
111 static inline String DescribeToken (TokenInfo* tok) |
| 112 { |
112 { |
| 113 return describeTokenPrivate (tok->type, tok); |
113 return DescribeTokenPrivate (tok->type, tok); |
| 114 } |
114 } |
| 115 |
115 |
| 116 private: |
116 private: |
| 117 TokenList m_tokens; |
117 TokenList m_tokens; |
| 118 Iterator m_tokenPosition; |
118 Iterator m_tokenPosition; |
| 119 |
119 |
| 120 // read a mandatory token from scanner |
120 // read a mandatory token from scanner |
| 121 void mustGetFromScanner (LexerScanner& sc, Token tt =Token::Any); |
121 void mustGetFromScanner (LexerScanner& sc, Token tt =Token::Any); |
| 122 void checkFileHeader (LexerScanner& sc); |
122 void checkFileHeader (LexerScanner& sc); |
| 123 |
123 |
| 124 static String describeTokenPrivate (Token tok_type, TokenInfo* tok); |
124 static String DescribeTokenPrivate (Token tok_type, TokenInfo* tok); |
| 125 }; |
125 }; |
| 126 |
126 |
| 127 #endif // BOTC_LEXER_H |
127 #endif // BOTC_LEXER_H |