src/Lexer.cc

changeset 89
029a330a9bef
parent 88
5def6ff8b466
child 99
44c0c7f31ae8
equal deleted inserted replaced
88:5def6ff8b466 89:029a330a9bef
196 } 196 }
197 } 197 }
198 198
199 // ============================================================================= 199 // =============================================================================
200 // 200 //
201 void Lexer::MustGetAnyOf (const List< EToken >& toks) 201 void Lexer::MustGetAnyOf (const List<EToken>& toks)
202 { 202 {
203 if (!GetNext()) 203 if (!GetNext())
204 Error ("unexpected EOF"); 204 Error ("unexpected EOF");
205 205
206 for (EToken tok : toks) 206 for (EToken tok : toks)
302 mTokenPosition += a; 302 mTokenPosition += a;
303 String result = GetToken()->text; 303 String result = GetToken()->text;
304 mTokenPosition = oldpos; 304 mTokenPosition = oldpos;
305 return result; 305 return result;
306 } 306 }
307
308 // =============================================================================
309 //
310 String Lexer::DescribePosition()
311 {
312 return Format ("%1 / %2", mTokenPosition - mTokens.begin(), mTokens.Size());
313 }

mercurial