]> ocean-lang.org Git - ocean/blobdiff - csrc/indent_test.mdc
parsergen: remove line_like information.
[ocean] / csrc / indent_test.mdc
index fddb64b7520a15931b430075406c2853f056fef3..463428b7579b1cf32d29ecafdeb43d42a832146d 100644 (file)
@@ -10,7 +10,7 @@ with complete bracketing and indenting.
        all :: itest
        itest.c itest.h : indent_test.mdc parsergen
                ./parsergen -o itest --LALR --tag indent indent_test.mdc
-       indent_test.mk: indent_test.mdc md2c
+       indent_test.mk itest.code: indent_test.mdc md2c
                ./md2c indent_test.mdc
        itest: itest.c | $(filter %.o,$(itestLDLIBS))
                $(CC) $(itestCFLAGS) $^ $(itestLDLIBS) -o $@
@@ -19,19 +19,15 @@ with complete bracketing and indenting.
                ./itest itest.code
        checkitest: itest itest.code
                @grep -v '^#' itest.out > .tmp.out
-               @./itest itest.code | diff -u - .tmp.out || echo itest FAILED
+               @./itest itest.code | diff -u .tmp.out - || echo itest FAILED
                @sed -e 'i\
                ' itest.code > itest2.code
-               @./itest itest2.code| diff -u - .tmp.out || echo itest2 FAILED
+               @./itest itest2.code| diff -u .tmp.out - || echo itest2 FAILED
        demos :: doitest
        tests :: checkitest
 
 # indent: header
 
- ./parsergen -o itest --LALR indent_test.cgm
- cc -o itest itest.c lib*.o -licuuc -lgmp
- ./itest itest.code
-
        struct expression {
                struct text op;
                struct expression *left, *right;
@@ -163,7 +159,7 @@ $*statement
                | Open SimpleStatements } ${ $0 = $<S; }$
                | : SimpleStatements ${ $0 = $<SS; }$
                | : StatementBlock ${ $0 = $<SB; }$
-       StatementBlock -> Statementlist $$OUT ${ $0 = $<Sl; }$
+       StatementBlock -> Statementlist ${ $0 = $<Sl; }$
 
        SimpleStatements -> SimpleStatements ; SimpleStatement ${
                        {
@@ -187,7 +183,7 @@ $*statement
                        }$
        SSline -> SimpleStatements NEWLINE ${ $0 = $<1; }$
        Statement -> SSline ${ $0 = $<1; }$
-               | IfStatement $$NEWLINE ${ $0 = $<1; }$
+               | IfStatement ${ $0 = $<1; }$
                | Statement NEWLINE ${ $0 = $<1; }$
 
        $RIGHT else
@@ -264,6 +260,21 @@ $*expression
         else if cond2:
                there1 =x
                there1a=x
+       if cond + cond2 :
+               hello = x;
+               hello2 = x;
+
+               sum = val +
+                val;
+
+               if condX:
+                foo = x *
+                    x +
+                    y
+                    / two;
+       else if cond2:
+               there1 =x
+               there1a=x
        there2=x
        there3=x;
        all = y;
@@ -280,6 +291,8 @@ $*expression
        if a:
                if b:
                        c= d
+               else:
+                       f=g
        x = y
 
 # File: itest.out
@@ -287,6 +300,16 @@ $*expression
        (mister=no);
        (there=x);
        (all=y);
+       if (cond+cond2):
+           (hello=x);
+           (hello2=x);
+           (sum=(val+val));
+           if condX:
+               (foo=((x*x)+(y/two)));
+       else:
+           if cond2:
+               (there1=x);
+               (there1a=x);
        if (cond+cond2):
            (hello=x);
            (hello2=x);
@@ -318,4 +341,6 @@ $*expression
        if a:
            if b:
                (c=d);
+           else:
+               (f=g);
        (x=y);