Make the %"..." syntax legal for local name. This just makes it symmetric
authorReid Spencer <rspencer@reidspencer.com>
Sat, 19 May 2007 07:21:26 +0000 (07:21 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sat, 19 May 2007 07:21:26 +0000 (07:21 +0000)
with global names which can already be @"..."

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37257 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/Lexer.l
lib/AsmParser/llvmAsmParser.y

index b67f6ff102462e9ee7d71b7e22c62c6c2f2de13a..2218aa5164b8886c3d81cd2159c82d765fadb730 100644 (file)
@@ -161,6 +161,7 @@ QuoteLabel \"[^\"]+\":
 /* Quoted names can contain any character except " and \ */
 StringConstant \"[^\"]*\"
 AtStringConstant @\"[^\"]*\"
+PctStringConstant %\"[^\"]*\"
   
 /* LocalVarID/GlobalVarID: match an unnamed local variable slot ID. */
 LocalVarID     %[0-9]+
@@ -366,6 +367,11 @@ shufflevector   { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
                      return ATSTRINGCONSTANT;
                    }
 
+{PctStringConstant} {
+                     yytext[strlen(yytext)-1] = 0;           // nuke end quote
+                     llvmAsmlval.StrVal = strdup(yytext+2);  // Nuke @, quote
+                     return PCTSTRINGCONSTANT;
+                   }
 {PInteger}      { int len = strlen(yytext); 
                   uint32_t numBits = ((len * 64) / 19) + 1;
                   APInt Tmp(numBits, yytext, len, 10);
index d8e151c48d52b0f609feb874926377f96e408ca6..30a1fe6ffb19e507b7d5f4f34f5dad0b0b347e85 100644 (file)
@@ -1051,7 +1051,8 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
 %token <PrimType> FLOAT DOUBLE LABEL
 %token TYPE
 
-%token<StrVal> LOCALVAR GLOBALVAR LABELSTR STRINGCONSTANT ATSTRINGCONSTANT
+%token<StrVal> LOCALVAR GLOBALVAR LABELSTR 
+%token<StrVal> STRINGCONSTANT ATSTRINGCONSTANT PCTSTRINGCONSTANT
 %type <StrVal> LocalName OptLocalName OptLocalAssign
 %type <StrVal> GlobalName OptGlobalAssign GlobalAssign
 %type <UIntVal> OptAlign OptCAlign
@@ -1138,7 +1139,7 @@ FPredicates
 IntType :  INTTYPE;
 FPType   : FLOAT | DOUBLE;
 
-LocalName : LOCALVAR | STRINGCONSTANT;
+LocalName : LOCALVAR | STRINGCONSTANT | PCTSTRINGCONSTANT
 OptLocalName : LocalName | /*empty*/ { $$ = 0; };
 
 /// OptLocalAssign - Value producing statements have an optional assignment