]> ocean-lang.org Git - ocean/blobdiff - csrc/oceani.mdc
oceani: convert declarations to new approach to newlines
[ocean] / csrc / oceani.mdc
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
        {