compiler/libec2: Fixes to build with latest code base
authorJerome St-Louis <jerome@ecere.com>
Thu, 3 Mar 2016 18:01:45 +0000 (13:01 -0500)
committerJerome St-Louis <jerome@ecere.com>
Mon, 21 Nov 2016 14:19:03 +0000 (09:19 -0500)
compiler/libec2/src/astNode.ec
compiler/libec2/src/classes.ec
compiler/libec2/src/declarators.ec
compiler/libec2/src/expressions.ec
compiler/libec2/src/externals.ec
compiler/libec2/src/lexing.ec
compiler/libec2/src/specifiers.ec
compiler/libec2/src/statements.ec
compiler/libec2/test.ec

index 798bfd4..312a395 100644 (file)
@@ -18,7 +18,7 @@ public class ASTList : ASTNode
    IteratorPointer GetNext(IteratorPointer pointer)       { return list ? list.GetNext(pointer) : 0; }
    bool SetData(IteratorPointer pointer, D data)          { return list ? list.SetData(pointer, (ASTNode)data) : 0; }
    D GetData(IteratorPointer pointer)                     { return list ? list.GetData(pointer) : (D)0; }
-   IteratorPointer GetAtPosition(I pos, bool create)      { return list ? list.GetAtPosition((int)pos, create) : 0; }
+   IteratorPointer GetAtPosition(I pos, bool create, bool * justAdded)      { return list ? list.GetAtPosition((int)pos, create, justAdded) : 0; }
    IteratorPointer Insert(Link after, T value)            { return list ? list.Insert(after, (void *)value) : 0; }
    IteratorPointer Add(T value)                           { return list ? list.Add((void *)value) : 0; }
    void Remove(IteratorPointer it)                        { if(list) list.Remove(it); }
index 8875bd9..8dcc1d1 100644 (file)
@@ -15,7 +15,7 @@ public:
    ASTMemberInit ::parse()
    {
       ASTMemberInit init { };
-      if(peekToken().type == IDENTIFIER)
+      if(peekToken().type == identifier)
       {
          int a = pushAmbiguity();
          while(true)
@@ -117,7 +117,7 @@ public:
       if(nextToken.type == '}')
          return null;
 
-      if(nextToken.type == IDENTIFIER)
+      if(nextToken.type == identifier)
          a = pushAmbiguity();
 
       specs = SpecsList::parse();
@@ -182,7 +182,7 @@ public:
    Class _class;
    //List attached;    // For IDE
    AccessMode declMode;
-   
+
    // COMPILING DATA
    Type type;
    Symbol propSet;
index a1d47ae..0b0586c 100644 (file)
@@ -40,7 +40,7 @@ public:
          decl = DeclPointer::parse();
       else
       {
-         if(peekToken().type == IDENTIFIER)
+         if(peekToken().type == identifier)
             decl = DeclIdentifier::parse();
          else if(nextToken.type == '(')
             decl = DeclBrackets::parse();
index 78bb36c..98c52c5 100644 (file)
@@ -3,23 +3,23 @@ import "astNode"
 import "specifiers"
 import "declarators"
 
-static TokenType opPrec[][4] =
+static TokenType2 opPrec[][4] =
 {
    { '*', '/', '%' },
    { '+', '-' },
-   { LEFT_OP, RIGHT_OP },
-   { '<', '>', LE_OP, GE_OP },
-   { EQ_OP, NE_OP },
+   { leftOp, rightOp },
+   { '<', '>', leOp, geOp },
+   { eqOp, neOp },
    { '&' },
    { '^' },
    { '|' },
-   { AND_OP },
-   { OR_OP }
+   { andOp },
+   { orOp }
 };
 
 static define numPrec = sizeof(opPrec) / sizeof(opPrec[0]);
 
-static bool isPrecedence(TokenType this, int l)
+static bool isPrecedence(TokenType2 this, int l)
 {
    // TO OPTIMIZE: return opPrec[this] == l
    if(this)
@@ -27,7 +27,7 @@ static bool isPrecedence(TokenType this, int l)
       int o;
       for(o = 0; o < sizeof(opPrec[0]) / sizeof(opPrec[0][0]); o++)
       {
-         TokenType op = opPrec[l][o];
+         TokenType2 op = opPrec[l][o];
          if(this == op)
             return true;
          else if(!op)
@@ -180,7 +180,7 @@ simple_primary_expression:
    | CLASS '(' declaration_specifiers abstract_declarator ')' { $$ = MkExpClass($3, $4); $$.loc = @$; }
    | CLASS '(' identifier ')' { $$ = MkExpClass(MkListOne(MkSpecifierName($3.string)), null); FreeIdentifier($3); $$.loc = @$; }
    | VAARG '(' assignment_expression ',' type_name ')' { $$ = MkExpVaArg($3, $5); $$.loc = @$; }
-   
+
    | CLASS_DATA '(' identifier ')' { $$ = MkExpClassData($3); $$.loc = @$; }
    | database_open
    | dbfield
@@ -190,9 +190,9 @@ simple_primary_expression:
    | '[' argument_expression_list ']' { $$ = MkExpArray($2); $$.loc = @$; }
    ;
 */
-   if(peekToken().type == CONSTANT)
+   if(peekToken().type == constant)
       return ExpConstant::parse();
-   else if(nextToken.type == IDENTIFIER)
+   else if(nextToken.type == identifier)
    {
       ExpIdentifier exp = ExpIdentifier::parse();
       if(peekToken().type == '{')
@@ -203,7 +203,7 @@ simple_primary_expression:
       }
       return exp;
    }
-   else if(nextToken.type == STRING_LITERAL)
+   else if(nextToken.type == stringLiteral)
       return ExpString::parse();
    else if(nextToken.type == '{')
       return ExpInstance::parse(null, null);
@@ -237,9 +237,9 @@ static ASTExpression parsePostfixExpression()
          exp = ExpCall::parse(exp);
       else if(nextToken.type == '.')
          exp = ExpMember::parse(exp);
-      else if(nextToken.type == PTR_OP)
+      else if(nextToken.type == ptrOp)
          exp = ExpPointer::parse(exp);
-      else if(nextToken.type == INC_OP || nextToken.type == DEC_OP)
+      else if(nextToken.type == incOp || nextToken.type == decOp)
       {
          readToken();
          exp = ExpOperation { exp1 = exp, op = token.type };
@@ -253,7 +253,7 @@ static ASTExpression parsePostfixExpression()
 static ASTExpression parseUnaryExpression()
 {
    peekToken();
-   if(nextToken.type == INC_OP || nextToken.type == DEC_OP)
+   if(nextToken.type == incOp || nextToken.type == decOp)
    {
       readToken();
       return ExpOperation { op = token.type, exp2 = parseUnaryExpression() };
@@ -325,7 +325,7 @@ public class ExpIdentifier : ASTExpression
 
 public class ExpOperation : ASTExpression
 {
-   TokenType op;
+   TokenType2 op;
    ASTExpression exp1, exp2;
 
    void print()
index 381de8d..9c3e950 100644 (file)
@@ -81,7 +81,7 @@ public:
    {
       // PrintLn("");
       printIndent();
-      if(specifiers) 
+      if(specifiers)
       {
          for(s : specifiers)
             s.print();
@@ -164,25 +164,25 @@ public class AST : ASTList<ASTNode>
 {
    ASTNode ::ParseExternalDeclaration()
    {
-      SpecsList specs = null; 
+      SpecsList specs = null;
       InitDeclList decls = null;
 
       peekToken();
-      if(nextToken.type == IMPORT)
+      if(nextToken.type == _import)
       {
          ASTImport astImport { };
          readToken();
          peekToken();
-         if(nextToken.type == STATIC)
+         if(nextToken.type == _static)
          {
             readToken();
          }
-         else if(nextToken.type == IDENTIFIER)
+         else if(nextToken.type == identifier)
          {
             readToken();
          }
          peekToken();
-         if(nextToken.type == STRING_LITERAL)
+         if(nextToken.type == stringLiteral)
          {
             readToken();
             astImport.importString = CopyString(token.text);
@@ -214,7 +214,7 @@ public:
    AST ::parse()
    {
       AST ast = null;
-      while(peekToken().type)
+      while(peekToken())
       {
          ASTNode n = ParseExternalDeclaration();
          if(n)
index b8c063e..b2d12d1 100644 (file)
@@ -1,17 +1,9 @@
 public import "ecere"
 public import "ec"
 
-public enum TokenType
+public enum TokenType2 : TokenType
 {
-   IDENTIFIER = 258, CONSTANT = 259, STRING_LITERAL = 260, SIZEOF = 261,PTR_OP = 262,INC_OP = 263,DEC_OP = 264, LEFT_OP = 265, RIGHT_OP = 266, LE_OP = 267, GE_OP = 268, EQ_OP = 269, NE_OP = 270,
-   AND_OP = 271, OR_OP = 272, MUL_ASSIGN = 273, DIV_ASSIGN = 274, MOD_ASSIGN = 275, ADD_ASSIGN = 276, SUB_ASSIGN = 277, LEFT_ASSIGN = 278, RIGHT_ASSIGN = 279, AND_ASSIGN = 280, XOR_ASSIGN = 281,
-   OR_ASSIGN = 282, TYPE_NAME = 283, TYPEDEF = 284, EXTERN = 285, STATIC = 286, AUTO = 287, REGISTER = 288, CHAR = 289, SHORT = 290, INT = 291, UINT = 292, INT64 = 293, LONG = 294, SIGNED = 295,
-   UNSIGNED = 296, FLOAT = 297, DOUBLE = 298, CONST = 299, VOLATILE = 300, VOID = 301, VALIST = 302, STRUCT = 303, UNION = 304, ENUM = 305, ELLIPSIS = 306, CASE = 307, DEFAULT = 308, IF = 309,
-   SWITCH = 310, WHILE = 311, DO = 312, FOR = 313, GOTO = 314, CONTINUE = 315, BREAK = 316, RETURN = 317, IFX = 318, ELSE = 319, CLASS = 320, THISCLASS = 321, CLASS_NAME = 322, PROPERTY = 323,
-   SETPROP = 324, GETPROP = 325, NEWOP = 326, RENEW = 327, DELETE = 328, EXT_DECL = 329, EXT_STORAGE = 330, IMPORT = 331, DEFINE = 332, VIRTUAL = 333, ATTRIB = 334, PUBLIC = 335, PRIVATE = 336,
-   TYPED_OBJECT = 337, ANY_OBJECT = 338, _INCREF = 339, EXTENSION = 340, ASM = 341, TYPEOF = 342, WATCH = 343, STOPWATCHING = 344, FIREWATCHERS = 345, WATCHABLE = 346, CLASS_DESIGNER = 347,
-   CLASS_NO_EXPANSION = 348, CLASS_FIXED = 349, ISPROPSET = 350, CLASS_DEFAULT_PROPERTY = 351, PROPERTY_CATEGORY = 352, CLASS_DATA = 353, CLASS_PROPERTY = 354, SUBCLASS = 355, NAMESPACE = 356,
-   NEW0OP = 357, RENEW0 = 358, VAARG = 359, DBTABLE = 360, DBFIELD = 361, DBINDEX = 362, DATABASE_OPEN = 363, ALIGNOF = 364, ATTRIB_DEP = 365, __ATTRIB = 366;
+   dummy;
 
    property char { }
 
@@ -19,11 +11,11 @@ public enum TokenType
    {
       get
       {
-         return isQualifier || this == CHAR || this == SHORT || this == INT || this == UINT || this == INT64 || this == LONG || this == SIGNED ||
-                this == UNSIGNED || this == FLOAT || this == DOUBLE || this == VOID ||
-                this == VALIST || this == THISCLASS || this == TYPED_OBJECT || this == ANY_OBJECT ||
-                this == TYPEDEF || this == STRUCT || this == CLASS || this == UNION || this == ENUM ||
-                this == TYPEOF || this == SUBCLASS;
+         return isQualifier || this == _char || this == _short || this == _int || this == _uint || this == _int64 || this == _long || this == _signed ||
+                this == _unsigned || this == _float || this == _double || this == _void ||
+                this == _valist || this == thisClass || this == typedObject || this == anyObject ||
+                this == _typedef || this == _struct || this == _class || this == _union || this == _enum ||
+                this == _typeof || this == subClass;
       }
    }
 
@@ -31,7 +23,7 @@ public enum TokenType
    {
       get
       {
-         return this == EXTERN || this == STATIC || this == AUTO || this == REGISTER || this == CONST || this == VOLATILE;
+         return this == _extern || this == _static || this == _auto || this == _register || this == _const || this == _volatile;
       }
    }
 
@@ -39,7 +31,7 @@ public enum TokenType
    {
       get
       {
-         return this == '&' || this == '*' || this == '+' || this == '-' || this == '~' || this == '!' || this == DELETE || this == _INCREF;
+         return this == '&' || this == '*' || this == '+' || this == '-' || this == '~' || this == '!' || this == _delete || this == _incref;
       }
    }
 
@@ -47,9 +39,9 @@ public enum TokenType
    {
       get
       {
-         return this == '='|| this == MUL_ASSIGN || this == DIV_ASSIGN || this == MOD_ASSIGN ||
-               this == ADD_ASSIGN || this == SUB_ASSIGN || this == LEFT_ASSIGN || this == RIGHT_ASSIGN ||
-               this == AND_ASSIGN || this == XOR_ASSIGN || this == OR_ASSIGN;
+         return this == '='|| this == mulAssign || this == divAssign || this == modAssign ||
+               this == addAssign || this == subAssign || this == leftAssign || this == rightAssign ||
+               this == andAssign || this == xorAssign || this == orAssign;
       }
    }
 
@@ -61,57 +53,57 @@ public enum TokenType
       {
          switch(this)
          {
-            case VOID: Print("void"); break;
-            case CHAR: Print("char"); break;
-            case SHORT: Print("short"); break;
-            case INT: Print("int"); break;
-            case LONG: Print("long"); break;
-            case INT64: Print("int64"); break;
-            case UNSIGNED: Print("unsigned"); break;
-            case SIGNED: Print("signed"); break;
-            case FLOAT: Print("float"); break;
-            case DOUBLE: Print("double"); break;
-            case TYPEDEF: Print("typedef"); break;
-            case EXTERN: Print("extern"); break;
-            case STATIC: Print("static"); break;
-            case AUTO: Print("auto"); break;
-            case REGISTER: Print("register"); break;
-            case UINT: Print("uint"); break;
-            case CONST: Print("const"); break;
-            case VOLATILE: Print("volatile"); break;
-            case VALIST: Print("va_list"); break;
-            case THISCLASS: Print("thisclass"); break;
-            case TYPED_OBJECT: Print("typed_Object"); break;
-            case ANY_OBJECT: Print("any_object"); break;
-            case STRUCT: Print("struct"); break;
-            case UNION: Print("union"); break;
-            case ENUM: Print("enum"); break;
-            case CLASS: Print("class"); break;
-
-            case TYPEOF: Print("typeof"); break;
-            case SUBCLASS: Print("subclass"); break;
-
-            case INC_OP: Print("++"); break;
-            case DEC_OP: Print("--"); break;
-            case SIZEOF: Print("sizeof "); break;
-            case LEFT_OP: Print("<<"); break;
-            case RIGHT_OP: Print(">>"); break;
-            case LE_OP: Print("<="); break;
-            case GE_OP: Print(">="); break;
-            case EQ_OP: Print("=="); break;
-            case NE_OP: Print("!="); break;
-            case AND_OP: Print("&&"); break;
-            case OR_OP: Print("||"); break;
-          case MUL_ASSIGN: Print("*="); break;
-          case DIV_ASSIGN: Print("/="); break;
-          case MOD_ASSIGN: Print("%="); break;
-          case ADD_ASSIGN: Print("+="); break;
-          case SUB_ASSIGN: Print("-="); break;
-          case LEFT_ASSIGN: Print("<<="); break;
-          case RIGHT_ASSIGN: Print(">>="); break;
-          case AND_ASSIGN: Print("&="); break;
-          case XOR_ASSIGN: Print("^="); break;
-          case OR_ASSIGN: Print("|="); break;
+            case _void: Print("void"); break;
+            case _char: Print("char"); break;
+            case _short: Print("short"); break;
+            case _int: Print("int"); break;
+            case _long: Print("long"); break;
+            case _int64: Print("int64"); break;
+            case _unsigned: Print("unsigned"); break;
+            case _signed: Print("signed"); break;
+            case _float: Print("float"); break;
+            case _double: Print("double"); break;
+            case _typedef: Print("typedef"); break;
+            case _extern: Print("extern"); break;
+            case _static: Print("static"); break;
+            case _auto: Print("auto"); break;
+            case _register: Print("register"); break;
+            case _uint: Print("uint"); break;
+            case _const: Print("const"); break;
+            case _volatile: Print("volatile"); break;
+            case _valist: Print("va_list"); break;
+            case thisClass: Print("thisclass"); break;
+            case typedObject: Print("typed_Object"); break;
+            case anyObject: Print("any_object"); break;
+            case _struct: Print("struct"); break;
+            case _union: Print("union"); break;
+            case _enum: Print("enum"); break;
+            case _class: Print("class"); break;
+
+            case _typeof: Print("typeof"); break;
+            case subClass: Print("subclass"); break;
+
+            case incOp: Print("++"); break;
+            case decOp: Print("--"); break;
+            case sizeOf: Print("sizeof "); break;
+            case leftOp: Print("<<"); break;
+            case rightOp: Print(">>"); break;
+            case leOp: Print("<="); break;
+            case geOp: Print(">="); break;
+            case eqOp: Print("=="); break;
+            case neOp: Print("!="); break;
+            case andOp: Print("&&"); break;
+            case orOp: Print("||"); break;
+          case mulAssign: Print("*="); break;
+          case divAssign: Print("/="); break;
+          case modAssign: Print("%="); break;
+          case addAssign: Print("+="); break;
+          case subAssign: Print("-="); break;
+          case leftAssign: Print("<<="); break;
+          case rightAssign: Print(">>="); break;
+          case andAssign: Print("&="); break;
+          case xorAssign: Print("^="); break;
+          case orAssign: Print("|="); break;
          }
       }
    }
@@ -119,7 +111,7 @@ public enum TokenType
 
 class Token
 {
-   TokenType type;
+   TokenType2 type;
    String text;
    ~Token()
    {
@@ -157,14 +149,16 @@ Token peekToken()
       }
       else
       {
-         nextToken = { _refCount = 1 };
-         nextToken.type = (TokenType)LexEc();
-         nextToken.text = CopyString(GetYYText());
-         if(ambiguous)
+         TokenType2 type = (TokenType2)LexEc();
+         if(type)
          {
-            stackPos++;
-            tokenStack.Add(nextToken);
-            incref nextToken;
+            nextToken = { _refCount = 1, type = type, text = CopyString(GetYYText()) };
+            if(ambiguous)
+            {
+               stackPos++;
+               tokenStack.Add(nextToken);
+               incref nextToken;
+            }
          }
       }
    }
index f9087b9..6ca81e3 100644 (file)
@@ -35,7 +35,7 @@ public class SpecsList : ASTList<ASTSpecifier>
       while(true)
       {
          peekToken();
-         if(nextToken.type == STRUCT || nextToken.type == UNION || nextToken.type == CLASS || nextToken.type == ENUM)
+         if(nextToken.type == _struct || nextToken.type == _union || nextToken.type == _class || nextToken.type == _enum)
          {
             ASTSpecifier s = SpecClass::parse();
             if(s)
@@ -53,7 +53,7 @@ public class SpecsList : ASTList<ASTSpecifier>
             if(!token.type.isQualifier)
                gotSpec = true;
          }
-         else if(nextToken.type == IDENTIFIER)
+         else if(nextToken.type == identifier)
          {
             bool isType = false;
             if(isType || !gotSpec)
@@ -75,7 +75,7 @@ public class SpecsList : ASTList<ASTSpecifier>
 
 public class SpecBase : ASTSpecifier
 {
-   TokenType specifier;
+   TokenType2 specifier;
 
    void print()
    {
@@ -98,7 +98,7 @@ public class SpecName : ASTSpecifier
 
 public class SpecClass : ASTSpecifier
 {
-   TokenType type;
+   TokenType2 type;
    ASTIdentifier id;
    SpecsList baseSpecs;
    ClassDefList definitions;
@@ -116,9 +116,9 @@ public class SpecClass : ASTSpecifier
 
    SpecClass ::parse()
    {
-      SpecClass spec = (peekToken().type == ENUM) ? SpecEnum { } : SpecClass { };
+      SpecClass spec = (peekToken().type == _enum) ? SpecEnum { } : SpecClass { };
       spec.type = readToken().type;
-      if(peekToken().type == IDENTIFIER)
+      if(peekToken().type == identifier)
          spec.id = ASTIdentifier::parse();
       if(peekToken().type == ':')
       {
@@ -185,7 +185,7 @@ public class ASTAttribute : ASTNode
 
 public class ASTAttrib : ASTNode
 {
-   TokenType type;
+   TokenType2 type;
    List<ASTAttribute> attribs;
 }
 
index 93d19f2..2d0ecb5 100644 (file)
@@ -29,13 +29,13 @@ public class ASTStmtOrDecl : ASTNode
       bool isType = false;
 
       peekToken();
-      if(nextToken.type.isSpecifier || (nextToken.type == IDENTIFIER && isType))
+      if(nextToken.type.isSpecifier || (nextToken.type == identifier && isType))
       {
          specs = SpecsList::parse();
          decls = InitDeclList::parse();
          return ASTDeclaration::parse(specs, decls);
       }
-      else if(nextToken.type == IDENTIFIER)
+      else if(nextToken.type == identifier)
       {
          ASTStatement stmt;
          int a = pushAmbiguity();
@@ -68,20 +68,20 @@ public:
    {
       switch(peekToken().type)
       {
-         case ';':      readToken(); return { };
-         case '{':      return StmtCompound::parse();
-         case IF:       return StmtIf::parse();
-         case SWITCH:   return StmtSwitch::parse();
-         case DEFAULT:
-         case CASE:     return StmtCase::parse();
-         case WHILE:    return StmtWhile::parse();
-         case DO:       return StmtDoWhile::parse();
-         case FOR:      return StmtFor::parse();
-         case BREAK:    return StmtBreak::parse();
-         case GOTO:     return StmtGoto::parse();
-         case RETURN:   return StmtReturn::parse();
-         case CONTINUE: return StmtContinue::parse();
-         case IDENTIFIER:
+         case ';':       readToken(); return { };
+         case '{':       return StmtCompound::parse();
+         case _if:       return StmtIf::parse();
+         case _switch:   return StmtSwitch::parse();
+         case _default:
+         case _case:     return StmtCase::parse();
+         case _while:    return StmtWhile::parse();
+         case _do:       return StmtDoWhile::parse();
+         case _for:      return StmtFor::parse();
+         case _break:    return StmtBreak::parse();
+         case _goto:     return StmtGoto::parse();
+         case _return:   return StmtReturn::parse();
+         case _continue: return StmtContinue::parse();
+         case identifier:
          {
             ASTStatement stmt;
             int a = pushAmbiguity();
@@ -173,7 +173,7 @@ public class StmtCompound : ASTStatement
             if(s._class != class(StmtLabeled) && s._class != class(StmtCompound))
                printIndent();
             s.print();
-            if(s._class == class(StmtExpression)) 
+            if(s._class == class(StmtExpression))
                PrintLn("");
          }
       }
@@ -252,7 +252,7 @@ public class StmtIf : ASTStatement
          if(stmt._class != class(StmtCompound)) indent++;
          printIndent();
          stmt.print();
-         if(stmt._class == class(StmtExpression)) PrintLn(""); 
+         if(stmt._class == class(StmtExpression)) PrintLn("");
          if(stmt._class != class(StmtCompound)) indent--;
       }
       if(elseStmt)
@@ -262,7 +262,7 @@ public class StmtIf : ASTStatement
          if(elseStmt._class != class(StmtCompound)) { PrintLn(""); indent++; }
          printIndent();
          if(elseStmt._class != class(StmtCompound)) elseStmt.print();
-         if(elseStmt._class == class(StmtExpression)) PrintLn(""); 
+         if(elseStmt._class == class(StmtExpression)) PrintLn("");
          indent--;
       }
    }
@@ -277,7 +277,7 @@ public class StmtIf : ASTStatement
          stmt.exp = ExpList::parse();
          if(peekToken().type == ')') readToken();
          stmt.stmt = ASTStatement::parse();
-         if(peekToken().type == ELSE)
+         if(peekToken().type == _else)
          {
             readToken();
             stmt.elseStmt = ASTStatement::parse();
@@ -366,14 +366,14 @@ public class StmtCase : ASTStatement
          if(stmt._class != class(StmtCompound)) indent++;
          printIndent();
          stmt.print();
-         if(stmt._class == class(StmtExpression)) PrintLn(""); 
+         if(stmt._class == class(StmtExpression)) PrintLn("");
       }
    }
 
    StmtCase ::parse()
    {
       StmtCase stmt { };
-      if(readToken().type == CASE)
+      if(readToken().type == _case)
          stmt.exp = ExpConditional::parse();
       if(peekToken().type == ':')
       {
@@ -414,7 +414,7 @@ public class StmtDoWhile : ASTStatement
       StmtDoWhile stmt { };
       readToken();
       stmt.stmt = ASTStatement::parse();
-      if(peekToken().type == WHILE)
+      if(peekToken().type == _while)
       {
          readToken();
          if(peekToken().type == '(')
@@ -452,13 +452,13 @@ public class StmtFor : ASTStatement
          increment.print();
       }
       PrintLn(")");
-      
+
       if(stmt)
       {
          if(stmt._class != class(StmtCompound)) indent++;
          printIndent();
          stmt.print();
-         if(stmt._class == class(StmtExpression)) PrintLn(""); 
+         if(stmt._class == class(StmtExpression)) PrintLn("");
          if(stmt._class != class(StmtCompound)) indent--;
       }
    }
index 3fa074a..4093bb2 100644 (file)
@@ -101,7 +101,7 @@ again:
 
    for(c = 0; c < 10; c++)
       PrintLn(c);
-   
+
    if(a) if(b) s; else s2;
 
    if(a == 4)