1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

when david added support for #NAME# he didn't update the comments and

tried (but failed) to artificially constrain it to working with #NAME#.
Just allow any # in identifiers, and update the comments.

llvm-svn: 115704
This commit is contained in:
Chris Lattner 2010-10-05 22:59:29 +00:00
parent 38e84dd7ea
commit 8365ab867e

View File

@ -96,7 +96,7 @@ tgtok::TokKind TGLexer::LexToken() {
switch (CurChar) {
default:
// Handle letters: [a-zA-Z_]
// Handle letters: [a-zA-Z_#]
if (isalpha(CurChar) || CurChar == '_' || CurChar == '#')
return LexIdentifier();
@ -215,23 +215,13 @@ tgtok::TokKind TGLexer::LexVarName() {
tgtok::TokKind TGLexer::LexIdentifier() {
// The first letter is [a-zA-Z_].
// The first letter is [a-zA-Z_#].
const char *IdentStart = TokStart;
// Match the rest of the identifier regex: [0-9a-zA-Z_]*
while (isalpha(*CurPtr) || isdigit(*CurPtr) || *CurPtr == '_'
|| *CurPtr == '#') {
// If this contains a '#', make sure it's value
if (*CurPtr == '#') {
if (strncmp(CurPtr, "#NAME#", 6) != 0) {
return tgtok::Error;
}
CurPtr += 6;
}
else {
++CurPtr;
}
}
// Match the rest of the identifier regex: [0-9a-zA-Z_#]*
while (isalpha(*CurPtr) || isdigit(*CurPtr) || *CurPtr == '_' ||
*CurPtr == '#')
++CurPtr;
// Check to see if this identifier is a keyword.