X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=blobdiff_plain;f=csrc%2Foceani.mdc;h=d3a4caf519c4f62a38a2b59123ebab5b52556487;hp=4f00438c08bf3d844377e89da5cd2f8d4ef79696;hb=712fec2bb9a25d6f196e2d3565f51234e9f8cfd0;hpb=f393f23988d53a2ae8a12043b3981ce8030c4f1e diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index 4f00438..d3a4caf 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -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 {