aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-05-02 19:11:13 +0000
committerChris Lattner <sabre@nondot.org>2002-05-02 19:11:13 +0000
commit0e73ce6d94886f8fa64a5007e52ad11ec891d3ea (patch)
tree68f71dbb96a0aa5a6579fe1535d3c3d52355c2dc
parent872265ee1be8f5525935b0cc712acf53d3ba5fe0 (diff)
The "implementation" is now allowed but not required by the parser. All type
definitions must still occur before function bodies, but the wierd keyword is no longer neccesary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2433 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AsmParser/llvmAsmParser.y62
1 files changed, 32 insertions, 30 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 1dcc25cf5e..020a83df49 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -998,6 +998,38 @@ ConstVector : ConstVector ',' ConstVal {
GlobalType : GLOBAL { $$ = false; } | CONSTANT { $$ = true; }
+//===----------------------------------------------------------------------===//
+// Rules to match Modules
+//===----------------------------------------------------------------------===//
+
+// Module rule: Capture the result of parsing the whole file into a result
+// variable...
+//
+Module : FunctionList {
+ $$ = ParserResult = $1;
+ CurModule.ModuleDone();
+}
+
+// FunctionList - A list of methods, preceeded by a constant pool.
+//
+FunctionList : FunctionList Function {
+ $$ = $1;
+ assert($2->getParent() == 0 && "Function already in module!");
+ $1->getFunctionList().push_back($2);
+ CurMeth.FunctionDone();
+ }
+ | FunctionList FunctionProto {
+ $$ = $1;
+ }
+ | FunctionList IMPLEMENTATION {
+ $$ = $1;
+ }
+ | ConstPool {
+ $$ = CurModule.CurrentModule;
+ // Resolve circular types before we parse the body of the module
+ ResolveTypes(CurModule.LateResolveTypes);
+ }
+
// ConstPool - Constants with optional names assigned to them.
ConstPool : ConstPool OptAssign CONST ConstVal {
if (setValueName($4, $2)) { assert(0 && "No redefinitions allowed!"); }
@@ -1071,36 +1103,6 @@ ConstPool : ConstPool OptAssign CONST ConstVal {
//===----------------------------------------------------------------------===//
-// Rules to match Modules
-//===----------------------------------------------------------------------===//
-
-// Module rule: Capture the result of parsing the whole file into a result
-// variable...
-//
-Module : FunctionList {
- $$ = ParserResult = $1;
- CurModule.ModuleDone();
-}
-
-// FunctionList - A list of methods, preceeded by a constant pool.
-//
-FunctionList : FunctionList Function {
- $$ = $1;
- assert($2->getParent() == 0 && "Function already in module!");
- $1->getFunctionList().push_back($2);
- CurMeth.FunctionDone();
- }
- | FunctionList FunctionProto {
- $$ = $1;
- }
- | ConstPool IMPLEMENTATION {
- $$ = CurModule.CurrentModule;
- // Resolve circular types before we parse the body of the module
- ResolveTypes(CurModule.LateResolveTypes);
- }
-
-
-//===----------------------------------------------------------------------===//
// Rules to match Function Headers
//===----------------------------------------------------------------------===//