[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.y

Reid Spencer reid at x10sys.com
Sat May 19 00:21:59 PDT 2007



Changes in directory llvm/lib/AsmParser:

Lexer.l updated: 1.107 -> 1.108
llvmAsmParser.y updated: 1.356 -> 1.357
---
Log message:

Make the %"..." syntax legal for local name. This just makes it symmetric
with global names which can already be @"..."


---
Diffs of the changes:  (+9 -2)

 Lexer.l         |    6 ++++++
 llvmAsmParser.y |    5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)


Index: llvm/lib/AsmParser/Lexer.l
diff -u llvm/lib/AsmParser/Lexer.l:1.107 llvm/lib/AsmParser/Lexer.l:1.108
--- llvm/lib/AsmParser/Lexer.l:1.107	Sun Apr 29 13:35:00 2007
+++ llvm/lib/AsmParser/Lexer.l	Sat May 19 02:21:26 2007
@@ -161,6 +161,7 @@
 /* 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 @@
                      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: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.356 llvm/lib/AsmParser/llvmAsmParser.y:1.357
--- llvm/lib/AsmParser/llvmAsmParser.y:1.356	Thu May  3 23:01:07 2007
+++ llvm/lib/AsmParser/llvmAsmParser.y	Sat May 19 02:21:26 2007
@@ -1051,7 +1051,8 @@
 %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 @@
 IntType :  INTTYPE;
 FPType   : FLOAT | DOUBLE;
 
-LocalName : LOCALVAR | STRINGCONSTANT;
+LocalName : LOCALVAR | STRINGCONSTANT | PCTSTRINGCONSTANT
 OptLocalName : LocalName | /*empty*/ { $$ = 0; };
 
 /// OptLocalAssign - Value producing statements have an optional assignment






More information about the llvm-commits mailing list