Lines Matching refs:token
177 Token token = PeekToken(); in SkipUntilToken() local
178 while (token.kind != tokenType) { in SkipUntilToken()
180 token = PeekToken(); in SkipUntilToken()
190 bool Lexer::ReadCacheableTime(Token &token) in ReadCacheableTime() argument
215 token.value = sb.ToString(); in ReadCacheableTime()
216 if (token.value.empty()) { in ReadCacheableTime()
223 void Lexer::ReadToken(Token &token, bool skipComment) in ReadToken() argument
226 InitCurToken(token); in ReadToken()
234 token.location.row = file_->GetCharLineNumber(); in ReadToken()
235 token.location.col = file_->GetCharColumnNumber(); in ReadToken()
237 ReadId(token); in ReadToken()
240 ReadNum(token); in ReadToken()
243 ReadShiftLeftOp(token); in ReadToken()
246 ReadShiftRightOp(token); in ReadToken()
249 ReadPPlusOp(token); in ReadToken()
252 ReadMMinusOp(token); in ReadToken()
255 ReadComment(token); in ReadToken()
256 …if ((token.kind == TokenType::COMMENT_BLOCK || token.kind == TokenType::COMMENT_LINE) && skipComme… in ReadToken()
257 InitCurToken(token); in ReadToken()
262 ReadSymbolToken(token); in ReadToken()
265 token.kind = TokenType::END_OF_FILE; in ReadToken()
266 token.value = ""; in ReadToken()
269 void Lexer::InitCurToken(Token &token) in InitCurToken() argument
271 token.kind = TokenType::UNKNOWN; in InitCurToken()
272 token.location.filePath = file_->GetPath(); in InitCurToken()
273 token.location.row = 1; in InitCurToken()
274 token.location.col = 1; in InitCurToken()
275 token.value = ""; in InitCurToken()
278 void Lexer::ReadId(Token &token) in ReadId() argument
298 token.kind = (it != keyWords_.end()) ? it->second : TokenType::ID; in ReadId()
299 token.value = sb.ToString(); in ReadId()
302 void Lexer::ReadNum(Token &token) in ReadNum() argument
310 ReadBinaryNum(token); in ReadNum()
313 return ReadOctNum(token); in ReadNum()
316 return ReadHexNum(token); in ReadNum()
319 token.kind = TokenType::NUM; in ReadNum()
320 token.value = "0"; in ReadNum()
323 ReadDecNum(token); in ReadNum()
325 ReadNumSuffix(token); in ReadNum()
328 void Lexer::ReadBinaryNum(Token &token) in ReadBinaryNum() argument
346 token.kind = err ? TokenType::UNKNOWN : TokenType::NUM; in ReadBinaryNum()
347 token.value = sb.ToString(); in ReadBinaryNum()
350 void Lexer::ReadOctNum(Token &token) in ReadOctNum() argument
369 token.kind = err ? TokenType::UNKNOWN : TokenType::NUM; in ReadOctNum()
370 token.value = sb.ToString(); in ReadOctNum()
373 void Lexer::ReadHexNum(Token &token) in ReadHexNum() argument
391 token.kind = err ? TokenType::UNKNOWN : TokenType::NUM; in ReadHexNum()
392 token.value = sb.ToString(); in ReadHexNum()
395 void Lexer::ReadDecNum(Token &token) in ReadDecNum() argument
411 token.kind = TokenType::NUM; in ReadDecNum()
412 token.value = sb.ToString(); in ReadDecNum()
415 void Lexer::ReadNumSuffix(Token &token) in ReadNumSuffix() argument
420 token.value += c; in ReadNumSuffix()
428 void Lexer::ReadShiftLeftOp(Token &token) in ReadShiftLeftOp() argument
434 token.kind = TokenType::LEFT_SHIFT; in ReadShiftLeftOp()
435 token.value = "<<"; in ReadShiftLeftOp()
441 token.kind = (iter != symbols_.end()) ? iter->second : TokenType::UNKNOWN; in ReadShiftLeftOp()
442 token.value = symbol; in ReadShiftLeftOp()
445 void Lexer::ReadShiftRightOp(Token &token) in ReadShiftRightOp() argument
451 token.kind = TokenType::RIGHT_SHIFT; in ReadShiftRightOp()
452 token.value = ">>"; in ReadShiftRightOp()
458 token.kind = (iter != symbols_.end()) ? iter->second : TokenType::UNKNOWN; in ReadShiftRightOp()
459 token.value = symbol; in ReadShiftRightOp()
462 void Lexer::ReadPPlusOp(Token &token) in ReadPPlusOp() argument
468 token.kind = TokenType::PPLUS; in ReadPPlusOp()
469 token.value = "++"; in ReadPPlusOp()
475 token.kind = (iter != symbols_.end()) ? iter->second : TokenType::UNKNOWN; in ReadPPlusOp()
476 token.value = symbol; in ReadPPlusOp()
479 void Lexer::ReadMMinusOp(Token &token) in ReadMMinusOp() argument
485 token.kind = TokenType::MMINUS; in ReadMMinusOp()
486 token.value = "--"; in ReadMMinusOp()
492 token.kind = (iter != symbols_.end()) ? iter->second : TokenType::UNKNOWN; in ReadMMinusOp()
493 token.value = symbol; in ReadMMinusOp()
496 void Lexer::ReadComment(Token &token) in ReadComment() argument
501 ReadLineComment(token); in ReadComment()
504 ReadBlockComment(token); in ReadComment()
510 token.kind = (iter != symbols_.end()) ? iter->second : TokenType::UNKNOWN; in ReadComment()
511 token.value = symbol; in ReadComment()
514 void Lexer::ReadLineComment(Token &token) in ReadLineComment() argument
528 token.kind = TokenType::COMMENT_LINE; in ReadLineComment()
529 token.value = sb.ToString(); in ReadLineComment()
532 void Lexer::ReadBlockComment(Token &token) in ReadBlockComment() argument
549 token.kind = TokenType::COMMENT_BLOCK; in ReadBlockComment()
550 token.value = sb.ToString(); in ReadBlockComment()
553 void Lexer::ReadSymbolToken(Token &token) in ReadSymbolToken() argument
558 token.kind = (iter != symbols_.end()) ? iter->second : TokenType::UNKNOWN; in ReadSymbolToken()
559 token.value = symbol; in ReadSymbolToken()