]> ocean-lang.org Git - ocean/blobdiff - csrc/indent_test.mdc
parsergen: allow $<1 to be used for structs as well as pointer.
[ocean] / csrc / indent_test.mdc
index 792e152523055781b282ac2d261fcae324f0fc79..540ecd22584868f832ac6b505b48b8088464ed0d 100644 (file)
@@ -6,7 +6,8 @@ with complete bracketing and indenting.
 # File: indent_test.mk
        myCFLAGS := -Wall -g -fplan9-extensions
        CFLAGS := $(filter-out $(myCFLAGS),$(CFLAGS)) $(myCFLAGS)
-       LDLIBS:= libparser.o libscanner.o libmdcode.o -licuuc
+       myLDLIBS:= libparser.o libscanner.o libmdcode.o -licuuc
+       LDLIBS := $(filter-out $(myLDLIBS),$(LDLIBS)) $(myLDLIBS)
 
        all :: itest
        itest.c itest.h : indent_test.mdc parsergen libparser.o libscanner.o libmdcode.o
@@ -15,7 +16,7 @@ with complete bracketing and indenting.
                ./md2c indent_test.mdc
        itest: itest.c
 
-       tests:: itest itest.code
+       demos:: itest itest.code
                ./itest itest.code
 
 # indent: header
@@ -122,7 +123,6 @@ with complete bracketing and indenting.
                exit(0);
        }
 
-
 # indent: grammar
 
 ~~~~~~
@@ -154,7 +154,7 @@ $*statement
                | NEWLINE }
        Block -> Open Statementlist Close ${ $0 = $<2; }$
                | Open SimpleStatements } ${ $0 = $<2; }$
-               | : Statementlist ${ $0 = $2; $2 = NULL; }$
+               | : Statementlist ${ $0 = $<2; }$
 
        SimpleStatements -> SimpleStatements ; SimpleStatement ${
                        {
@@ -224,7 +224,7 @@ $*expression
                                $0->left = $<1;
                                $0->right = $<3;
                        }$
-                   | Term ${ $0 = $1; $1 = NULL; }$
+                   | Term ${ $0 = $<1; }$
        Term -> Term * Factor ${
                                $0 = calloc(1, sizeof(struct expression));
                                $0->op = $2.txt;
@@ -237,7 +237,7 @@ $*expression
                                $0->left = $<1;
                                $0->right = $<3;
                        }$
-             | Factor ${ $0 = $1; $1 = NULL; }$
+             | Factor ${ $0 = $<1; }$
        Factor -> IDENTIFIER ${
                                $0 = calloc(1, sizeof(struct expression));
                                $0->op = $1.txt;