summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/TGLexer.cpp
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
commitb8ff8f0cb6343c1b1234316ce3a840b35e3f76e1 (patch)
treef4a3b445a3962185d3ab1b056722dcc27e6d0a60 /llvm/utils/TableGen/TGLexer.cpp
parentc25b39702fa8ab0c57dd19534e50d8c5c546427c (diff)
downloadbcm5719-llvm-b8ff8f0cb6343c1b1234316ce3a840b35e3f76e1.tar.gz
bcm5719-llvm-b8ff8f0cb6343c1b1234316ce3a840b35e3f76e1.zip
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
Diffstat (limited to 'llvm/utils/TableGen/TGLexer.cpp')
-rw-r--r--llvm/utils/TableGen/TGLexer.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/llvm/utils/TableGen/TGLexer.cpp b/llvm/utils/TableGen/TGLexer.cpp
index b444b9ccda0..4ea2e9118ef 100644
--- a/llvm/utils/TableGen/TGLexer.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud