[llvm-commits] [llvm] r115704 - /llvm/trunk/utils/TableGen/TGLexer.cpp
Chris Lattner
sabre at nondot.org
Tue Oct 5 15:59:29 PDT 2010
Author: lattner
Date: Tue Oct 5 17:59:29 2010
New Revision: 115704
URL: http://llvm.org/viewvc/llvm-project?rev=115704&view=rev
Log:
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.
Modified:
llvm/trunk/utils/TableGen/TGLexer.cpp
Modified: llvm/trunk/utils/TableGen/TGLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=115704&r1=115703&r2=115704&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGLexer.cpp (original)
+++ llvm/trunk/utils/TableGen/TGLexer.cpp Tue Oct 5 17:59:29 2010
@@ -96,7 +96,7 @@
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::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.
More information about the llvm-commits
mailing list