compiler/libec2: Indentation, empty statements fixes
authorJerome St-Louis <jerome@ecere.com>
Mon, 8 Jul 2013 07:57:26 +0000 (03:57 -0400)
committerJerome St-Louis <jerome@ecere.com>
Mon, 21 Nov 2016 14:19:02 +0000 (09:19 -0500)
compiler/libec2/src/declarators.ec
compiler/libec2/src/specifiers.ec
compiler/libec2/src/statements.ec

index 66a3284..29a69fd 100644 (file)
@@ -86,6 +86,7 @@ public class TypeNameList : ASTList<ASTTypeName>
          }
          else
          {
+            // Error Recovery
             if(list)
                list.Add({});
             popAmbiguity(a);
index 1ba0f38..f9087b9 100644 (file)
@@ -149,10 +149,13 @@ public class SpecClass : ASTSpecifier
       }
       if(definitions)
       {
-         PrintLn("\n{");
+         PrintLn("");
+         printIndent();
+         PrintLn("{");
          indent++;
          definitions.print();
          indent--;
+         printIndent();
          Print("}");
       }
    }
index f330202..93d19f2 100644 (file)
@@ -96,6 +96,11 @@ public:
          default:       return StmtExpression::parse();
       }
    }
+
+   void print()
+   {
+      PrintLn(";");
+   }
 };
 
 public class StmtExpression : ASTStatement
@@ -165,7 +170,7 @@ public class StmtCompound : ASTStatement
          {
             if(s._class == class(StmtCase))
                indent = caseIndent;
-            if(s._class != class(StmtLabeled))
+            if(s._class != class(StmtLabeled) && s._class != class(StmtCompound))
                printIndent();
             s.print();
             if(s._class == class(StmtExpression))