./md2c indent_test.mdc
itest: itest.c
- demos:: itest itest.code
+ doitest: itest itest.code
./itest itest.code
+ checkitest: itest itest.code
+ @grep -v '^#' itest.out > .tmp.out
+ @./itest itest.code | diff -u - .tmp.out || echo itest FAILED
+ demos :: doitest
+ tests :: checkitest
# indent: header
| IfStatement ${ $0 = $<1; }$
| Statement NEWLINE ${ $0 = $<1; }$
- IfStatement -> if Expression Block OptNL ${
+ $RIGHT else
+
+ IfStatement -> if Expression Block OptNL $$else ${
$0 = calloc(1, sizeof(struct statement));
$0->expr = $<2;
$0->thenpart = $<3;
}$
- | if Expression : SimpleStatements ${
+ | if Expression : SimpleStatements $$else ${
$0 = calloc(1, sizeof(struct statement));
$0->expr = $<2;
$0->thenpart = $<4;
c= d
x = y
+# File: itest.out
+ (hello=yes);
+ (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);
+ (there2=x);
+ (there3=x);
+ (all=y);
+ if true:
+ (yes=x);
+ else:
+ (no=x);
+ if true:
+ (yes=no);
+ (no=yes);
+ if false:
+ (print=OK);
+ else:
+ (print=not_OK);
+ if a:
+ if b:
+ (c=d);
+ (x=y);