*** empty log message ***
authorkpouer <kpouer>
Thu, 12 Jun 2003 22:35:32 +0000 (22:35 +0000)
committerkpouer <kpouer>
Thu, 12 Jun 2003 22:35:32 +0000 (22:35 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java
net.sourceforge.phpeclipse/src/test/PHPParser.java
net.sourceforge.phpeclipse/src/test/PHPParser.jj

index 7050649..ce9fd59 100644 (file)
@@ -1,8 +1,5 @@
 package net.sourceforge.phpdt.internal.compiler.ast;
 
-import net.sourceforge.phpdt.internal.compiler.ast.AstNode;
-
-
 /**
  * A Block is
  * {
@@ -33,31 +30,13 @@ public class Block extends Statement {
   public String toString(int tab) {
     final String s = AstNode.tabString(tab);
     final StringBuffer buff = new StringBuffer(s);
-    if (this.statements == null) {
-      buff.append("{\n"); //$NON-NLS-1$
-      buff.append(s);
-      buff.append("}"); //$NON-NLS-1$
-      return s;
-    }
     buff.append("{\n"); //$NON-NLS-1$
-    buff.append(this.toStringStatements(tab));
-    buff.append(s);
-    buff.append("}"); //$NON-NLS-1$
-    return s;
-  }
-
-  public String toStringStatements(int tab) {
-    if (this.statements == null)
-      return ""; //$NON-NLS-1$
-    StringBuffer buffer = new StringBuffer();
-    for (int i = 0; i < statements.length; i++) {
-      buffer.append(statements[i].toString(tab + 1));
-      if (statements[i] instanceof Block) {
-        buffer.append("\n"); //$NON-NLS-1$
-      } else {
-        buffer.append(";\n"); //$NON-NLS-1$
+    if (this.statements == null) {
+      for (int i = 0; i < statements.length; i++) {
+          buff.append(statements[i].toString(tab+1)).append(";\n");//$NON-NLS-1$
       }
     }
-    return buffer.toString();
+    buff.append("}\n"); //$NON-NLS-1$
+    return buff.toString();
   }
 }
index f847463..aebef7b 100644 (file)
@@ -1,6 +1,11 @@
 package net.sourceforge.phpdt.internal.compiler.ast;
 
 /**
+ * This is a if statement.
+ * if (condition)
+ *  statement
+ * (elseif statement)*
+ * else statement
  * @author Matthieu Casanova
  */
 public class IfStatement extends Statement {
index b5b0024..f0ea36f 100644 (file)
@@ -3983,10 +3983,10 @@ final ArrayList list = new ArrayList();
       stmts.toArray(statementsArray);
       {if (true) return new IfStatement(condition,
                              new Block(statementsArray,pos,endStatements),
-                              elseIfs,
-                              elseStatement,
-                              pos,
-                              SimpleCharStream.getPosition());}
+                             elseIfs,
+                             elseStatement,
+                             pos,
+                             SimpleCharStream.getPosition());}
     }
       break;
     case PHPEND:
index cb90b27..28764a7 100644 (file)
@@ -2510,10 +2510,10 @@ IfStatement IfStatement0(Expression condition, final int start,final int end) :
       stmts.toArray(statementsArray);
       return new IfStatement(condition,
                              new Block(statementsArray,pos,endStatements),
-                              elseIfs,
-                              elseStatement,
-                              pos,
-                              SimpleCharStream.getPosition());
+                             elseIfs,
+                             elseStatement,
+                             pos,
+                             SimpleCharStream.getPosition());
     }
     }