1//===- LLLexer.cpp - Lexer for .ll Files ----------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 240 unchanged lines hidden (view full) --- 249 CurPtr = Ptr; 250 StrVal.assign(TokStart, CurPtr-1); 251 return lltok::LabelStr; 252 } 253 return lltok::Error; 254 case ';': 255 SkipLineComment(); 256 return LexToken(); |
257 case '!': return LexExclaim(); |
258 case '0': case '1': case '2': case '3': case '4': 259 case '5': case '6': case '7': case '8': case '9': 260 case '-': 261 return LexDigitOrNegative(); 262 case '=': return lltok::equal; 263 case '[': return lltok::lsquare; 264 case ']': return lltok::rsquare; 265 case '{': return lltok::lbrace; --- 151 unchanged lines hidden (view full) --- 417 ++ThisPtr; 418 if (*ThisPtr == '\n' || *ThisPtr == '\r') { 419 Ptr = ThisPtr; 420 return true; 421 } 422 return false; 423} 424 |
425/// LexExclaim: |
426/// !foo |
427/// ! 428lltok::Kind LLLexer::LexExclaim() { 429 // Lex a metadata name as a MetadataVar. |
430 if (isalpha(CurPtr[0])) { 431 ++CurPtr; 432 while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || 433 CurPtr[0] == '.' || CurPtr[0] == '_') 434 ++CurPtr; 435 436 StrVal.assign(TokStart+1, CurPtr); // Skip ! |
437 return lltok::MetadataVar; |
438 } |
439 return lltok::exclaim; |
440} 441 442/// LexIdentifier: Handle several related productions: 443/// Label [-a-zA-Z$._0-9]+: 444/// IntegerType i[0-9]+ 445/// Keyword sdiv, float, ... 446/// HexIntConstant [us]0x[0-9A-Fa-f]+ 447lltok::Kind LLLexer::LexIdentifier() { --- 417 unchanged lines hidden --- |