X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=blobdiff_plain;f=csrc%2Findent_test.mdc;h=7e4f95627a57096a6c1982a960330916a9171145;hp=88e93914aa6f88a7b49638e230c3d99e372019eb;hb=35d743c48140ea96fa56c3f63ee8dd0e032cbb2d;hpb=ca00beb39b9d02578c1f0b556a2c2f70f28cf6e7 diff --git a/csrc/indent_test.mdc b/csrc/indent_test.mdc index 88e9391..7e4f956 100644 --- a/csrc/indent_test.mdc +++ b/csrc/indent_test.mdc @@ -160,7 +160,7 @@ $*statement | NEWLINE Close Block -> Open Statementlist Close ${ $0 = $<2; }$ | Open SimpleStatements } ${ $0 = $<2; }$ - | : SimpleStatements $$NEWLINE ${ $0 = $<2; }$ + | : SimpleStatements ${ $0 = $<2; }$ | : StatementBlock ${ $0 = $<2; }$ StatementBlock -> Statementlist $$OUT ${ $0 = $<1; }$ @@ -185,9 +185,9 @@ $*statement $0->expr->right = $<3; }$ SSline -> SimpleStatements NEWLINE ${ $0 = $<1; }$ - | SSline NEWLINE ${ $0 = $<1; }$ Statement -> SSline ${ $0 = $<1; }$ - | IfStatement ${ $0 = $<1; }$ + | IfStatement $$NEWLINE ${ $0 = $<1; }$ + | Statement NEWLINE ${ $0 = $<1; }$ $RIGHT else @@ -197,20 +197,16 @@ $*statement $0->thenpart = $<3; }$ | IfHead NEWLINE ${ $0 = $<1; }$ - IfTail -> else Block ${ $0 = $<2; }$ - | IfTail NEWLINE ${ $0 = $<1; }$ IfStatement -> IfHead $$else ${ $0 = $<1; }$ - | IfHead IfTail ${ + | IfHead else Block ${ $0 = $<1; - $0->elsepart = $<2; + $0->elsepart = $<3; }$ | IfHead else IfStatement ${ $0 = $<1; $0->elsepart = $<3; }$ - | IfStatement NEWLINE ${ $0 = $<1; }$ - $*expression Expression -> Expression + Term ${ @@ -272,6 +268,7 @@ $*expression all = y; if true {yes=x;} else : no=x if true: yes = no; no = yes; + if false: yes=ok; else: no=ok if false { print = OK @@ -309,6 +306,10 @@ $*expression if true: (yes=no); (no=yes); + if false: + (yes=ok); + else: + (no=ok); if false: (print=OK); else: