From b3bb24667ac2750d27042e904d95c0862e00d045 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sat, 19 May 2007 07:21:26 +0000 Subject: [PATCH] Make the %"..." syntax legal for local name. This just makes it symmetric with global names which can already be @"..." llvm-svn: 37257 --- lib/AsmParser/Lexer.l | 6 ++++++ lib/AsmParser/llvmAsmParser.y | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l index b67f6ff1024..2218aa5164b 100644 --- a/lib/AsmParser/Lexer.l +++ b/lib/AsmParser/Lexer.l @@ -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); diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index d8e151c48d5..30a1fe6ffb1 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -1051,7 +1051,8 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { %token FLOAT DOUBLE LABEL %token TYPE -%token LOCALVAR GLOBALVAR LABELSTR STRINGCONSTANT ATSTRINGCONSTANT +%token LOCALVAR GLOBALVAR LABELSTR +%token STRINGCONSTANT ATSTRINGCONSTANT PCTSTRINGCONSTANT %type LocalName OptLocalName OptLocalAssign %type GlobalName OptGlobalAssign GlobalAssign %type 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