From 161cdbbdc82c4cce12d1fe7a135809b6bbee999d Mon Sep 17 00:00:00 2001 From: kpouer Date: Thu, 12 Jun 2003 22:35:32 +0000 Subject: [PATCH 1/1] *** empty log message *** --- .../phpdt/internal/compiler/ast/Block.java | 31 +++---------------- .../phpdt/internal/compiler/ast/IfStatement.java | 5 +++ net.sourceforge.phpeclipse/src/test/PHPParser.java | 8 ++-- net.sourceforge.phpeclipse/src/test/PHPParser.jj | 8 ++-- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java index 7050649..ce9fd59 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Block.java @@ -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(); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java index f847463..aebef7b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java @@ -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 { diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index b5b0024..f0ea36f 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -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: diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.jj b/net.sourceforge.phpeclipse/src/test/PHPParser.jj index cb90b27..28764a7 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -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()); } } -- 1.7.1