]> ocean-lang.org Git - ocean/commitdiff
oceani: convert declarations to new approach to newlines
authorNeilBrown <neil@brown.name>
Sun, 16 Jun 2019 02:16:44 +0000 (12:16 +1000)
committerNeilBrown <neil@brown.name>
Sun, 16 Jun 2019 02:16:44 +0000 (12:16 +1000)
There are now no conflicts.  Yay!!

Signed-off-by: NeilBrown <neil@brown.name>
csrc/oceani-tests.mdc
csrc/oceani.mdc

index 5366bf92ddf60e1045c5b0ed3a9bc6bee6cc560f..8a5e74708e9385f77fbec661823233a824dd246a 100644 (file)
@@ -793,7 +793,7 @@ various places that `type_err()` are called.
 
 ###### output: type_err_const1
        .tmp.code:3:12: Syntax error in constant: :
-       .tmp.code:4:8: Syntax error in constant: bar
+       .tmp.code:4:12: Syntax error in constant: :
 
 ## Test erroneous command line args
 
index 4f00438c08bf3d844377e89da5cd2f8d4ef79696..d3a4caf519c4f62a38a2b59123ebab5b52556487 100644 (file)
@@ -2019,6 +2019,7 @@ function will be needed.
                                f = f->prev;
                        }
                } }$
+               | DeclareStruct NEWLINE
 
        $void
        Open -> {
@@ -2026,16 +2027,19 @@ function will be needed.
        Close -> }
                | NEWLINE Close
        $*fieldlist
-       FieldBlock -> Open FieldList Close ${ $0 = $<2; }$
+       FieldBlock -> Open FieldList } ${ $0 = $<2; }$
                | Open SimpleFieldList } ${ $0 = $<2; }$
-               | : FieldList  ${ $0 = $<2; }$
+               | : FieldList $$NEWLINE ${ $0 = $<2; }$
 
-       FieldList -> SimpleFieldList NEWLINE ${ $0 = $<1; }$
-               | FieldList SimpleFieldList NEWLINE ${
+       FieldList -> SimpleFieldListLine ${ $0 = $<1; }$
+               | FieldList SimpleFieldListLine ${
                        $2->prev = $<1;
                        $0 = $<2;
                }$
 
+       SimpleFieldListLine -> SimpleFieldList NEWLINE ${ $0 = $<1; }$
+               | SimpleFieldListLine NEWLINE ${ $0 = $<1; }$
+
        SimpleFieldList -> Field ${ $0 = $<1; }$
                | SimpleFieldList ; Field ${
                        $3->prev = $<1;
@@ -3932,14 +3936,15 @@ various declarations in the parse context.
 
        $void
        Ocean -> DeclarationList
+               | NEWLINE Ocean
 
        DeclarationList -> Declaration
                | DeclarationList Declaration
 
-       Declaration -> DeclareConstant
+       Declaration -> Declaration NEWLINE
+               | DeclareConstant
                | DeclareProgram
                | DeclareStruct
-               | NEWLINE
                | ERROR NEWLINE ${
                        tok_err(c,
                                "error: unhandled parse error", &$1);
@@ -3974,17 +3979,19 @@ searching through for the Nth constant for decreasing N.
 
        DeclareConstant -> const Open ConstList Close
                | const Open SimpleConstList }
-               | const : ConstList
+               | const : ConstList $$NEWLINE
                | const SimpleConstList NEWLINE
 
-       ConstList -> ComplexConsts
+       ConstList -> ConstLines
                | NEWLINE ConstList
-       ComplexConsts -> ComplexConst ComplexConsts
-               | ComplexConst
-       ComplexConst -> SimpleConstList NEWLINE
+       ConstLines -> ConstLines SimpleConstLine
+               | SimpleConstLine
        SimpleConstList -> SimpleConstList ; Const
                | Const
                | SimpleConstList ;
+       SimpleConstLine -> SimpleConstList NEWLINE
+               | SimpleConstLine NEWLINE
+               | ERROR NEWLINE ${ tok_err(c, "Syntax error in constant", &$1); }$
 
        $*type
        CType -> Type   ${ $0 = $<1; }$
@@ -4017,7 +4024,6 @@ searching through for the Nth constant for decreasing N.
                        v->val = interp_exec($5);
                }
        } }$
-       | ERROR NEWLINE ${ tok_err(c, "Syntax error in constant", &$1); }$
 
 ###### print const decls
        {