From 6c23f57ebc82894a58a5f38702362e260d95d0a4 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 22 Aug 2003 05:42:10 +0000 Subject: [PATCH] Accept double quoted strings everwhere we accept a %ABC variable name. This introduces one more innoculous shift-reduce conflict, but will REALLY help the type names generated by the C++ frontend, which wants to use all kinds of crazy stuff. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8050 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/llvmAsmParser.y | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index a90b5f5edb9..08a855416cf 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -698,8 +698,8 @@ Module *RunVMAsmParser(const std::string &Filename, FILE *F) { %token VOID BOOL SBYTE UBYTE SHORT USHORT INT UINT LONG ULONG %token FLOAT DOUBLE TYPE LABEL -%token VAR_ID LABELSTR STRINGCONSTANT -%type OptVAR_ID OptAssign FuncName +%token VAR_ID LABELSTR STRINGCONSTANT +%type Name OptName OptAssign %token IMPLEMENTATION ZEROINITIALIZER TRUE FALSE BEGINTOK ENDTOK @@ -728,7 +728,6 @@ Module *RunVMAsmParser(const std::string &Filename, FILE *F) { // Handle constant integer size restriction and conversion... // - INTVAL : SINTVAL; INTVAL : UINTVAL { if ($1 > (uint32_t)INT32_MAX) // Outside of my range! @@ -762,7 +761,7 @@ IntType : SIntType | UIntType; FPType : FLOAT | DOUBLE; // OptAssign - Value producing statements have an optional assignment component -OptAssign : VAR_ID '=' { +OptAssign : Name '=' { $$ = $1; } | /*empty*/ { @@ -1246,9 +1245,10 @@ TargetDefinition : ENDIAN '=' BigOrLittle { // Rules to match Function Headers //===----------------------------------------------------------------------===// -OptVAR_ID : VAR_ID | /*empty*/ { $$ = 0; }; +Name : VAR_ID | STRINGCONSTANT; +OptName : Name | /*empty*/ { $$ = 0; }; -ArgVal : Types OptVAR_ID { +ArgVal : Types OptName { if (*$1 == Type::VoidTy) ThrowException("void typed arguments are invalid!"); $$ = new std::pair($1, $2); @@ -1281,9 +1281,7 @@ ArgList : ArgListH { $$ = 0; }; -FuncName : VAR_ID | STRINGCONSTANT; - -FunctionHeaderH : TypesV FuncName '(' ArgList ')' { +FunctionHeaderH : TypesV Name '(' ArgList ')' { UnEscapeLexed($2); std::string FunctionName($2); @@ -1409,7 +1407,7 @@ ConstValueRef : ESINT64VAL { // A reference to a direct constant SymbolicValueRef : INTVAL { // Is it an integer reference...? $$ = ValID::create($1); } - | VAR_ID { // Is it a named reference...? + | Name { // Is it a named reference...? $$ = ValID::create($1); }; -- 2.34.1