Allow open/closing curly braces instead of begin/end to define the body of a function
authorChris Lattner <sabre@nondot.org>
Fri, 3 May 2002 18:23:48 +0000 (18:23 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 3 May 2002 18:23:48 +0000 (18:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2451 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 9cfe9fd78e5ad5f0cc48bed66566ade2de99047e..faddcb16d51d3801e1d1fc9acbf5a832bf69a1b8 100644 (file)
@@ -147,7 +147,7 @@ HexFPConstant 0x[0-9A-Fa-f]+
 {Comment}       { /* Ignore comments for now */ }
 
 begin           { return BEGINTOK; }
-end             { return END; }
+end             { return ENDTOK; }
 true            { return TRUE;  }
 false           { return FALSE; }
 declare         { return DECLARE; }
index 697609a3fa511b28ac102ab4ac4be092e14b7763..d1feec81e1f30b8e8a36e9813c1e4de881477e07 100644 (file)
@@ -671,7 +671,7 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) {
 %type  <StrVal>  OptVAR_ID OptAssign
 
 
-%token IMPLEMENTATION TRUE FALSE BEGINTOK END DECLARE GLOBAL CONSTANT UNINIT
+%token IMPLEMENTATION TRUE FALSE BEGINTOK ENDTOK DECLARE GLOBAL CONSTANT UNINIT
 %token TO EXCEPT DOTDOTDOT STRING NULL_TOK CONST INTERNAL OPAQUE
 
 // Basic Block Terminating Operators 
@@ -1205,13 +1205,17 @@ FunctionHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' {
   }
 }
 
-FunctionHeader : FunctionHeaderH ConstPool BEGINTOK {
+BEGIN : BEGINTOK | '{';                // Allow BEGIN or '{' to start a function
+
+FunctionHeader : FunctionHeaderH BEGIN {
   $$ = CurMeth.CurrentFunction;
 
   // Resolve circular types before we parse the body of the method.
   ResolveTypes(CurMeth.LateResolveTypes);
 }
 
+END : ENDTOK | '}';                    // Allow end of '}' to end a function
+
 Function : BasicBlockList END {
   $$ = $1;
 }