From: kpouer Date: Sat, 9 Aug 2003 22:16:17 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://secure.phpeclipse.com *** empty log message *** --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayDeclarator.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayDeclarator.java index e6c9163..92fcd24 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayDeclarator.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayDeclarator.java @@ -14,7 +14,7 @@ public class ArrayDeclarator extends AbstractVariable { public ArrayDeclarator(final AbstractVariable prefix, final Expression vars, final int sourceEnd) { - super(prefix.getSourceStart(), sourceEnd); + super(prefix.sourceStart, sourceEnd); this.prefix = prefix; this.var = vars; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java index 9e62673..4322f61 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java @@ -22,7 +22,7 @@ public class ArrayVariableDeclaration extends Expression { * @param value the value */ public ArrayVariableDeclaration(final Expression key, final Expression value) { - super(key.getSourceStart(), value.getSourceEnd()); + super(key.sourceStart, value.sourceEnd); this.key = key; this.value = value; } @@ -33,7 +33,7 @@ public class ArrayVariableDeclaration extends Expression { * @param sourceEnd the end position */ public ArrayVariableDeclaration(final Expression key, final int sourceEnd) { - super(key.getSourceStart(), sourceEnd); + super(key.sourceStart, sourceEnd); this.key = key; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AstNode.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AstNode.java index 2f0fe2d..237ce92 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AstNode.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AstNode.java @@ -9,7 +9,7 @@ import java.util.List; public abstract class AstNode { /** Starting and ending position of the node in the sources. */ - private int sourceStart, sourceEnd; + public int sourceStart, sourceEnd; /** * Create a node giving starting and ending offset @@ -17,8 +17,8 @@ public abstract class AstNode { * @param sourceEnd ending offset */ public AstNode(final int sourceStart, final int sourceEnd) { - this.setSourceStart(sourceStart); - this.setSourceEnd(sourceEnd); + this.sourceStart = sourceStart; + this.sourceEnd = sourceEnd; } /** @@ -67,20 +67,4 @@ public abstract class AstNode { * @return the variables used */ public abstract List getUsedVariable(); - - public int getSourceStart() { - return sourceStart; - } - - public int getSourceEnd() { - return sourceEnd; - } - - public void setSourceStart(int sourceStart) { - this.sourceStart = sourceStart; - } - - public void setSourceEnd(int sourceEnd) { - this.sourceEnd = sourceEnd; - } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java index 1699c5e..3455363 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/BinaryExpression.java @@ -14,7 +14,7 @@ public class BinaryExpression extends OperatorExpression { public BinaryExpression(final Expression left, final Expression right, final int operator) { - super(operator, left.getSourceStart(), right.getSourceEnd()); + super(operator, left.sourceStart, right.sourceEnd); this.left = left; this.right = right; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassAccess.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassAccess.java index 0fe5fec..384d192 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassAccess.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassAccess.java @@ -32,7 +32,7 @@ public class ClassAccess extends AbstractVariable { public ClassAccess(final Expression prefix, final Expression suffix, final int type) { - super(prefix.getSourceStart(), suffix.getSourceEnd()); + super(prefix.sourceStart, suffix.sourceEnd); this.prefix = prefix; this.suffix = suffix; this.type = type; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConditionalExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConditionalExpression.java index deaa787..121a158 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConditionalExpression.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConditionalExpression.java @@ -14,7 +14,7 @@ public class ConditionalExpression extends OperatorExpression { public ConditionalExpression(final Expression condition, final Expression valueIfTrue, final Expression valueIfFalse) { - super(-1, condition.getSourceStart(), valueIfFalse.getSourceEnd()); + super(-1, condition.sourceStart, valueIfFalse.sourceEnd); this.condition = condition; this.valueIfTrue = valueIfTrue; this.valueIfFalse = valueIfFalse; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConstantIdentifier.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConstantIdentifier.java index a157522..bd1f4a1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConstantIdentifier.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ConstantIdentifier.java @@ -1,5 +1,7 @@ package net.sourceforge.phpdt.internal.compiler.ast; +import test.Token; + import java.util.List; import java.util.ArrayList; @@ -8,21 +10,26 @@ import java.util.ArrayList; */ public class ConstantIdentifier extends Expression { - public char[] name; + public String name; - public ConstantIdentifier(final char[] name, + public ConstantIdentifier(final String name, final int sourceStart, final int sourceEnd) { super(sourceStart, sourceEnd); this.name = name; } + public ConstantIdentifier(final Token token) { + super(token.sourceStart,token.sourceEnd); + name = token.image; + } + /** * Return the expression as String. * @return the expression */ public String toStringExpression() { - return new String(name); + return name; } /** @@ -30,7 +37,7 @@ public class ConstantIdentifier extends Expression { * @return the variables from outside */ public List getOutsideVariable() { - return new ArrayList(); + return new ArrayList(1); } /** @@ -38,7 +45,7 @@ public class ConstantIdentifier extends Expression { * @return the variables from we change value */ public List getModifiedVariable() { - return new ArrayList(); + return new ArrayList(1); } /** @@ -46,6 +53,6 @@ public class ConstantIdentifier extends Expression { * @return the variables used */ public List getUsedVariable() { - return new ArrayList(); + return new ArrayList(1); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Define.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Define.java index f3d0692..68f96df 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Define.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Define.java @@ -68,7 +68,7 @@ public class Define extends Statement implements Outlineable { */ public List getOutsideVariable() { final ArrayList list = new ArrayList(1); - list.add(new VariableUsage(defineName.toStringExpression(),getSourceStart()));//todo: someday : evaluate the defineName + list.add(new VariableUsage(defineName.toStringExpression(),sourceStart));//todo: someday : evaluate the defineName return list; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EchoStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EchoStatement.java index 6623bcf..c5f3e98 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EchoStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EchoStatement.java @@ -14,7 +14,7 @@ public class EchoStatement extends Statement { public Expression[] expressions; public EchoStatement (final Expression[] expressions, final int sourceStart) { - super(sourceStart, expressions[expressions.length-1].getSourceEnd()); + super(sourceStart, expressions[expressions.length-1].sourceEnd); this.expressions = expressions; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FalseLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FalseLiteral.java index af7dd86..98349e4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FalseLiteral.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FalseLiteral.java @@ -1,5 +1,7 @@ package net.sourceforge.phpdt.internal.compiler.ast; +import test.Token; + import java.util.List; import java.util.ArrayList; @@ -8,10 +10,8 @@ import java.util.ArrayList; */ public class FalseLiteral extends MagicLiteral { - public static final char[] source = {'f', 'a', 'l', 's', 'e'}; - - public FalseLiteral(final int sourceStart, final int sourceEnd) { - super(sourceStart, sourceEnd); + public FalseLiteral(final Token token) { + super(token.sourceStart, token.sourceEnd); } /** @@ -22,10 +22,6 @@ public class FalseLiteral extends MagicLiteral { return "false";//$NON-NLS-1$ } - public char[] source() { - return source; - } - public String toString() { return "false";//$NON-NLS-1$ } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FunctionCall.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FunctionCall.java index 333e918..19fcbee 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FunctionCall.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FunctionCall.java @@ -18,7 +18,7 @@ public class FunctionCall extends AbstractSuffixExpression { public FunctionCall(final Expression prefix, final Expression[] args, final int sourceEnd) { - super(prefix.getSourceStart(), sourceEnd); + super(prefix.sourceStart, sourceEnd); this.prefix = prefix; this.args = args; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/HTMLBlock.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/HTMLBlock.java index 3bb2523..27d93fa 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/HTMLBlock.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/HTMLBlock.java @@ -11,7 +11,7 @@ public class HTMLBlock extends Statement { public AstNode[] nodes; public HTMLBlock(final AstNode[] nodes) { - super(nodes[0].getSourceStart(), nodes[nodes.length-1].getSourceEnd()); + super(nodes[0].sourceStart, nodes[nodes.length-1].sourceEnd); this.nodes = nodes; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InclusionStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InclusionStatement.java index a5abc65..ddb2cb2 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InclusionStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InclusionStatement.java @@ -30,11 +30,11 @@ public class InclusionStatement extends Statement implements Outlineable { final int keyword, final Expression expression, final int sourceStart) { - super(sourceStart, expression.getSourceEnd()); + super(sourceStart, expression.sourceEnd); this.keyword = keyword; this.expression = expression; this.parent = parent; - position = new Position(sourceStart, getSourceEnd()); + position = new Position(sourceStart, sourceEnd); } public String keywordToString() { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java index 769dc4b..9b40ee2 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java @@ -55,7 +55,7 @@ public class ListExpression extends Expression { * @return the variables from outside */ public List getOutsideVariable() { - return new ArrayList(); + return new ArrayList(1); } /** @@ -65,7 +65,7 @@ public class ListExpression extends Expression { public List getModifiedVariable() { final ArrayList list = new ArrayList(); for (int i = 0; i < vars.length; i++) { - list.addAll(vars[i].getModifiedVariable()); + list.addAll(vars[i].getUsedVariable()); } if (expression != null) { list.addAll(expression.getModifiedVariable()); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Literal.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Literal.java index 9ab2ad8..ae58b8a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Literal.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Literal.java @@ -18,14 +18,12 @@ public abstract class Literal extends Expression { super(sourceStart, sourceEnd); } - public abstract char[] source(); - /** * Get the variables from outside (parameters, globals ...) * @return an empty list */ public List getOutsideVariable() { - return new ArrayList(); + return new ArrayList(1); } /** @@ -33,7 +31,7 @@ public abstract class Literal extends Expression { * @return an empty list */ public List getModifiedVariable() { - return new ArrayList(); + return new ArrayList(1); } /** @@ -41,6 +39,6 @@ public abstract class Literal extends Expression { * @return an empty list */ public List getUsedVariable() { - return new ArrayList(); + return new ArrayList(1); } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java index 615fc04..663735a 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java @@ -160,7 +160,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild if (arguments != null) { final Enumeration vars = arguments.keys(); while (vars.hasMoreElements()) { - list.add(new VariableUsage((String) vars.nextElement(), getSourceStart())); + list.add(new VariableUsage((String) vars.nextElement(), sourceStart)); } } @@ -254,6 +254,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild VariableUsage variableUsage = (VariableUsage) usedVars.get(i); if (!isVariableDeclaredBefore(declaredVars, variableUsage)) { try { + PHPeclipsePlugin.log(1,variableUsage.getName()+" "+variableUsage.getStartOffset()); PHPParserSuperclass.setMarker("warning, usage of an unknown variable : " + variableUsage.getName(), variableUsage.getStartOffset(), variableUsage.getStartOffset() + variableUsage.getName().length(), diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NullLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NullLiteral.java index 52958ff..44c41b7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NullLiteral.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NullLiteral.java @@ -1,14 +1,14 @@ package net.sourceforge.phpdt.internal.compiler.ast; +import test.Token; + /** * @author Matthieu Casanova */ public class NullLiteral extends MagicLiteral { - public static final char[] source = {'n' , 'u' , 'l' , 'l'}; - - public NullLiteral(final int sourceStart, final int sourceEnd) { - super(sourceStart, sourceEnd); + public NullLiteral(final Token token) { + super(token.sourceStart, token.sourceEnd); } /** @@ -18,8 +18,4 @@ public class NullLiteral extends MagicLiteral { public String toStringExpression() { return "null"; } - - public char[] source() { - return source; - } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NumberLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NumberLiteral.java index 57bab53..774b553 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NumberLiteral.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/NumberLiteral.java @@ -1,21 +1,17 @@ package net.sourceforge.phpdt.internal.compiler.ast; +import test.Token; + /** - * Literal for numbers + * Literal for numbers. * @author Matthieu Casanova */ public class NumberLiteral extends Literal { - public char[] source; + public String source; - public NumberLiteral(final char[] token, - final int sourceStart, - final int sourceEnd) { - super(sourceStart, sourceEnd); - source = token; - } - - public char[] source() { - return source; + public NumberLiteral(final Token token) { + super(token.sourceStart, token.sourceEnd); + source = token.image; } /** @@ -23,6 +19,6 @@ public class NumberLiteral extends Literal { * @return the expression */ public String toStringExpression() { - return new String(source); + return source; } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixedUnaryExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixedUnaryExpression.java index 1e91ebd..a358e25 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixedUnaryExpression.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixedUnaryExpression.java @@ -6,7 +6,7 @@ package net.sourceforge.phpdt.internal.compiler.ast; public class PostfixedUnaryExpression extends UnaryExpression { public PostfixedUnaryExpression(final Expression expression, final int operator, final int sourceEnd) { - super(expression, operator, expression.getSourceStart(), sourceEnd); + super(expression, operator, expression.sourceStart, sourceEnd); } public String toStringExpression() { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PrefixedUnaryExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PrefixedUnaryExpression.java index 42920c4..4c74cc4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PrefixedUnaryExpression.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PrefixedUnaryExpression.java @@ -5,8 +5,10 @@ package net.sourceforge.phpdt.internal.compiler.ast; */ public class PrefixedUnaryExpression extends UnaryExpression { - public PrefixedUnaryExpression(final Expression expression, final int operator, final int sourceStart) { - super(expression, operator, sourceStart, expression.getSourceEnd()); + public PrefixedUnaryExpression(final Expression expression, + final int operator, + final int sourceStart) { + super(expression, operator, sourceStart, expression.sourceEnd); } public String toStringExpression() { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java index 436c102..5a515aa 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java @@ -10,21 +10,14 @@ ******************************************************************************/ package net.sourceforge.phpdt.internal.compiler.ast; -import java.util.List; -import java.util.ArrayList; - -//import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor; -//import net.sourceforge.phpdt.internal.compiler.codegen.CodeStream; -//import net.sourceforge.phpdt.internal.compiler.impl.Constant; -//import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope; -//import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding; +import test.Token; public class StringLiteral extends Literal { - char[] source; + String source; - public StringLiteral(final char[] token, final int s) { - super(s, s + token.length); - source = token; + public StringLiteral(Token token) { + super(token.sourceStart,token.sourceEnd); + source = token.image; } /** @@ -34,82 +27,44 @@ public class StringLiteral extends Literal { * @param e sourceend * @deprecated */ - public StringLiteral(final char[] token, final int s, final int e) { + public StringLiteral(final String token, final int s, final int e) { super(s, e); source = token; } - public StringLiteral(final int s, final int e) { - super(s, e); - } - /** - * source method comment. + * Create a new StringLiteral + * @param token the token + * @param s sourcestart + * @param e sourceend + * @deprecated */ - public char[] source() { - return source; + public StringLiteral(final char[] token, final int s, final int e) { + this(new String(token),s, e); } - /** - * Return the expression as String. - * @return the expression - */ - /* public String toStringExpression() { - // handle some special char..... - StringBuffer result = new StringBuffer("\""); //$NON-NLS-1$ - for (int i = 0; i < source.length; i++) { - switch (source[i]) { - case '\b': - result.append("\\b"); //$NON-NLS-1$ - break; - case '\t': - result.append("\\t"); //$NON-NLS-1$ - break; - case '\n': - result.append("\\n"); //$NON-NLS-1$ - break; - case '\f': - result.append("\\f"); //$NON-NLS-1$ - break; - case '\r': - result.append("\\r"); //$NON-NLS-1$ - break; - case '\"': - result.append("\\\""); //$NON-NLS-1$ - break; - case '\'': - result.append("\\'"); //$NON-NLS-1$ - break; - case '\\': //take care not to display the escape as a potential real char - result.append("\\\\"); //$NON-NLS-1$ - break; - default : - result.append(source[i]); - } - } - result.append("\""); //$NON-NLS-1$ - return result.toString(); - } */ - + public StringLiteral(final int s, final int e) { + super(s, e); + } /** * Return the expression as String. * @return the expression */ public String toStringExpression() { - return new String(source); + return source; } /** * @deprecated - use field instead */ public int sourceEnd() { - return getSourceEnd(); + return sourceEnd; } /** * @deprecated - use field instead */ public int sourceStart() { - return getSourceStart(); + return sourceStart; } } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TrueLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TrueLiteral.java index efc37a7..1509737 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TrueLiteral.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/TrueLiteral.java @@ -1,5 +1,7 @@ package net.sourceforge.phpdt.internal.compiler.ast; +import test.Token; + import java.util.List; import java.util.ArrayList; @@ -9,14 +11,8 @@ import java.util.ArrayList; */ public class TrueLiteral extends MagicLiteral { - public static final char[] source = {'t', 'r', 'u', 'e'}; - - public TrueLiteral(final int sourceStart, final int sourceEnd) { - super(sourceStart, sourceEnd); - } - - public char[] source() { - return source; + public TrueLiteral(Token token) { + super(token.sourceStart, token.sourceEnd); } /** diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Variable.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Variable.java index 69163ca..443de28 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Variable.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/Variable.java @@ -78,9 +78,9 @@ public class Variable extends AbstractVariable { public List getUsedVariable() { final ArrayList list = new ArrayList(1); if (name == null) { - list.add(new VariableUsage(variable.getName(), getSourceStart())); + list.add(new VariableUsage(variable.getName(), sourceStart)); } else { - list.add(new VariableUsage(name, getSourceStart())); + list.add(new VariableUsage(name, sourceStart)); } return list; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java index 5d3f8b9..6b9facd 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java @@ -51,12 +51,12 @@ public class VariableDeclaration extends Expression implements Outlineable { final Expression initialization, final int operator, final int sourceStart) { - super(sourceStart, initialization.getSourceEnd()); + super(sourceStart, initialization.sourceEnd); this.initialization = initialization; this.variable = variable; this.operator = operator; this.parent = parent; - position = new Position(sourceStart, getSourceEnd()); + position = new Position(sourceStart, sourceEnd); } /** @@ -87,7 +87,7 @@ public class VariableDeclaration extends Expression implements Outlineable { final Expression initialization, final int operator, final int sourceStart) { - super(sourceStart, initialization.getSourceEnd()); + super(sourceStart, initialization.sourceEnd); this.variable = variable; this.initialization = initialization; this.operator = operator; @@ -100,7 +100,7 @@ public class VariableDeclaration extends Expression implements Outlineable { */ public VariableDeclaration(final AbstractVariable variable, final int sourceStart) { - super(sourceStart, variable.getSourceEnd()); + super(sourceStart, variable.sourceEnd); this.variable = variable; }