improved PHP parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / ASTNode.java
index 264a0ca..2d7dd88 100644 (file)
@@ -10,7 +10,7 @@
  *******************************************************************************/
 package net.sourceforge.phpeclipse.internal.compiler.ast;
 
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
 import net.sourceforge.phpdt.internal.compiler.impl.Constant;
 import net.sourceforge.phpdt.internal.compiler.lookup.ArrayBinding;
 import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypes;
@@ -94,7 +94,8 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
 
        // for type declaration
        public static final int AddAssertionMASK = Bit1;
-
+       public static final int IsMemberTypeMASK = Bit11; // local member do not know it is local at parse time (need to look at binding)
+       
        // for type, method and field declarations 
        public static final int HasLocalTypeMASK = Bit2; // cannot conflict with AddAssertionMASK
 
@@ -107,6 +108,22 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
        
        // for references on lhs of assignment (set only for true assignments, as opposed to compound ones)
        public static final int IsStrictlyAssignedMASK = Bit14;
+       public static final int IsCompoundAssignedMASK = Bit17; // set only for compound assignments, as opposed to other ones
+
+       // for empty statement
+       public static final int IsUsefulEmptyStatementMASK = Bit1;
+
+       // for block and method declaration
+       public static final int UndocumentedEmptyBlockMASK = Bit4;
+
+       // for compilation unit
+       public static final int HasAllMethodBodies = Bit5;
+       
+       // for references in Javadoc comments
+       public static final int InsideJavadoc = Bit16;
+       
+       // for if statement
+       public static final int IsElseIfStatement = Bit30;
        
        public ASTNode() {
 
@@ -229,6 +246,38 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
                return s;
        }
 
+       public abstract StringBuffer print(int indent, StringBuffer output);
+
+       public static StringBuffer printIndent(int indent, StringBuffer output) {
+
+               for (int i = indent; i > 0; i--) output.append("  "); //$NON-NLS-1$
+               return output;
+       }
+
+       public static StringBuffer printModifiers(int modifiers, StringBuffer output) {
+
+               if ((modifiers & AccPublic) != 0)
+                       output.append("public "); //$NON-NLS-1$
+               if ((modifiers & AccPrivate) != 0)
+                       output.append("private "); //$NON-NLS-1$
+               if ((modifiers & AccProtected) != 0)
+                       output.append("protected "); //$NON-NLS-1$
+               if ((modifiers & AccStatic) != 0)
+                       output.append("static "); //$NON-NLS-1$
+               if ((modifiers & AccFinal) != 0)
+                       output.append("final "); //$NON-NLS-1$
+//             if ((modifiers & AccSynchronized) != 0)
+//                     output.append("synchronized "); //$NON-NLS-1$
+//             if ((modifiers & AccVolatile) != 0)
+//                     output.append("volatile "); //$NON-NLS-1$
+//             if ((modifiers & AccTransient) != 0)
+//                     output.append("transient "); //$NON-NLS-1$
+//             if ((modifiers & AccNative) != 0)
+//                     output.append("native "); //$NON-NLS-1$
+               if ((modifiers & AccAbstract) != 0)
+                       output.append("abstract "); //$NON-NLS-1$
+               return output;
+       }
        /** 
         * @deprecated - use field instead
        */
@@ -261,6 +310,6 @@ public abstract class ASTNode implements BaseTypes, CompilerModifiers, TypeConst
                return "****" + super.toString() + "****";  //$NON-NLS-2$ //$NON-NLS-1$
        }
        
-       public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+       public void traverse(ASTVisitor visitor, BlockScope scope) {
        }
 }