summaryrefslogtreecommitdiff
path: root/utils/TableGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-10-05 22:59:29 +0000
committerChris Lattner <sabre@nondot.org>2010-10-05 22:59:29 +0000
commitc2b0875b8d9e08a19f9ed9fae02fb121e4fc4a1f (patch)
tree5700b6180df821b678211f012d16427b2fda3127 /utils/TableGen
parente2a268fd03fd07f1e5d6121d2a29da42447cea35 (diff)
downloadllvm-c2b0875b8d9e08a19f9ed9fae02fb121e4fc4a1f.tar.gz
llvm-c2b0875b8d9e08a19f9ed9fae02fb121e4fc4a1f.tar.bz2
llvm-c2b0875b8d9e08a19f9ed9fae02fb121e4fc4a1f.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/TGLexer.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/utils/TableGen/TGLexer.cpp b/utils/TableGen/TGLexer.cpp
index b444b9ccda..4ea2e9118e 100644
--- a/utils/TableGen/TGLexer.cpp
+++ b/utils/TableGen/TGLexer.cpp
@@ -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.