+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * Superclass of case statement that we can find in a switch.
- * @author Matthieu Casanova
- */
-public abstract class AbstractCase extends Statement {
-
- /** The statements in the case. */
- public final Statement[] statements;
-
- /**
- * Create a case statement.
- * @param statements the statements array
- * @param sourceStart the beginning source offset
- * @param sourceEnd the ending offset
- */
- protected AbstractCase(final Statement[] statements,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.statements = statements;
- }
-
-
- /**
- * Get the variables from outside (parameters, globals ...).
- * @param list the list where we will put variables
- */
- public final void getOutsideVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getOutsideVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * Here are php comment.
- * @author Matthieu Casanova
- */
-public abstract class AbstractPHPComment extends AstNode {
-
- /**
- * Create a comment giving starting and ending offset.
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- protected AbstractPHPComment(final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- * @param list the list where we will put variables
- */
- public final void getOutsideVariable(final List list) {
- }
-
- /**
- * get the modified variables.
- * @param list the list where we will put variables
- */
- public final void getModifiedVariable(final List list) {
- }
-
- /**
- * Get the variables used.
- * @param list the list where we will put variables
- */
- public final void getUsedVariable(final List list) {
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * Variable suffix.
- * class access or [something]
- * Should it be an expression ?
- * @author Matthieu Casanova
- */
-public abstract class AbstractSuffixExpression extends Expression {
-
- protected AbstractSuffixExpression(final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * The variable superclass.
- * @author Matthieu Casanova
- */
-public abstract class AbstractVariable extends Expression {
- protected AbstractVariable(final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-
- /**
- * This method will return the name of the variable.
- * @return a string containing the name of the variable.
- */
- public abstract String getName();
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-
-/**
- * An argument declaration.
- *
- * @author Matthieu Casanova
- */
-public final class ArgumentDeclaration extends VariableDeclaration {
-
- /**
- * Create an argument.
- *
- * @param name the name
- * @param reference the variable is a reference ?
- * @param initialization the initialization
- * @param sourceStart the start point
- */
- public ArgumentDeclaration(final Variable name,
- final boolean reference,
- final Expression initialization,
- final int sourceStart) {
- super(name, initialization, VariableDeclaration.EQUAL, sourceStart);
- this.reference = reference;
- }
-
- /**
- * Create an argument.
- *
- * @param name the name
- * @param reference the variable is a reference ?
- * @param sourceStart the start point
- */
- public ArgumentDeclaration(final Variable name,
- final boolean reference,
- final int sourceStart) {
- super(name, sourceStart);
- this.reference = reference;
- }
-
- /**
- * Return the expression as String.
- *
- * @return the expression
- */
- public String toStringExpression() {
- if (initialization == null) {
- if (reference) {
- return '&' + variable.toStringExpression();
- } else {
- return variable.toStringExpression();
- }
- } else {
- final String variableString = variable.toStringExpression();
- final String initializationString = initialization.toStringExpression();
- final StringBuffer buff = new StringBuffer(4 +
- variableString.length() +
- initializationString.length());
- if (reference) {
- buff.append('&');
- }
- buff.append(variableString);
- buff.append(" = ");
- buff.append(initializationString);
- return buff.toString();
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * An access to a key of an array.
- * @author Matthieu Casanova
- */
-public final class ArrayDeclarator extends AbstractVariable {
-
- /** The name of the array. */
- private final AbstractVariable prefix;
-
- /** The key. */
- private final Expression key;
-
- /**
- * Create an ArrayDeclarator.
- * @param prefix the prefix, it could be a variable.
- * @param key the key
- * @param sourceEnd the end of the expression
- */
- public ArrayDeclarator(final AbstractVariable prefix,
- final Expression key,
- final int sourceEnd) {
- super(prefix.sourceStart, sourceEnd);
- this.prefix = prefix;
- this.key = key;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final StringBuffer buff = new StringBuffer(prefix.toStringExpression());
- buff.append('[');
- if (key != null) {
- buff.append(key.toStringExpression());
- }
- buff.append(']');
- return buff.toString();
- }
-
- /**
- * Return the name of the variable.
- * @return the name of the functionName variable
- */
- public String getName() {
- return prefix.getName();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- prefix.getModifiedVariable(list);
- if (key != null) {
- key.getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- prefix.getUsedVariable(list);
- if (key != null) {
- key.getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * an array initializer.
- * array('a','b','c') or array('a' => 2,'b' = '3');
- * @author Matthieu Casanova
- */
-public final class ArrayInitializer extends Expression {
-
- /** the key and values. */
- private final ArrayVariableDeclaration[] vars;
-
- /**
- * Create a new array initializer.
- * @param vars the keys and values of the array
- * @param sourceStart the starting offset
- * @param sourceEnd the ending offset
- */
- public ArrayInitializer(final ArrayVariableDeclaration[] vars,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.vars = vars;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final StringBuffer buff = new StringBuffer("array(");
- for (int i = 0; i < vars.length; i++) {
- if (i != 0) {
- buff.append(",");
- }
- if (vars[i] != null) {
- buff.append(vars[i].toStringExpression());
- }
- }
- buff.append(")");
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- for (int i = 0; i < vars.length; i++) {
- if (vars[i] != null) {
- vars[i].getModifiedVariable(list);
- }
- }
- }
-
- /**
- * Get the variables used.
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- for (int i = 0; i < vars.length; i++) {
- if (vars[i] != null) {
- vars[i].getUsedVariable(list);
- }
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * a variable declaration in an array().
- * it could take Expression as key.
- *
- * @author Matthieu Casanova
- */
-public final class ArrayVariableDeclaration extends Expression {
-
- /** the array key. */
- private final Expression key;
-
- /** the array value. */
- private Expression value;
-
- /**
- * Create a new array variable declaration.
- *
- * @param key the key
- * @param value the value
- */
- public ArrayVariableDeclaration(final Expression key, final Expression value) {
- super(key.sourceStart, value.sourceEnd);
- this.key = key;
- this.value = value;
- }
-
- /**
- * Create a new array variable declaration.
- *
- * @param key the key
- * @param sourceEnd the end position
- */
- public ArrayVariableDeclaration(final Expression key, final int sourceEnd) {
- super(key.sourceStart, sourceEnd);
- this.key = key;
- }
-
- /**
- * Return the expression as String.
- *
- * @return the expression
- */
- public String toStringExpression() {
- if (value == null) {
- return key.toStringExpression();
- } else {
- final String keyString = key.toStringExpression();
- final String valueString = value.toStringExpression();
- final StringBuffer buff = new StringBuffer(keyString.length() + valueString.length() + 3);
- buff.append(keyString);
- buff.append(" => ");
- buff.append(valueString);
- return buff.toString();
- }
- }
-
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- key.getModifiedVariable(list);
- if (value != null) {
- value.getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- key.getUsedVariable(list);
- if (value != null) {
- value.getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * It will be the mother of our own ast tree for php just like the ast tree of Eclipse.
- * @author Matthieu Casanova
- */
-public abstract class AstNode {
-
- /** Starting and ending position of the node in the sources. */
- public int sourceStart, sourceEnd;
-
- protected AstNode() {
- super();
- }
- /**
- * Create a node giving starting and ending offset.
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- protected AstNode(final int sourceStart, final int sourceEnd) {
- this.sourceStart = sourceStart;
- this.sourceEnd = sourceEnd;
- }
-
- /**
- * Add some tabulations.
- * @param tab the number of tabulations
- * @return a String containing some spaces
- */
- public static String tabString(final int tab) {
- final StringBuffer s = new StringBuffer(2 * tab);
- for (int i = tab; i > 0; i--) {
- s.append(" "); //$NON-NLS-1$
- }
- return s.toString();
- }
-
- /**
- * Return the object into String.
- * It should be overriden
- * @return a String
- */
- public String toString() {
- return "****" + super.toString() + "****"; //$NON-NLS-2$ //$NON-NLS-1$
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public abstract String toString(int tab);
-
- /**
- * Get the variables from outside (parameters, globals ...)
- * @param list the list where we will put variables
- */
- public abstract void getOutsideVariable(List list);
-
- /**
- * get the modified variables.
- * @param list the list where we will put variables
- */
- public abstract void getModifiedVariable(List list);
-
- /**
- * Get the variables used.
- * @param list the list where we will put variables
- */
- public abstract void getUsedVariable(List list);
-
- /**
- * This method will analyze the code.
- * by default it will do nothing
- */
- public void analyzeCode() {}
-
- /**
- * Check if the array array contains the object o.
- * @param array an array
- * @param o an obejct
- * @return true if the array contained the object o
- */
- public final boolean arrayContains(final Object[] array, final Object o) {
- for (int i = 0; i < array.length; i++) {
- if (array[i].equals(o)) {
- return true;
- }
- }
- return false;
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * a binary expression is a combination of two expressions with an operator.
- *
- * @author Matthieu Casanova
- */
-public final class BinaryExpression extends OperatorExpression {
-
- /** The left expression. */
- private final Expression left;
- /** The right expression. */
- private final Expression right;
-
- /**
- * Create a binary expression.
- *
- * @param left the left expression
- * @param right the right expression
- * @param operator an operator taken in the {@link OperatorExpression} interface
- */
- public BinaryExpression(final Expression left,
- final Expression right,
- final int operator) {
- super(operator, left.sourceStart, right.sourceEnd);
- this.left = left;
- this.right = right;
- }
-
- public String toStringExpression() {
- final String leftString = left.toStringExpression();
- final String operatorString = operatorToString();
- final String rightString = right.toStringExpression();
- final StringBuffer buff = new StringBuffer(leftString.length() + operatorString.length() + rightString.length());
- buff.append(leftString);
- buff.append(operatorString);
- buff.append(rightString);
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- left.getModifiedVariable(list);
- right.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- left.getUsedVariable(list);
- right.getUsedVariable(list);
- }
-
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A Block.
- * {
- * statements
- * }.
- * @author Matthieu Casanova
- */
-public final class Block extends Statement {
-
- /** An array of statements inside the block. */
- public final Statement[] statements;
-
- /**
- * Create a block.
- * @param statements the statements
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- public Block(final Statement[] statements,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.statements = statements;
- }
-
- /**
- * tell if the block is empty.
- * @return the block is empty if there are no statements in it
- */
- public boolean isEmptyBlock() {
- return statements == null;
- }
-
- /**
- * Return the block as String.
- * @param tab how many tabs
- * @return the string representation of the block
- */
- public String toString(final int tab) {
- final String s = AstNode.tabString(tab);
- final StringBuffer buff = new StringBuffer(s);
- buff.append("{\n"); //$NON-NLS-1$
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- buff.append(statements[i].toString(tab + 1)).append(";\n");//$NON-NLS-1$
- }
- }
- buff.append("}\n"); //$NON-NLS-1$
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getOutsideVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * Here is a branchstatement : break or continue.
- * @author Matthieu Casanova
- */
-public abstract class BranchStatement extends Statement {
-
- /** The label (if there is one). */
- protected final Expression expression;
-
- protected BranchStatement(final Expression expression, final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.expression = expression;
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public final void getOutsideVariable(final List list) {
- if (expression != null) {
- expression.getOutsideVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public final void getModifiedVariable(final List list) {
- if (expression != null) {
- expression.getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public final void getUsedVariable(final List list) {
- if (expression != null) {
- expression.getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * A break statement.
- * @author Matthieu Casanova
- */
-public final class Break extends BranchStatement {
-
- public Break(final Expression expression, final int sourceStart, final int sourceEnd) {
- super(expression, sourceStart, sourceEnd);
- }
-
- public String toString(final int tab) {
- final String s = tabString(tab);
- if (expression != null) {
- return s + "break " + expression.toString();//$NON-NLS-1$
- }
- return s + "break";//$NON-NLS-1$
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A Case statement for a Switch.
- * @author Matthieu Casanova
- */
-public final class Case extends AbstractCase {
-
- private final Expression value;
-
- public Case(final Expression value,
- final Statement[] statements,
- final int sourceStart,
- final int sourceEnd) {
- super(statements, sourceStart, sourceEnd);
- this.value = value;
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("case ");
- buff.append(value.toStringExpression());
- buff.append(" :\n");
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- final Statement statement = statements[i];
- buff.append(statement.toString(tab + 1));
- }
- }
- return buff.toString();
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- super.getModifiedVariable(list);
- value.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- super.getUsedVariable(list);
- value.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * This is a cast expression.
- * @author Matthieu Casanova
- */
-public final class CastExpression extends Expression {
-
- /** The type in which we cast the expression. */
- private final ConstantIdentifier type;
-
- /** The expression to be casted. */
- private final Expression expression;
-
- /**
- * Create a cast expression.
- * @param type the type
- * @param expression the expression
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- public CastExpression(final ConstantIdentifier type,
- final Expression expression,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.type = type;
- this.expression = expression;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final StringBuffer buff = new StringBuffer("(");
- buff.append(type.toStringExpression());
- buff.append(") ");
- buff.append(expression.toStringExpression());
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- expression.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- expression.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * Any class access.
- * @author Matthieu Casanova
- */
-public final class ClassAccess extends AbstractVariable {
-
- /** a static class access : "::". */
- public static final int STATIC = 0;
-
- /** a normal class access : "->". */
- public static final int NORMAL = 1;
-
- private final Expression prefix;
-
- /** the suffix. */
- private final Expression suffix;
-
- /** the type of access. */
- private final int type;
-
- /**
- * Create a new class access.
- * @param prefix
- * @param suffix
- * @param type the type of access {@link #STATIC} or {@link #NORMAL}
- */
- public ClassAccess(final Expression prefix,
- final Expression suffix,
- final int type) {
- super(prefix.sourceStart, suffix.sourceEnd);
- this.prefix = prefix;
- this.suffix = suffix;
- this.type = type;
- }
-
- private String toStringOperator() {
- switch (type) {
- case STATIC : return "::"; //$NON-NLS-1$
- case NORMAL : return "->"; //$NON-NLS-1$
- }
- return "unknown operator"; //$NON-NLS-1$
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final String prefixString = prefix.toStringExpression();
- final String operatorString = toStringOperator();
- final String suffixString = suffix.toStringExpression();
- final StringBuffer buff = new StringBuffer(prefixString.length() +
- operatorString.length() +
- suffixString.length());
- buff.append(prefixString);
- buff.append(operatorString);
- buff.append(suffixString);
- return buff.toString();
- }
-
- /**
- * todo: find a better way to handle this
- * @return the name of the variable
- */
- public String getName() {
- if (prefix instanceof AbstractVariable) {
- return ((AbstractVariable)prefix).getName();
- }
- return prefix.toStringExpression();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- prefix.getUsedVariable(list);
- suffix.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.Position;
-
-
-/**
- * This class is my ClassDeclaration declaration for php.
- * It is similar to org.eclipse.jdt.internal.compiler.ast.TypeDeclaration
- * It directly extends AstNode because a class cannot appear anywhere in php
- * @author Matthieu Casanova
- */
-public final class ClassDeclaration extends Statement implements OutlineableWithChildren {
-
- /** The name of the class. */
- private final String name;
- /** The superclass. */
- private String superclass;
-
- public int declarationSourceStart;
- public int declarationSourceEnd;
- public int bodyStart;
- public int bodyEnd;
- /** The methods of the class. */
- private final ArrayList methods = new ArrayList();
- /** The constructor of the class. */
- private MethodDeclaration constructor;
- /** The fields of the class. */
- private final ArrayList fields = new ArrayList();
-
- private final Object parent;
- /** The outlineable children (those will be in the node array too. */
- private final ArrayList children = new ArrayList();
-
- private final Position position;
-
- /**
- * Create a class giving starting and ending offset.
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- public ClassDeclaration(final Object parent,
- final String name,
- final String superclass,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.parent = parent;
- this.name = name;
- this.superclass = superclass;
- position = new Position(sourceStart, name.length());
- }
-
- /**
- * Create a class giving starting and ending offset.
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- public ClassDeclaration(final Object parent,
- final String name,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.parent = parent;
- this.name = name;
- position = new Position(sourceStart, name.length());
- }
-
- /**
- * Add a method to the class.
- * @param method the method declaration
- */
- public void addMethod(final MethodDeclaration method) {
- methods.add(method);
- add(method);
- if (method.name.equals(name)) {
- constructor = method;
- }
- }
-
- public void addField(final FieldDeclaration var) {
- for (int i = 0; i < var.vars.length; i++) {
- final VariableDeclaration c = var.vars[i];
- children.add(c);
- }
- fields.add(var);
- }
-
- public boolean add(final Outlineable o) {
- return children.add(o);
- }
-
- /**
- * Tell if the class has a constructor.
- * @return a boolean
- */
- public boolean hasConstructor() {
- return constructor != null;
- }
-
- /**
- * Return the class as String.
- * @param tab how many tabs before the class
- * @return the code of this class into String
- */
- public String toString(final int tab) {
- return tabString(tab) + toStringHeader() + toStringBody(tab);
- }
-
- /**
- * Return the body of the class as String.
- * @param tab how many tabs before the body of the class
- * @return the body as String
- */
- private String toStringBody(final int tab) {
- final StringBuffer buff = new StringBuffer(" {");//$NON-NLS-1$
- if (fields != null) {
- for (int i = 0; i < fields.size(); i++) {
- final FieldDeclaration field = (FieldDeclaration) fields.get(i);
- buff.append("\n"); //$NON-NLS-1$
- buff.append(field.toString(tab + 1));
- buff.append(";");//$NON-NLS-1$
- }
- }
- for (int i = 0; i < methods.size(); i++) {
- final MethodDeclaration o = (MethodDeclaration) methods.get(i);
- buff.append("\n");//$NON-NLS-1$
- buff.append(o.toString(tab + 1));
- }
- buff.append("\n").append(tabString(tab)).append("}"); //$NON-NLS-2$ //$NON-NLS-1$
- return buff.toString();
- }
-
- /**
- * Return the header of the class as String.
- * @return the header of the class
- */
- private String toStringHeader() {
- final StringBuffer buff = new StringBuffer("class ").append(name);//$NON-NLS-1$
- if (superclass != null) {
- buff.append(" extends "); //$NON-NLS-1$
- buff.append(superclass);
- }
- return buff.toString();
- }
-
- /**
- * Get the image of a class.
- * @return the image that represents a php class
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_CLASS;
- }
-
- public Object getParent() {
- return parent;
- }
-
- public Outlineable get(final int index) {
- return (Outlineable) children.get(index);
- }
-
- public int size() {
- return children.size();
- }
-
- public String toString() {
- final StringBuffer buff = new StringBuffer(name);
- if (superclass != null) {
- buff.append(":"); //$NON-NLS-1$
- buff.append(superclass);
- }
- return buff.toString();
- }
-
- public Position getPosition() {
- return position;
- }
-
- public List getList() {
- return children;
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * a class instantiation.
- * @author Matthieu Casanova
- */
-public final class ClassInstantiation extends PrefixedUnaryExpression {
-
- private final boolean reference;
-
- public ClassInstantiation(final Expression expression,
- final boolean reference,
- final int sourceStart) {
- super(expression, OperatorIds.NEW, sourceStart);
- this.reference = reference;
- }
-
- public String toStringExpression() {
- if (!reference) {
- return super.toStringExpression();
- }
- return '&' + super.toStringExpression();
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A ConditionalExpression is like that : booleanExpression ? trueValue : falseValue;.
- * @author Matthieu Casanova
- */
-public final class ConditionalExpression extends OperatorExpression {
-
- private final Expression condition;
- private final Expression valueIfTrue;
- private final Expression valueIfFalse;
-
- public ConditionalExpression(final Expression condition,
- final Expression valueIfTrue,
- final Expression valueIfFalse) {
- super(-1, condition.sourceStart, valueIfFalse.sourceEnd);
- this.condition = condition;
- this.valueIfTrue = valueIfTrue;
- this.valueIfFalse = valueIfFalse;
- }
-
- public String toStringExpression() {
- final String conditionString = condition.toStringExpression();
- final String valueIfTrueString = valueIfTrue.toStringExpression();
- final String valueIfFalse = this.valueIfFalse.toStringExpression();
- final StringBuffer buff = new StringBuffer(8 +
- conditionString.length() +
- valueIfTrueString.length() +
- valueIfFalse.length());
- buff.append("(");
- buff.append(conditionString);
- buff.append(") ? ");
- buff.append(valueIfTrueString);
- buff.append(" : ");
- buff.append(valueIfFalse);
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- condition.getModifiedVariable(list);
- valueIfTrue.getModifiedVariable(list);
- valueIfFalse.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- condition.getUsedVariable(list);
- valueIfTrue.getUsedVariable(list);
- valueIfFalse.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-import test.Token;
-
-/**
- * @author Matthieu Casanova
- */
-public final class ConstantIdentifier extends Expression {
-
- private final String 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 name;
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * A continue statement.
- * @author Matthieu Casanova
- */
-public final class Continue extends BranchStatement {
-
- public Continue(final Expression expression, final int sourceStart, final int sourceEnd) {
- super(expression, sourceStart, sourceEnd);
- }
-
- public String toString(final int tab) {
- final String s = tabString(tab);
- if (expression == null) {
- return s + "continue";//$NON-NLS-1$
- }
- return s + "continue " + expression.toString();//$NON-NLS-1$
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * A default case for a switch.
- * it's default : .....;
- * @author Matthieu Casanova
- */
-public final class DefaultCase extends AbstractCase {
-
- /**
- * Create a default case.
- *
- * @param statements the statements
- * @param sourceStart the starting offset
- * @param sourceEnd the ending offset
- */
- public DefaultCase(final Statement[] statements, final int sourceStart, final int sourceEnd) {
- super(statements, sourceStart, sourceEnd);
- }
-
- /**
- * Return the object into String.
- *
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("default : \n"); //$NON-NLS-1$
- for (int i = 0; i < statements.length; i++) {
- final Statement statement = statements[i];
- buff.append(statement.toString(tab + 9));
- }
- return buff.toString();
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.Position;
-
-import java.util.List;
-
-/**
- * a Define.
- * define(expression,expression)
- *
- * @author Matthieu Casanova
- */
-public final class Define extends Statement implements Outlineable {
-
- private final Expression defineName;
- private final Expression defineValue;
-
- private final Object parent;
- private final Position position;
-
- public Define(final Object parent,
- final Expression defineName,
- final Expression defineValue,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.parent = parent;
- this.defineName = defineName;
- this.defineValue = defineValue;
- position = new Position(sourceStart, sourceEnd);
- }
-
- public String toString(final int tab) {
- final String nameString = defineName.toStringExpression();
- final String valueString = defineValue.toStringExpression();
- final StringBuffer buff = new StringBuffer(tab + 10 + nameString.length() + valueString.length());
- buff.append(tabString(tab));
- buff.append("define(");
- buff.append(nameString);
- buff.append(", ");
- buff.append(valueString);
- buff.append(")");
- return buff.toString();
- }
-
- public String toString() {
- final String nameString = defineName.toStringExpression();
- final String valueString = defineValue.toStringExpression();
- final StringBuffer buff = new StringBuffer(nameString.length() + valueString.length() + 3);
- buff.append(nameString);
- buff.append(" = ");
- buff.append(valueString);
- return buff.toString();
- }
-
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_VAR;
- }
-
- public Object getParent() {
- return parent;
- }
-
- public Position getPosition() {
- return position;
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- list.add(new VariableUsage(defineName.toStringExpression(), sourceStart));//todo: someday : evaluate the defineName
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A do statement.
- *
- * @author Matthieu Casanova
- */
-public final class DoStatement extends Statement {
-
-
- /** The condition expression. */
- private final Expression condition;
- /** The action of the while. (it could be a block) */
- private final Statement action;
-
- public DoStatement(final Expression condition,
- final Statement action,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.condition = condition;
- this.action = action;
- }
-
- /**
- * Return the object into String.
- *
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final String conditionString = condition.toStringExpression();
- final StringBuffer buff;
- if (action == null) {
- buff = new StringBuffer(17 + tab + conditionString.length());
- buff.append("do ");//$NON-NLS-1$
- buff.append(" {} ;"); //$NON-NLS-1$
- } else {
- final String actionString = action.toString(tab + 1);
- buff = new StringBuffer(13 + conditionString.length() + actionString.length());
- buff.append("do ");//$NON-NLS-1$
- buff.append("\n");//$NON-NLS-1$
- buff.append(actionString);
- }
- buff.append(tabString(tab));
- buff.append(" while (");//$NON-NLS-1$
- buff.append(conditionString);
- buff.append(")");//$NON-NLS-1$
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- condition.getOutsideVariable(list); // todo: check if unuseful
- action.getOutsideVariable(list);
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- condition.getModifiedVariable(list);
- action.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- condition.getUsedVariable(list);
- action.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * an echo statement.
- * echo something;
- *
- * @author Matthieu Casanova
- */
-public final class EchoStatement extends Statement {
-
- /** An array of expressions in this echo statement. */
- private final Expression[] expressions;
-
- public EchoStatement(final Expression[] expressions, final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.expressions = expressions;
- }
-
- public String toString() {
- final StringBuffer buff = new StringBuffer("echo ");//$NON-NLS-1$
- for (int i = 0; i < expressions.length; i++) {
- if (i != 0) {
- buff.append(", ");//$NON-NLS-1$
- }
- buff.append(expressions[i].toStringExpression());
- }
- return buff.toString();
- }
-
- /**
- * Return the object into String.
- *
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final String tabs = tabString(tab);
- final String str = toString();
- final StringBuffer buff = new StringBuffer(tabs.length() + str.length());
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- for (int i = 0; i < expressions.length; i++) {
- expressions[i].getOutsideVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- for (int i = 0; i < expressions.length; i++) {
- expressions[i].getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- for (int i = 0; i < expressions.length; i++) {
- expressions[i].getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * an else statement.
- * it's else
- * @author Matthieu Casanova
- */
-public final class Else extends Statement {
-
- /** the statements. */
- private final Statement[] statements;
-
- /**
- * An else statement bad version ( : endif).
- * @param statements the statements
- * @param sourceStart the starting offset
- * @param sourceEnd the ending offset
- */
- public Else(final Statement[] statements,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.statements = statements;
- }
-
- /**
- * An else statement good version
- * @param statement the statement (it could be a block)
- * @param sourceStart the starting offset
- * @param sourceEnd the ending offset
- */
- public Else(final Statement statement,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- statements = new Statement[1];
- statements[0] = statement;
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("else \n");//$NON-NLS-1$
- Statement statement;
- for (int i = 0; i < statements.length; i++) {
- statement = statements[i];
- buff.append(statement.toString(tab + 1)).append("\n");//$NON-NLS-1$
- }
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getOutsideVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * An elseif statement.
- * @author Matthieu Casanova
- */
-public final class ElseIf extends Statement {
-
- /** The condition. */
- private final Expression condition;
-
- /** The statements. */
- private final Statement[] statements;
-
- public ElseIf(final Expression condition, final Statement[] statements, final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.condition = condition;
- this.statements = statements;
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("elseif (");
- buff.append(condition.toStringExpression());
- buff.append(") \n");
- for (int i = 0; i < statements.length; i++) {
- final Statement statement = statements[i];
- buff.append(statement.toString(tab + 1)).append('\n');
- }
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getModifiedVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getModifiedVariable(list);
- }
- condition.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getUsedVariable(list);
- }
- condition.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * An empty statement.
- * @author Matthieu Casanova
- */
-public final class EmptyStatement extends Statement {
-
- public EmptyStatement(final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-
- public String toString(final int tab) {
- return tabString(tab) + ';'; //$NON-NLS-1$
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-
-/**
- * An expression.
- * @author Matthieu Casanova
- */
-public abstract class Expression extends Statement {
-
- /**
- * Create an expression giving starting and ending offset
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- protected Expression(final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-
- /**
- * Return the expression with a number of spaces before.
- * @param tab how many spaces before the expression
- * @return a string representing the expression
- */
- public final String toString(final int tab) {
- return tabString(tab) + toStringExpression();
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public abstract String toStringExpression();
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import test.Token;
-
-/**
- * @author Matthieu Casanova
- */
-public final class FalseLiteral extends MagicLiteral {
-
- public FalseLiteral(final Token token) {
- super(token.sourceStart, token.sourceEnd);
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- return "false";//$NON-NLS-1$
- }
-
- public String toString() {
- return "false";//$NON-NLS-1$
- }
-}
\ No newline at end of file
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.Position;
-
-/**
- * A Field declaration.
- * This is a variable declaration for a php class
- * In fact it's an array of VariableUsage, since a field could contains
- * several var :
- * var $toto,$tata;
- * @author Matthieu Casanova
- */
-public final class FieldDeclaration extends Statement implements Outlineable {
-
- /** The variables. */
- public final VariableDeclaration[] vars;
-
- private final Object parent;
- private final Position position;
-
- /**
- * Create a new field.
- * @param vars the array of variables.
- * @param sourceStart the starting offset
- * @param sourceEnd the ending offset
- */
- public FieldDeclaration(final VariableDeclaration[] vars,
- final int sourceStart,
- final int sourceEnd,
- final Object parent) {
- super(sourceStart, sourceEnd);
- this.vars = vars;
- this.parent = parent;
- position = new Position(sourceStart, sourceEnd);
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("var ");//$NON-NLS-1$
- for (int i = 0; i < vars.length; i++) {
- if (i != 0) {
- buff.append(",");//$NON-NLS-1$
- }
- buff.append(vars[i].toStringExpression());
- }
- return buff.toString();
- }
-
- /**
- * Get the image of a variable.
- * @return the image that represents a php variable
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_VAR;
- }
-
- public Object getParent() {
- return parent;
- }
-
- public Position getPosition() {
- return position;
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A For statement.
- * for(initializations;condition;increments) action
- * @author Matthieu Casanova
- */
-public final class ForStatement extends Statement {
-
- /** the initializations. */
- private final Expression[] initializations;
-
- /** the condition. */
- private final Expression condition;
- /** the increments. */
- private final Expression[] increments;
-
- private final Statement action;
-
- /**
- * a for statement.
- *
- * @param initializations the initializations expressions
- * @param condition the condition when the for get out
- * @param increments the increments statements
- * @param action the action (a statement, a block ...)
- * @param sourceStart the beginning sources
- * @param sourceEnd the ending sources
- */
- public ForStatement(final Expression[] initializations,
- final Expression condition,
- final Expression[] increments,
- final Statement action,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.initializations = initializations;
- this.condition = condition;
- this.increments = increments;
- this.action = action;
- }
-
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("for ("); //$NON-NLS-1$
- //inits
- if (initializations != null) {
- for (int i = 0; i < initializations.length; i++) {
- buff.append(initializations[i].toStringExpression());
- if (i != (initializations.length - 1))
- buff.append(" , "); //$NON-NLS-1$
- }
- }
- buff.append("; "); //$NON-NLS-1$
- //cond
- if (condition != null) {
- buff.append(condition.toStringExpression());
- }
- buff.append("; "); //$NON-NLS-1$
- //updates
- if (increments != null) {
- for (int i = 0; i < increments.length; i++) {
- //nice only with expressions
- buff.append(increments[i].toStringExpression());
- if (i != (increments.length - 1))
- buff.append(" , "); //$NON-NLS-1$
- }
- }
- buff.append(") "); //$NON-NLS-1$
- //block
- if (action == null)
- buff.append("{}"); //$NON-NLS-1$
- else
- buff.append(action.toString(tab + 1)); //$NON-NLS-1$
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- if (condition != null) {
- condition.getOutsideVariable(list);
- }
- if (action != null) {
- action.getOutsideVariable(list);
- }
- if (initializations != null) {
- for (int i = 0; i < initializations.length; i++) {
- initializations[i].getOutsideVariable(list);
- }
- }
- if (increments != null) {
- for (int i = 0; i < increments.length; i++) {
- increments[i].getOutsideVariable(list);
- }
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- if (condition != null) {
- condition.getModifiedVariable(list);
- }
- if (action != null) {
- action.getModifiedVariable(list);
- }
- if (initializations != null) {
- for (int i = 0; i < initializations.length; i++) {
- initializations[i].getModifiedVariable(list);
- }
- }
- if (increments != null) {
- for (int i = 0; i < increments.length; i++) {
- increments[i].getModifiedVariable(list);
- }
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- if (condition != null) {
- condition.getUsedVariable(list);
- }
- if (action != null) {
- action.getUsedVariable(list);
- }
- if (initializations != null) {
- for (int i = 0; i < initializations.length; i++) {
- initializations[i].getUsedVariable(list);
- }
- }
- if (increments != null) {
- for (int i = 0; i < increments.length; i++) {
- increments[i].getUsedVariable(list);
- }
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * @author Matthieu Casanova
- */
-public final class ForeachStatement extends Statement {
-
- private final Expression expression;
- private final Expression variable;
- private final Statement statement;
-
- public ForeachStatement(final Expression expression,
- final Expression variable,
- final Statement statement,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.expression = expression;
- this.variable = variable;
- this.statement = statement;
- }
-
- /**
- * Return the object into String.
- *
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final String expressionString = expression.toStringExpression();
- final String variableString = variable.toStringExpression();
- final String statementString = statement.toString(tab + 1);
- final StringBuffer buff = new StringBuffer(tab +
- expressionString.length() +
- variableString.length() +
- statementString.length() + 18);
- buff.append(tabString(tab));
- buff.append("foreach (");
- buff.append(expressionString);
- buff.append(" as ");
- buff.append(variableString);
- buff.append(" {\n");
- buff.append(statementString);
- buff.append("\n}");
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- expression.getOutsideVariable(list);
- variable.getOutsideVariable(list);
- statement.getOutsideVariable(list);
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- expression.getModifiedVariable(list);
- variable.getUsedVariable(list);
- statement.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- expression.getUsedVariable(list);
- statement.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A Function call.
- * @author Matthieu Casanova
- */
-public final class FunctionCall extends AbstractSuffixExpression {
-
- /** the function name. */
- private final Expression functionName;
-
- /** the arguments. */
- private final Expression[] args;
-
- /**
- * a function call.
- * it's <code>functionName(args ...)
- * @param functionName the function name
- * @param args the arguments
- * @param sourceEnd the source end
- */
- public FunctionCall(final Expression functionName,
- final Expression[] args,
- final int sourceEnd) {
- super(functionName.sourceStart, sourceEnd);
- this.functionName = functionName;
- this.args = args;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final StringBuffer buff = new StringBuffer(functionName.toStringExpression());
- buff.append('(');
- if (args != null) {
- for (int i = 0; i < args.length; i++) {
- final Expression arg = args[i];
- if (i != 0) {
- buff.append(',');
- }
- buff.append(arg.toStringExpression());
- }
- }
- buff.append(')');
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- if (args != null) {
- for (int i = 0; i < args.length; i++) {
- args[i].getModifiedVariable(list);
- }
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- functionName.getUsedVariable(list);
- if (args != null) {
- for (int i = 0; i < args.length; i++) {
- args[i].getUsedVariable(list);
- }
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.Position;
-
-import test.PHPParserSuperclass;
-
-/**
- * A GlobalStatement statement in php.
- * @author Matthieu Casanova
- */
-public final class GlobalStatement extends Statement implements Outlineable {
-
- /** An array of the variables called by this global statement. */
- private final AbstractVariable[] variables;
-
- private final Object parent;
-
- private final Position position;
-
- public GlobalStatement(final Object parent,
- final AbstractVariable[] variables,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.variables = variables;
- this.parent = parent;
- position = new Position(sourceStart, sourceEnd);
- }
-
- public String toString() {
- final StringBuffer buff = new StringBuffer("global ");//$NON-NLS-1$
- for (int i = 0; i < variables.length; i++) {
- if (i != 0) {
- buff.append(", ");//$NON-NLS-1$
- }
- buff.append(variables[i].toStringExpression());
- }
- return buff.toString();
- }
-
- public String toString(final int tab) {
- return tabString(tab) + toString();
- }
-
- /**
- * This will return the image for the outline of the object.
- * @return an image
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_INC;
- }
-
- public Object getParent() {
- return parent;
- }
-
- public Position getPosition() {
- return position;
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- for (int i = 0; i < variables.length; i++) {
- variables[i].getUsedVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-
- /**
- * We will analyse the code.
- * if we have in globals a special variable it will be reported as a warning.
- * @see Variable#SPECIAL_VARS
- */
- public void analyzeCode() {
- for (int i = 0; i < variables.length; i++) {
- if (arrayContains(Variable.SPECIAL_VARS, variables[i].getName())) {
- try {
- PHPParserSuperclass.setMarker("warning, you shouldn't request " + variables[i].getName() + " as global",
- variables[i].sourceStart,
- variables[i].sourceEnd,
- PHPParserSuperclass.WARNING,
- "");
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- }
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * @author Matthieu Casanova
- */
-public final class HTMLBlock extends Statement {
-
- private final AstNode[] nodes;
-
- public HTMLBlock(final AstNode[] nodes) {
- super(nodes[0].sourceStart, nodes[(nodes.length > 0) ? nodes.length - 1 : 0].sourceEnd);
- this.nodes = nodes;
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("?>");
- for (int i = 0; i < nodes.length; i++) {
- buff.append(nodes[i].toString(tab + 1));
- }
- buff.append("<?php\n");
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-
-/**
- * It's html code.
- * It will contains some html, javascript, css ...
- * @author Matthieu Casanova
- */
-public final class HTMLCode extends AstNode {
-
- /** The html Code. */
- private final String htmlCode;
-
- /**
- * Create an html Block.
- * @param htmlCode the html inside the block
- * @param sourceStart the starting offset
- * @param sourceEnd the ending offset
- */
- public HTMLCode(final String htmlCode,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.htmlCode = htmlCode;
- }
-
- /**
- * I don't process tabs, it will only return the html inside.
- * @return the text of the block
- */
- public String toString() {
- return htmlCode;
- }
-
- /**
- * I don't process tabs, it will only return the html inside.
- * @param tab how many tabs before this html
- * @return the text of the block
- */
- public String toString(final int tab) {
- return htmlCode + ' ';
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * This is a if statement.
- * if (condition)
- * statement
- * (elseif statement)*
- * else statement
- * @author Matthieu Casanova
- */
-public final class IfStatement extends Statement {
-
- private final Expression condition;
- private final Statement statement;
- private final ElseIf[] elseifs;
- private final Else els;
-
- /**
- * Create a new If statement.
- * @param condition the condition
- * @param statement a statement or a block of statements
- * @param elseifs the elseifs
- * @param els the else (or null)
- * @param sourceStart the starting position
- * @param sourceEnd the ending offset
- */
- public IfStatement(final Expression condition,
- final Statement statement,
- final ElseIf[] elseifs,
- final Else els,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.condition = condition;
- this.statement = statement;
- this.elseifs = elseifs;
- this.els = els;
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("if (");//$NON-NLS-1$
- buff.append(condition.toStringExpression()).append(") ");//$NON-NLS-1$
- if (statement != null) {
- buff.append(statement.toString(tab + 1));
- }
- for (int i = 0; i < elseifs.length; i++) {
- buff.append(elseifs[i].toString(tab + 1));
- buff.append("\n");//$NON-NLS-1$
- }
- if (els != null) {
- buff.append(els.toString(tab + 1));
- buff.append("\n");//$NON-NLS-1$
- }
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- condition.getOutsideVariable(list); // todo: check if unuseful
- if (statement != null) {
- statement.getOutsideVariable(list);
- }
- for (int i = 0; i < elseifs.length; i++) {
- elseifs[i].getOutsideVariable(list);
- }
- if (els != null) {
- els.getOutsideVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- condition.getModifiedVariable(list);
- if (statement != null) {
- statement.getModifiedVariable(list);
- }
- for (int i = 0; i < elseifs.length; i++) {
- elseifs[i].getModifiedVariable(list);
- }
- if (els != null) {
- els.getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- condition.getUsedVariable(list);
- if (statement != null) {
- statement.getUsedVariable(list);
- }
- for (int i = 0; i < elseifs.length; i++) {
- elseifs[i].getUsedVariable(list);
- }
- if (els != null) {
- els.getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.Position;
-
-/**
- * @author Matthieu Casanova
- */
-public final class InclusionStatement extends Statement implements Outlineable {
-
- public static final int INCLUDE = 0;
- public static final int INCLUDE_ONCE = 1;
- public static final int REQUIRE = 2;
- public static final int REQUIRE_ONCE = 3;
- public boolean silent;
- /** The kind of include. */
- private final int keyword;
- private final Expression expression;
-
- private final Object parent;
-
- private final Position position;
-
- public InclusionStatement(final Object parent,
- final int keyword,
- final Expression expression,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.keyword = keyword;
- this.expression = expression;
- this.parent = parent;
- position = new Position(sourceStart, sourceEnd);
- }
-
- private String keywordToString() {
- switch (keyword) {
- case INCLUDE:
- return "include"; //$NON-NLS-1$
- case INCLUDE_ONCE:
- return "include_once"; //$NON-NLS-1$
- case REQUIRE:
- return "require"; //$NON-NLS-1$
- case REQUIRE_ONCE:
- return "require_once"; //$NON-NLS-1$
- }
- return "unknown keyword";//$NON-NLS-1$
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final StringBuffer buffer = new StringBuffer(tabString(tab));
- buffer.append(toString());
- return buffer.toString();
- }
-
- public String toString() {
- final String keyword = keywordToString();
- final String expressionString = expression.toStringExpression();
- final StringBuffer buffer = new StringBuffer(keyword.length() +
- expressionString.length() + 2);
- if (silent) {
- buffer.append('@');
- }
- buffer.append(keyword);
- buffer.append(' ');
- buffer.append(expressionString);
- return buffer.toString();
- }
-
- /**
- * Get the image of a variable.
- * @return the image that represents a php variable
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_INC;
- }
-
- public Object getParent() {
- return parent;
- }
-
- public Position getPosition() {
- return position;
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- expression.getOutsideVariable(list);
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- expression.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- expression.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * @author Matthieu Casanova
- */
-public final class LabeledStatement extends Statement {
-
- private final String label;
-
- private final Statement statement;
-
- public LabeledStatement(final String label,
- final Statement statement,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.label = label;
- this.statement = statement;
- }
-
- /**
- * Return the object into String.
- * It should be overriden
- *
- * @return a String
- */
- public String toString() {
- return label + statement.toString();
- }
-
- /**
- * Return the object into String.
- *
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- return tabString(tab) + toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- statement.getOutsideVariable(list);
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- statement.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- statement.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A list expression.
- * it could be list($v1,$v2), list(,$v2) ...
- * @author Matthieu Casanova
- */
-public final class ListExpression extends Expression {
-
- private final Expression[] vars;
- private Expression expression;
-
- public ListExpression(final Expression[] vars,
- final Expression expression,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.vars = vars;
- this.expression = expression;
- }
-
- public ListExpression(final Expression[] vars,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.vars = vars;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final StringBuffer buff = new StringBuffer("list(");
- for (int i = 0; i < vars.length; i++) {
- if (i != 0) {
- buff.append(", ");
- }
- if (vars[i] != null) {
- buff.append(vars[i].toStringExpression());
- }
- }
- if (expression != null) {
- buff.append(" = ");
- buff.append(expression.toStringExpression());
- }
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- for (int i = 0; i < vars.length; i++) {
- if (vars[i] != null) {
- vars[i].getUsedVariable(list);
- }
- }
- if (expression != null) {
- expression.getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- if (expression != null) {
- expression.getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * Here is the Superclass of the Literal expressions.
- * @author Matthieu Casanova
- */
-public abstract class Literal extends Expression {
-
- /**
- * Create a Literal.
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- protected Literal(final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public final void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public final void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * @author Matthieu Casanova
- */
-public abstract class MagicLiteral extends Literal {
-
- protected MagicLiteral(final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.Position;
-import test.PHPParserSuperclass;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
-/**
- * A Method declaration.
- *
- * @author Matthieu Casanova
- */
-public final class MethodDeclaration extends Statement implements OutlineableWithChildren {
-
- /** The name of the method. */
- public final String name;
- private final ArrayList arguments;
-
-
- public Statement[] statements;
- private final int bodyStart;
- private int bodyEnd = -1;
- /** Tell if the method is a class constructor. */
- public boolean isConstructor;
-
- /** The parent object. */
- private Object parent;
- /** The outlineable children (those will be in the node array too. */
- private final ArrayList children = new ArrayList();
-
- /** Tell if the method returns a reference. */
- private final boolean reference;
-
- private final Position position;
-
- public MethodDeclaration(final Object parent,
- final String name,
- final ArrayList arguments,
- final boolean reference,
- final int sourceStart,
- final int sourceEnd,
- final int bodyStart,
- final int bodyEnd) {
- super(sourceStart, sourceEnd);
- this.name = name;
- this.arguments = arguments;
- this.parent = parent;
- this.reference = reference;
- this.bodyStart = bodyStart;
- this.bodyEnd = bodyEnd;
- position = new Position(sourceStart, sourceEnd);
- }
-
- /**
- * Return method into String, with a number of tabs
- *
- * @param tab the number of tabs
- * @return the String containing the method
- */
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append(toStringHeader());
- buff.append(toStringStatements(tab + 1));
- return buff.toString();
- }
-
- private String toStringHeader() {
- return "function " + toString();
- }
-
- /**
- * Return the statements of the method into Strings
- *
- * @param tab the number of tabs
- * @return the String containing the statements
- */
- private String toStringStatements(final int tab) {
- final StringBuffer buff = new StringBuffer(" {"); //$NON-NLS-1$
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- buff.append("\n").append(statements[i].toString(tab)); //$NON-NLS-1$
- if (!(statements[i] instanceof Block)) {
- buff.append(";"); //$NON-NLS-1$
- }
- }
- }
- buff.append("\n").append(tabString(tab == 0 ? 0 : tab - 1)).append("}"); //$NON-NLS-2$ //$NON-NLS-1$
- return buff.toString();
- }
-
- /**
- * Get the image of a class.
- *
- * @return the image that represents a php class
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_FUN;
- }
-
- public void setParent(final Object parent) {
- this.parent = parent;
- }
-
- public Object getParent() {
- return parent;
- }
-
- public boolean add(final Outlineable o) {
- return children.add(o);
- }
-
- public Outlineable get(final int index) {
- return (Outlineable) children.get(index);
- }
-
- public int size() {
- return children.size();
- }
-
- public String toString() {
- final StringBuffer buff = new StringBuffer();
- if (reference) {
- buff.append("&");//$NON-NLS-1$
- }
- buff.append(name).append("(");//$NON-NLS-1$
-
- if (arguments != null) {
- for (int i = 0; i < arguments.size(); i++) {
- final VariableDeclaration o = (VariableDeclaration) arguments.get(i);
- buff.append(o.toStringExpression());
- if (i != (arguments.size() - 1)) {
- buff.append(", "); //$NON-NLS-1$
- }
- }
- }
- buff.append(")"); //$NON-NLS-1$
- return buff.toString();
- }
-
- public Position getPosition() {
- return position;
- }
-
- public List getList() {
- return children;
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * This method will analyze the code.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {}
-
- /**
- * Get global variables (not parameters).
- */
- private void getGlobalVariable(final List list) {
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getOutsideVariable(list);
- }
- }
- }
-
- private void getParameters(final List list) {
- if (arguments != null) {
- for (int i = 0; i < arguments.size(); i++) {
- final VariableDeclaration variable = (VariableDeclaration) arguments.get(i);
- list.add(new VariableUsage(variable.name(), variable.sourceStart));
- }
- }
- }
-
- /**
- * get the modified variables.
- */
- private void getAssignedVariableInCode(final List list) {
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getModifiedVariable(list);
- }
- }
- }
-
- /**
- * Get the variables used.
- */
- private void getUsedVariableInCode(final List list) {
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].getUsedVariable(list);
- }
- }
- }
-
- private static boolean isVariableDeclaredBefore(final List list, final VariableUsage var) {
- final String name = var.getName();
- final int pos = var.getStartOffset();
- for (int i = 0; i < list.size(); i++) {
- final VariableUsage variableUsage = (VariableUsage) list.get(i);
- if (variableUsage.getName().equals(name) && variableUsage.getStartOffset() < pos) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * This method will analyze the code.
- */
- public void analyzeCode() {
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- statements[i].analyzeCode();
-
- }
- }
-
- final List globalsVars = new ArrayList();
- getGlobalVariable(globalsVars);
- final List modifiedVars = new ArrayList();
- getAssignedVariableInCode(modifiedVars);
- final List parameters = new ArrayList(arguments.size());
- getParameters(parameters);
-
- final List declaredVars = new ArrayList(globalsVars.size() + modifiedVars.size());
- declaredVars.addAll(globalsVars);
- declaredVars.addAll(modifiedVars);
- declaredVars.addAll(parameters);
-
- final List usedVars = new ArrayList();
- getUsedVariableInCode(usedVars);
- final List readOrWriteVars = new ArrayList(modifiedVars.size() + usedVars.size());
- readOrWriteVars.addAll(modifiedVars);
- readOrWriteVars.addAll(usedVars);
-
- //look for used variables that were not declared before
- findUnusedParameters(readOrWriteVars, parameters);
- findUnknownUsedVars(usedVars, declaredVars);
- }
-
- /**
- * This method will add a warning on all unused parameters.
- *
- * @param vars the used variable list
- * @param parameters the declared variable list
- */
- private static void findUnusedParameters(final List vars, final List parameters) {
- for (int i = 0; i < parameters.size(); i++) {
- final VariableUsage param = (VariableUsage) parameters.get(i);
- if (!isVariableInList(param.getName(), vars)) {
- try {
- PHPParserSuperclass.setMarker(
- "warning, the parameter " + param.getName() + " seems to be never used in your method",
- param.getStartOffset(),
- param.getStartOffset() + param.getName().length(),
- PHPParserSuperclass.WARNING,
- "");
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- }
- }
- }
-
- /**
- * Tell if the list of VariableUsage contains a variable named by the name given.
- *
- * @param name the variable name
- * @param list the list of VariableUsage
- * @return true if the variable is in the list false otherwise
- */
- private static boolean isVariableInList(final String name, final List list) {
- for (int i = 0; i < list.size(); i++) {
- if (((VariableUsage) list.get(i)).getName().equals(name)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * This method will add a warning on all used variables in a method that aren't declared before.
- *
- * @param usedVars the used variable list
- * @param declaredVars the declared variable list
- */
- private static void findUnknownUsedVars(final List usedVars, final List declaredVars) {
- final HashSet list = new HashSet(usedVars.size());
- for (int i = 0; i < usedVars.size(); i++) {
- final VariableUsage variableUsage = (VariableUsage) usedVars.get(i);
- if ("this".equals(variableUsage.getName())) continue; // this is a special variable
- if (!list.contains(variableUsage.getName()) && !isVariableDeclaredBefore(declaredVars, variableUsage)) {
- list.add(variableUsage.getName());
- try {
- PHPParserSuperclass.setMarker(
- "warning, usage of a variable that seems to be unassigned yet : " + variableUsage.getName(),
- variableUsage.getStartOffset(),
- variableUsage.getStartOffset() + variableUsage.getName().length(),
- PHPParserSuperclass.WARNING,
- "");
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- }
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import test.Token;
-
-/**
- * @author Matthieu Casanova
- */
-public final class NullLiteral extends MagicLiteral {
-
- public NullLiteral(final Token token) {
- super(token.sourceStart, token.sourceEnd);
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- return "null";
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import test.Token;
-
-/**
- * Literal for numbers.
- * @author Matthieu Casanova
- */
-public final class NumberLiteral extends Literal {
- private final String source;
-
- public NumberLiteral(final Token token) {
- super(token.sourceStart, token.sourceEnd);
- source = token.image;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- return source;
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * Any expression that have an operator.
- * @author Matthieu Casanova
- */
-public abstract class OperatorExpression
- extends Expression
- implements OperatorIds {
-
- private final int operator;
-
- protected OperatorExpression(final int operator, final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.operator = operator;
- }
-
- public final String operatorToString() {
- switch (operator) {
- case EQUAL_EQUAL:
- return "=="; //$NON-NLS-1$
- case LESS_EQUAL:
- return "<="; //$NON-NLS-1$
- case GREATER_EQUAL:
- return ">="; //$NON-NLS-1$
- case NOT_EQUAL:
- return "!="; //$NON-NLS-1$
- case LEFT_SHIFT:
- return "<<"; //$NON-NLS-1$
- case RIGHT_SHIFT:
- return ">>"; //$NON-NLS-1$
- case UNSIGNED_RIGHT_SHIFT:
- return ">>>"; //$NON-NLS-1$
- case OR_OR:
- return "||"; //$NON-NLS-1$
- case AND_AND:
- return "&&"; //$NON-NLS-1$
- case PLUS:
- return "+"; //$NON-NLS-1$
- case MINUS:
- return "-"; //$NON-NLS-1$
- case NOT:
- return "!"; //$NON-NLS-1$
- case REMAINDER:
- return "%"; //$NON-NLS-1$
- case XOR:
- return "^"; //$NON-NLS-1$
- case AND:
- return "&"; //$NON-NLS-1$
- case MULTIPLY:
- return "*"; //$NON-NLS-1$
- case OR:
- return "|"; //$NON-NLS-1$
- case TWIDDLE:
- return "~"; //$NON-NLS-1$
- case DIVIDE:
- return "/"; //$NON-NLS-1$
- case GREATER:
- return ">"; //$NON-NLS-1$
- case LESS:
- return "<"; //$NON-NLS-1$
- case ORL:
- return "OR"; //$NON-NLS-1$
- case ANDL:
- return "AND"; //$NON-NLS-1$
- case DOT:
- return "."; //$NON-NLS-1$
- case DIF:
- return "<>"; //$NON-NLS-1$
- case BANG_EQUAL_EQUAL:
- return "!=="; //$NON-NLS-1$
- case EQUAL_EQUAL_EQUAL:
- return "==="; //$NON-NLS-1$
- case EQUAL:
- return "="; //$NON-NLS-1$
- case AT:
- return "@"; //$NON-NLS-1$
- case PLUS_PLUS:
- return "++"; //$NON-NLS-1$
- case MINUS_MINUS:
- return "--"; //$NON-NLS-1$
- case NEW:
- return "new "; //$NON-NLS-1$
- }
- return "unknown operator " +operator; //$NON-NLS-1$
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * The operators used in php.
- * Copied from org.eclipse.jdt.internal.compiler.ast.OperatorIds
- * @author Matthieu Casanova
- */
-public interface OperatorIds {
- int AND_AND = 0; // "&&"
- int OR_OR = 1; // "||"
- int AND = 2; // "&"
- int OR = 3; // "|"
- int LESS = 4; // "<"
- int LESS_EQUAL = 5; // "<="
- int GREATER = 6; // ">"
- int GREATER_EQUAL = 7; // ">="
- int XOR = 8; // "^"
- int DIVIDE = 9; // "/"
- int LEFT_SHIFT = 10; // "<<"
- int NOT = 11; // "!"
- int TWIDDLE = 12; // "~"
- int MINUS = 13; // "-"
- int PLUS = 14; // "+"
- int MULTIPLY = 15; // "*"
- int REMAINDER = 16; // "%"
- int RIGHT_SHIFT = 17; // ">>"
- int EQUAL_EQUAL = 18; // "=="
- int UNSIGNED_RIGHT_SHIFT= 19; // ">>>"
- int ORL = 20; // "OR"
- int ANDL = 21; // "AND"
- int DOT = 22; // "."
- int DIF = 23; // "<>"
- int BANG_EQUAL_EQUAL = 24; // "!=="
- int EQUAL_EQUAL_EQUAL = 25; // "==="
- int AT = 26; // "@"
-
- int NOT_EQUAL = 29; // "!="
- int PLUS_PLUS = 32; // "++"
- int MINUS_MINUS = 33; // "--"
- int NEW = 34; // "new "
- int EQUAL = 35; // "="
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.Position;
-
-/**
- * It's a php document.
- * This class is an outlineable object
- * It will contains html and php
- * @author Matthieu Casanova
- */
-public final class PHPDocument implements OutlineableWithChildren {
-
- /**
- * The nodes.
- * It will include html nodes or php nodes
- */
- public AstNode[] nodes;
-
- private final char[] name;
-
- /** The parent of the object. */
- private final Object parent;
-
- /** The outlineable children (those will be in the node array too. */
- private final ArrayList children = new ArrayList();
-
- private final Position position;
- /**
- * Create the PHPDocument.
- * @param parent the parent object (it should be null isn't it ?)
- */
- public PHPDocument(final Object parent,
- final char[] name) {
- this.parent = parent;
- this.name = name;
- position = new Position(1,name.length);
- }
-
- /**
- * Return the php document as String.
- * @return a string representation of the object.
- */
- public String toString() {
- final StringBuffer buff = new StringBuffer();
- AstNode node;
- if (nodes != null) {
- int i;
- for (i = 0; i < nodes.length; i++) {
- node = nodes[i];
- if (node == null) {
- break;
- }
- buff.append(node.toString(0));
- if (node instanceof HTMLCode) {
- buff.append("\n");//$NON-NLS-1$
- } else {
- buff.append(";\n");//$NON-NLS-1$
- }
- }
- }
- return buff.toString();
- }
-
- /**
- * Add an outlineable object.
- * @param o the new outlineable
- * @return does the addition worked ?
- */
- public boolean add(final Outlineable o) {
- return children.add(o);
- }
-
- /**
- * Return the outlineable at the index.
- * @param index the index
- * @return an outlineable object
- */
- public Outlineable get(final int index) {
- return (Outlineable) children.get(index);
- }
-
- /**
- * The number of outlineable children.
- * @return the number of children that are outlineable
- */
- public int size() {
- return children.size();
- }
-
- /**
- * This will return the image for the outline of the object.
- * @return an image
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_CLASS;
- }
-
- /**
- * Get the parent of the object.
- * @return the parent of the object
- */
- public Object getParent() {
- return parent;
- }
-
- public Position getPosition() {
- return position;
- }
-
- public List getList() {
- return children;
- }
-}
\ No newline at end of file
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * a php echo block.
- * <?= someexpression ?>
- * @author Matthieu Casanova
- */
-public final class PHPEchoBlock extends AstNode {
-
- /** the expression. */
- private final Expression expr;
-
- /**
- * Create a new php echo block.
- * @param expr the expression
- * @param sourceStart the starting offset
- * @param sourceEnd the ending offset
- */
- public PHPEchoBlock(final Expression expr,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.expr = expr;
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final String tabs = tabString(tab);
- final String expression = expr.toStringExpression();
- final StringBuffer buff = new StringBuffer(tabs.length() +
- expression.length() +
- 5);
- buff.append(tabs);
- buff.append("<?=");//$NON-NLS-1$
- buff.append(expression);
- buff.append("?>");//$NON-NLS-1$
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {}
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- expr.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * @author Matthieu Casanova
- */
-public final class PostfixedUnaryExpression extends UnaryExpression {
-
- public PostfixedUnaryExpression(final Expression expression,
- final int operator,
- final int sourceEnd) {
- super(expression, operator, expression.sourceStart, sourceEnd);
- }
-
- public String toStringExpression() {
- return expression.toStringExpression() + operatorToString();
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * @author Matthieu Casanova
- */
-public class PrefixedUnaryExpression extends UnaryExpression {
-
- public PrefixedUnaryExpression(final Expression expression,
- final int operator,
- final int sourceStart) {
- super(expression, operator, sourceStart, expression.sourceEnd);
- }
-
- public String toStringExpression() {
- return operatorToString() + expression.toStringExpression();
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * @author Matthieu Casanova
- */
-public final class PrintExpression extends Expression {
-
- private final Expression expression;
-
- public PrintExpression(final Expression expression, final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.expression = expression;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- return "print " + expression.toStringExpression();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- expression.getOutsideVariable(list);
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- expression.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- expression.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A return statement.
- * @author Matthieu Casanova
- */
-public final class ReturnStatement extends Statement {
-
- private final Expression expression;
-
- public ReturnStatement(final Expression expression, final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.expression = expression;
- }
-
- public String toString(final int tab) {
- final String s = tabString(tab);
- if (expression == null) {
- return s + "return";//$NON-NLS-1$
- }
- return s + "return " + expression.toStringExpression();//$NON-NLS-1$
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- if (expression != null) {
- expression.getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- if (expression != null) {
- expression.getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-
-/**
- * A Statement.
- * @author Matthieu Casanova
- */
-public abstract class Statement extends AstNode {
-
- /**
- * Create a node giving starting and ending offset.
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- protected Statement(final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-
- /**
- * Tell if the block is empty.
- * @return a statement is not empty by default
- */
- public boolean isEmptyBlock() {
- return false;
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A GlobalStatement statement in php.
- * @author Matthieu Casanova
- */
-public final class StaticStatement extends Statement {
-
- /** An array of the variables called by this global statement. */
- private final VariableDeclaration[] variables;
-
- public StaticStatement(final VariableDeclaration[] variables, final int sourceStart, final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.variables = variables;
- }
-
- public String toString() {
- final StringBuffer buff = new StringBuffer("static ");
- for (int i = 0; i < variables.length; i++) {
- if (i != 0) {
- buff.append(", ");
- }
- buff.append(variables[i]);
- }
- return buff.toString();
- }
-
- public String toString(final int tab) {
- return tabString(tab) + toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- for (int i = 0; i < variables.length; i++) {
- variables[i].getModifiedVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-import test.Token;
-
-public final class StringLiteral extends Literal {
- private String source;
-
- private AbstractVariable[] variablesInside;
-
- public StringLiteral(final Token token) {
- super(token.sourceStart,token.sourceEnd);
- source = token.image;
- }
-
- /**
- * Create a new StringLiteral
- * @param token the token
- * @param s sourcestart
- * @param e sourceend
- * @deprecated
- */
- public StringLiteral(final String token, final int s, final int e) {
- super(s, e);
- source = token;
- }
-
- /**
- * Create a new StringLiteral
- * @param token the token
- * @param s sourcestart
- * @param e sourceend
- * @deprecated
- */
- public StringLiteral(final String token,
- final int s,
- final int e,
- final AbstractVariable[] variablesInside) {
- super(s, e);
- source = token;
- this.variablesInside = variablesInside;
- }
-
- /**
- * Create a new StringLiteral
- * @param token the token
- * @param s sourcestart
- * @param e sourceend
- */
- public StringLiteral(final char[] token, final int s, final int e) {
- this(new String(token),s, e);
- }
-
- public StringLiteral(final int s, final int e) {
- super(s, e);
- }
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- return source;
- }
-
- /**
- * @deprecated - use field instead
- */
- public int sourceEnd() {
- return sourceEnd;
- }
-
- /**
- * @deprecated - use field instead
- */
- public int sourceStart() {
- return sourceStart;
- }
-
- public void getUsedVariable(final List list) {
- if (variablesInside != null) {
- for (int i = 0; i < variablesInside.length; i++) {
- variablesInside[i].getUsedVariable(list);
- }
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * @author Matthieu Casanova
- */
-public final class SwitchStatement extends Statement {
-
- private final Expression variable;
- private final AbstractCase[] cases;
-
- public SwitchStatement(final Expression variable,
- final AbstractCase[] cases,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.variable = variable;
- this.cases = cases;
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("switch (").append(variable.toStringExpression()).append(") {\n");
- for (int i = 0; i < cases.length; i++) {
- final AbstractCase cas = cases[i];
- buff.append(cas.toString(tab + 1));
- buff.append('\n');
- }
- buff.append('}');
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- for (int i = 0; i < cases.length; i++) {
- cases[i].getOutsideVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- for (int i = 0; i < cases.length; i++) {
- cases[i].getModifiedVariable(list);
- }
- variable.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- for (int i = 0; i < cases.length; i++) {
- cases[i].getUsedVariable(list);
- }
- variable.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import test.Token;
-
-/**
- * the true literal.
- * @author Matthieu Casanova
- */
-public final class TrueLiteral extends MagicLiteral {
-
- public TrueLiteral(final Token token) {
- super(token.sourceStart, token.sourceEnd);
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- return "true";//$NON-NLS-1$
- }
-
- public String toString() {
- return "true";//$NON-NLS-1$
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * The php types defined here.
- * @author Matthieu Casanova
- */
-public interface Types {
-
- char[] STRING = {'s', 't', 'r', 'i', 'n', 'g'};
- char[] BOOL = {'b', 'o', 'o', 'l'};
- char[] BOOLEAN = {'b', 'o', 'o', 'l', 'e', 'a', 'n'};
- char[] REAL = {'r', 'e', 'a', 'l'};
- char[] DOUBLE = {'d', 'o', 'u', 'b', 'l', 'e'};
- char[] FLOAT = {'f', 'l', 'o', 'a', 't'};
- char[] INT = {'i', 'n', 't'};
- char[] INTEGER = {'i', 'n', 't', 'e', 'g', 'e', 'r'};
- char[] OBJECT = {'o', 'b', 'j', 'e', 'c', 't'};
- char[] ARRAY = {'a', 'r', 'r', 'a', 'y'};
-
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * @author Matthieu Casanova
- */
-public abstract class UnaryExpression extends OperatorExpression {
-
- public final Expression expression;
-
- protected UnaryExpression(final Expression expression, final int operator, final int sourceStart, final int sourceEnd) {
- super(operator, sourceStart, sourceEnd);
- this.expression = expression;
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public final void getOutsideVariable(final List list) {}
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public final void getModifiedVariable(final List list) {
- expression.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public final void getUsedVariable(final List list) {
- expression.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A Variable assignation.
- * $varname = initializer
- * @author Matthieu Casanova
- */
-public final class VarAssignation extends Expression {
-
- public static final int EQUAL = 0;
- public static final int PLUS_EQUAL = 1;
- public static final int MINUS_EQUAL = 2;
- public static final int STAR_EQUAL = 3;
- public static final int SLASH_EQUAL = 4;
- public static final int AND_EQUAL = 5;
- public static final int OR_EQUAL = 6;
- public static final int XOR_EQUAL = 7;
- public static final int DOT_EQUAL = 8;
- public static final int REM_EQUAL = 9;
- public static final int TILDE_EQUAL = 10;
- public static final int LSHIFT_EQUAL = 11;
- public static final int RSIGNEDSHIFT_EQUAL = 12;
-
- public final Expression variableName;
- public final Expression initializer;
- public final int operator;
-
- /**
- * Create a new variable assignation.
- * @param variableName the name of the variable
- * @param initializer the expression in initializer
- * @param operator the operator of assignation
- * @param sourceStart the sourceStart
- * @param sourceEnd the sourceEnd
- */
- public VarAssignation(final Expression variableName,
- final Expression initializer,
- final int operator,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.variableName = variableName;
- this.initializer = initializer;
- this.operator = operator;
- }
-
- /**
- * Return the operator as String.
- * @return the operator
- */
- public String operatorToString() {
- switch (operator) {
- case EQUAL:
- return "="; //$NON-NLS-1$
- case PLUS_EQUAL:
- return "+="; //$NON-NLS-1$
- case MINUS_EQUAL:
- return "-="; //$NON-NLS-1$
- case STAR_EQUAL:
- return "*="; //$NON-NLS-1$
- case SLASH_EQUAL:
- return "/="; //$NON-NLS-1$
- case AND_EQUAL:
- return "<="; //$NON-NLS-1$
- case OR_EQUAL:
- return "|=";//$NON-NLS-1$
- case XOR_EQUAL:
- return "^=";//$NON-NLS-1$
- case DOT_EQUAL:
- return ".="; //$NON-NLS-1$
- case REM_EQUAL:
- return "%="; //$NON-NLS-1$
- case TILDE_EQUAL:
- return "~="; //$NON-NLS-1$
- case LSHIFT_EQUAL:
- return "<<="; //$NON-NLS-1$
- case RSIGNEDSHIFT_EQUAL:
- return ">>="; //$NON-NLS-1$
- }
- return " unknown operator ";//$NON-NLS-1$
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final String varName = variableName.toStringExpression();
- final String init = initializer.toStringExpression();
- final String operatorString = operatorToString();
- final StringBuffer buff = new StringBuffer(varName.length() + operatorString.length() + init.length() + 2);
- buff.append(varName);
- buff.append(" ");//$NON-NLS-1$
- buff.append(operatorString);
- buff.append(" ");//$NON-NLS-1$
- buff.append(init);
- return buff.toString();
- }
-
-
- /**
- * Get the variables from outside (parameters, globals ...)
- */
- public void getOutsideVariable(final List list) {
- }
-
- /**
- * get the modified variables.
- */
- public void getModifiedVariable(final List list) {
- variableName.getUsedVariable(list);
- initializer.getModifiedVariable(list);
- }
-
- /**
- * Get the variables used.
- */
- public void getUsedVariable(final List list) {
- initializer.getUsedVariable(list);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
-
-/**
- * A variable.
- * It could be a simple variable, or contains another variable.
- * @author Matthieu Casanova
- */
-public final class Variable extends AbstractVariable {
-
- /** The name of the variable. */
- private String name;
-
- /** A variable inside ($$varname). */
- private AbstractVariable variable;
-
- /** the variable is defined like this ${expression} */
- private Expression expression;
-
- private static final String _GET = "_GET";
- private static final String _POST = "_POST";
- private static final String _REQUEST = "_REQUEST";
- private static final String _SERVER = "_SERVER";
- private static final String _SESSION = "_SESSION";
- private static final String _this = "this";
- private static final String GLOBALS = "GLOBALS";
- private static final String _COOKIE = "_COOKIE";
- private static final String _FILES = "_FILES";
- private static final String _ENV = "_ENV";
-
- /** Here is an array of all superglobals variables and the special "this". */
- public static final String[] SPECIAL_VARS = {_GET,
- _POST,
- _REQUEST,
- _SERVER,
- _SESSION,
- _this,
- GLOBALS,
- _COOKIE,
- _FILES,
- _ENV};
-
- /**
- * Create a new simple variable.
- * @param name the name
- * @param sourceStart the starting position
- * @param sourceEnd the ending position
- */
- public Variable(final String name,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.name = name;
- }
-
- /**
- * Create a special variable ($$toto for example).
- * @param variable the variable contained
- * @param sourceStart the starting position
- * @param sourceEnd the ending position
- */
- public Variable(final AbstractVariable variable,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.variable = variable;
- }
-
- /**
- * Create a special variable ($$toto for example).
- * @param expression the variable contained
- * @param sourceStart the starting position
- * @param sourceEnd the ending position
- */
- public Variable(final Expression expression,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.expression = expression;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- return '$' + getName();
- }
-
- public String getName() {
- if (name != null) {
- return name;
- }
- if (variable != null) {
- return variable.toStringExpression();
- }
- return '{' + expression.toStringExpression() + '}';
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- */
- public void getOutsideVariable(final List list) {
- }
-
- /**
- * get the modified variables.
- */
- public void getModifiedVariable(final List list) {
- }
-
- /**
- * Get the variables used.
- */
- public void getUsedVariable(final List list) {
- final String varName;
- if (name != null) {
- varName = name;
- } else if (variable != null) {
- varName = variable.getName();
- } else {
- varName = expression.toStringExpression();//todo : do a better thing like evaluate this ??
- }
- if (!arrayContains(SPECIAL_VARS, name)) {
- list.add(new VariableUsage(varName, sourceStart));
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.Position;
-
-import java.util.List;
-
-/**
- * A variable declaration.
- *
- * @author Matthieu Casanova
- */
-public class VariableDeclaration extends Expression implements Outlineable {
-
- public static final int EQUAL = 0;
- public static final int PLUS_EQUAL = 1;
- public static final int MINUS_EQUAL = 2;
- public static final int STAR_EQUAL = 3;
- public static final int SLASH_EQUAL = 4;
- public static final int AND_EQUAL = 5;
- public static final int OR_EQUAL = 6;
- public static final int XOR_EQUAL = 7;
- public static final int DOT_EQUAL = 8;
- public static final int REM_EQUAL = 9;
- public static final int TILDE_EQUAL = 10;
- public static final int LSHIFT_EQUAL = 11;
- public static final int RSIGNEDSHIFT_EQUAL = 12;
-
- protected final AbstractVariable variable;
-
- /** The value for variable initialization. */
- public Expression initialization;
-
- private Object parent;
- protected boolean reference;
-
- private Position position;
-
- private int operator;
-
- /**
- * Create a variable.
- *
- * @param variable the name of the variable
- * @param initialization the initialization
- * @param operator the assign operator
- * @param sourceStart the start point
- */
- public VariableDeclaration(final Object parent,
- final AbstractVariable variable,
- final Expression initialization,
- final int operator,
- final int sourceStart) {
- super(sourceStart, initialization.sourceEnd);
- this.initialization = initialization;
- this.variable = variable;
- this.operator = operator;
- this.parent = parent;
- position = new Position(sourceStart, sourceEnd);
- }
-
- /**
- * Create a variable.
- *
- * @param variable a variable (in case of $$variablename)
- * @param sourceStart the start point
- */
- public VariableDeclaration(final Object parent,
- final AbstractVariable variable,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.variable = variable;
- this.parent = parent;
- position = new Position(sourceStart, sourceEnd);
- }
-
- public final void setReference(final boolean reference) {
- this.reference = reference;
- }
-
- /**
- * Create a variable.
- *
- * @param initialization the initialization
- * @param variable a variable (in case of $$variablename)
- * @param sourceStart the start point
- */
- public VariableDeclaration(final AbstractVariable variable,
- final Expression initialization,
- final int operator,
- final int sourceStart) {
- super(sourceStart, initialization.sourceEnd);
- this.variable = variable;
- this.initialization = initialization;
- this.operator = operator;
- }
-
- /**
- * Create a variable.
- *
- * @param variable a variable (in case of $$variablename)
- * @param sourceStart the start point
- */
- public VariableDeclaration(final AbstractVariable variable,
- final int sourceStart) {
- super(sourceStart, variable.sourceEnd);
- this.variable = variable;
- }
-
- /**
- * Return the operator as String.
- *
- * @return the operator
- */
- private String operatorToString() {
- switch (operator) {
- case EQUAL:
- return "="; //$NON-NLS-1$
- case PLUS_EQUAL:
- return "+="; //$NON-NLS-1$
- case MINUS_EQUAL:
- return "-="; //$NON-NLS-1$
- case STAR_EQUAL:
- return "*="; //$NON-NLS-1$
- case SLASH_EQUAL:
- return "/="; //$NON-NLS-1$
- case AND_EQUAL:
- return "<="; //$NON-NLS-1$
- case OR_EQUAL:
- return "|=";//$NON-NLS-1$
- case XOR_EQUAL:
- return "^=";//$NON-NLS-1$
- case DOT_EQUAL:
- return ".="; //$NON-NLS-1$
- case REM_EQUAL:
- return "%="; //$NON-NLS-1$
- case TILDE_EQUAL:
- return "~="; //$NON-NLS-1$
- case LSHIFT_EQUAL:
- return "<<="; //$NON-NLS-1$
- case RSIGNEDSHIFT_EQUAL:
- return ">>="; //$NON-NLS-1$
- }
- return " unknown operator ";//$NON-NLS-1$
- }
-
- /**
- * Return the variable into String.
- *
- * @return a String
- */
- public String toStringExpression() {
- final String variableString = variable.toStringExpression();
- if (initialization == null) {
- if (reference) return '&' + variableString; else return variableString;
- } else {
- final String operatorString = operatorToString();
- final String initString = initialization.toStringExpression();
- final StringBuffer buff = new StringBuffer(variableString.length() +
- operatorString.length() +
- initString.length() +
- 1);
- buff.append(variableString);
- buff.append(operatorString); //$NON-NLS-1$
- buff.append(initString);
- return buff.toString();
- }
- }
-
- public final Object getParent() {
- return parent;
- }
-
- public final String toString() {
- return toStringExpression();
- }
-
- /**
- * Get the image of a variable.
- *
- * @return the image that represents a php variable
- */
- public final ImageDescriptor getImage() {
- return PHPUiImages.DESC_VAR;
- }
-
- public final Position getPosition() {
- return position;
- }
-
- /**
- * Get the name of the field as String.
- *
- * @return the name of the String
- */
- public final String name() {
- return variable.getName();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- */
- public final void getOutsideVariable(final List list) {
- }
-
- /**
- * get the modified variables.
- */
- public final void getModifiedVariable(final List list) {
- variable.getUsedVariable(list);
- if (initialization != null) {
- initialization.getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- */
- public final void getUsedVariable(final List list) {
- if (initialization != null) {
- initialization.getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import java.util.List;
-
-/**
- * A While statement.
- * @author Matthieu Casanova
- */
-public final class WhileStatement extends Statement {
-
- /** The condition expression. */
- private final Expression condition;
- /** The action of the while. (it could be a block) */
- private final Statement action;
-
- /**
- * Create a While statement.
- * @param condition the condition
- * @param action the action
- * @param sourceStart the starting offset
- * @param sourceEnd the ending offset
- */
- public WhileStatement(final Expression condition,
- final Statement action,
- final int sourceStart,
- final int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.condition = condition;
- this.action = action;
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(final int tab) {
- final String s = tabString(tab);
- final StringBuffer buff = new StringBuffer(s).append("while ("); //$NON-NLS-1$
- buff.append(condition.toStringExpression()).append(")"); //$NON-NLS-1$
- if (action == null) {
- buff.append(" {} ;"); //$NON-NLS-1$
- } else {
- buff.append("\n").append(action.toString(tab + 1)); //$NON-NLS-1$
- }
- return buff.toString();
- }
-
- /**
- * Get the variables from outside (parameters, globals ...)
- *
- * @param list the list where we will put variables
- */
- public void getOutsideVariable(final List list) {
- condition.getOutsideVariable(list); // todo: check if unuseful
- if (action != null) {
- action.getOutsideVariable(list);
- }
- }
-
- /**
- * get the modified variables.
- *
- * @param list the list where we will put variables
- */
- public void getModifiedVariable(final List list) {
- condition.getModifiedVariable(list);
- if (action != null) {
- action.getModifiedVariable(list);
- }
- }
-
- /**
- * Get the variables used.
- *
- * @param list the list where we will put variables
- */
- public void getUsedVariable(final List list) {
- condition.getUsedVariable(list);
- if (action != null) {
- action.getUsedVariable(list);
- }
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast.declarations;
-
-/**
- * A variable usage.
- * This describe a variable declaration in a php document and his starting offset
- * @author Matthieu Casanova
- */
-public final class VariableUsage {
-
- /** the variable name. */
- private final String name;
-
- /** where the variable is declared. */
- private final int startOffset;
-
- /**
- * create a VariableUsage.
- * @param name the name of the variable
- * @param startOffset the offset
- */
- public VariableUsage(final String name, final int startOffset) {
- this.name = name;
- this.startOffset = startOffset;
- }
-
- public String toString() {
- return name + ' ' + startOffset;
- }
-
- /**
- * Get the name of the variable.
- * @return the name if the variable
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get the starting offset.
- * @return the starting offset
- */
- public int getStartOffset() {
- return startOffset;
- }
-
- public boolean equals(final Object object) {
- return name.equals(object);
- }
-
- public int hashCode() {
- return name.hashCode();
- }
-}
import java.util.Iterator;
import java.util.List;
-import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
public class NLSLine {
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-/**
- * A class declaration.
- * @author khartlage
- */
-public class PHPClassDeclaration extends PHPSegmentWithChildren {
-
- /**
- * Create a class declaration.
- * @param parent the parent object (it should be a php class)
- * @param name the name of the class
- * @param index where the class is in the file
- */
- public PHPClassDeclaration(Object parent, String name, int index) {
- super(parent, name, index);
- }
-
- /**
- * Get the image of a class.
- * @return the image that represents a php class
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_CLASS;
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * A function declaration.
- * @author khartlage
- */
-public class PHPFunctionDeclaration extends PHPSegmentWithChildren {
-
- /** The parameters of the function. */
- private final Hashtable parameters;
-
- /** The parameters of the function. */
- private final Hashtable declaredVariables;
-
- /**
- * A String representation of the function (it's generated once because it needs to iterate
- * a hashtable == long.
- */
- private String stringRepresentation;
-
- /**
- * Create a function declaration.
- * @param parent the parent object (it should be a php class)
- * @param name the name of the function
- * @param index where the function is in the file
- */
- public PHPFunctionDeclaration(Object parent, String name, int index) {
- super(parent, name, index);
- parameters = null;
- declaredVariables = null;
- }
-
- /**
- * Create a function declaration.
- * @param parent the parent object (it should be a php class)
- * @param name the name of the function
- * @param index where the function is in the file
- * @param parameters the list of parameters (it should contains only PHPVar)
- */
- public PHPFunctionDeclaration(Object parent, String name, int index, Hashtable parameters) {
- super(parent, name, index);
- this.parameters = parameters;
- declaredVariables = (Hashtable) parameters.clone();
- createStringView();
- }
-
- /**
- * Get the image of a class.
- * @return the image that represents a php class
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_FUN;
- }
-
- /**
- * Return the string representation of the function.
- * @return the string representation of the function
- */
- public String toString() {
- if (parameters == null) {
- return super.toString();
- }
- return stringRepresentation;
- }
-
- /**
- * Create the String representation of the function.
- */
- private void createStringView() {
- StringBuffer buff = new StringBuffer(name).append("(");
- Enumeration vars = parameters.elements();
- boolean first = false;
- while (vars.hasMoreElements()) {
- PHPVarDeclaration o = (PHPVarDeclaration) vars.nextElement();
- if (first) {
- buff.append(",");
- } else {
- first = true;
- }
- buff.append(o.toString());
- }
- buff.append(")");
- stringRepresentation = buff.toString();
- }
-
- /**
- * Return a parameter of the function
- * @param parameterName the name of the parameter
- * @return it will return the PHPVarDeclaration of the parameter asked, or null
- */
- public PHPVarDeclaration getParameter(String parameterName) {
- return (PHPVarDeclaration) parameters.get(parameterName);
- }
-
- /**
- * Return all parameters of the function.
- * @return a hashtable containing all PHPVarDeclaration
- */
- public Hashtable getParameters() {
- return parameters;
- }
-
- /**
- * Return a variable of the function
- * @param variableName the name of the parameter
- * @return it will return the PHPVarDeclaration of the parameter asked, or null
- */
- public PHPVarDeclaration getVariable(String variableName) {
- return (PHPVarDeclaration) declaredVariables.get(variableName);
- }
-
- /**
- * Return all declared variables of the function.
- * @return a hashtable containing all PHPVarDeclaration
- */
- public Hashtable getVariables() {
- return declaredVariables;
- }
-
- public Object addVariable(PHPVarDeclaration var) {
- return declaredVariables.put(var.getVariable().getName(),var);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * A require, require_once, include or include_once declaration strongly inspired by the PHPFunctionDeclaration of Khartlage (:.
- * @author khartlage, Matthieu Casanova
- */
-public class PHPGlobalDeclaration extends PHPSegment {
-
- /** What is required/included. */
- private String value;
- /**
- * Create an include declaration.
- * @param parent the parent object (it should be a php class or function)
- * @param name it should be require, require_once, include or include_once
- * @param index where the keyword is in the file
- * @param value what is included
- */
- public PHPGlobalDeclaration(Object parent, String name, int index, String value) {
- super(parent, name, index);
- this.value = value;
- }
-
- /**
- * Create an include declaration.
- * @param parent the parent object (it should be a php class or function)
- * @param name it should be require, require_once, include or include_once
- * @param index where the keyword is in the file
- */
- public PHPGlobalDeclaration(Object parent, String name, int index) {
- this(parent, name, index,null);
- }
-
- /**
- * Get the image of a variable.
- * @return the image that represents a php variable
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_INC;
- }
-
- public String toString() {
- return name + " : " + value;
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import java.util.TreeSet;
-
-/**
- *
- * @author khartlage
- */
-public class PHPOutlineInfo {
- TreeSet fVariables;
- OutlineableWithChildren fDeclarations;
-
- public PHPOutlineInfo(Object parent) {
- fVariables = new TreeSet();
- fDeclarations = new PHPClassDeclaration(parent, "_root", 1);
- }
-
- public PHPOutlineInfo(Object parent, OutlineableWithChildren phpDocument) {
- fVariables = new TreeSet();
- fDeclarations = phpDocument;
- }
-
- public TreeSet getVariables() {
- return fVariables;
- }
-
- public OutlineableWithChildren getDeclarations() {
- return fDeclarations;
- }
-
- public boolean add(OutlineableWithChildren o) {
- return fDeclarations.add(o);
- }
-
- public boolean addVariable(String variable) {
- return fVariables.add(variable);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * A require, require_once, include or include_once declaration strongly inspired by the PHPFunctionDeclaration of Khartlage (:.
- * @author khartlage, Matthieu Casanova
- */
-public class PHPReqIncDeclaration extends PHPSegment {
-
- /** What is required/included. */
- private String value;
- /**
- * Create an include declaration.
- * @param parent the parent object (it should be a php class or function)
- * @param name it should be require, require_once, include or include_once
- * @param index where the keyword is in the file
- * @param value what is included
- */
- public PHPReqIncDeclaration(Object parent, String name, int index, String value) {
- super(parent, name, index);
- this.value = value;
- }
-
- /**
- * Create an include declaration.
- * @param parent the parent object (it should be a php class or function)
- * @param name it should be require, require_once, include or include_once
- * @param index where the keyword is in the file
- */
- public PHPReqIncDeclaration(Object parent, String name, int index) {
- this(parent, name, index,null);
- }
-
- /**
- * Get the image of a variable.
- * @return the image that represents a php variable
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_INC;
- }
-
- public String toString() {
- return name + " : " + value;
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import org.eclipse.jface.text.Position;
-
-/**
- *
- * @author khartlage
- */
-public abstract class PHPSegment implements Outlineable {
- protected String name;
- private Position position;
- private Object parent;
-
- public PHPSegment(Object parent, String name, int index) {
- this.parent = parent;
- this.name = name;
- this.position = new Position(index, name.length());
- }
-
- /**
- * Return the name of the segment.
- * @return the name of the segment
- */
- public String getName() {
- return name;
- }
-
- public String toString() {
- return name;
- }
-
- public Position getPosition() {
- return position;
- }
-
- public Object getParent() {
- return parent;
- }
-
-};
\ No newline at end of file
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * An abstract PHPSegment that can have children.
- * @author khartlage, Matthieu Casanova
- */
-public abstract class PHPSegmentWithChildren extends PHPSegment implements OutlineableWithChildren {
- private ArrayList children;
-
- /**
- * Create a PHPSegment that can have children (class or functions).
- * @param parent the parent object (it should be a php class)
- * @param name the name of the function
- * @param index where the function is in the file
- */
- public PHPSegmentWithChildren(Object parent, String name, int index) {
- super(parent, name, index);
- children = new ArrayList();
- }
-
- public List getList( ) {
- return children;
- }
-
- /**
- * Appends the specified PHPSegment declaration
- *
- * @param o function declaration to be appended to this list.
- * @return <tt>true</tt> (as per the general contract of Collection.add).
- */
- public boolean add(Outlineable o) {
- return children.add(o);
- }
-
- /**
- * Returns the PHPSegment declaration at the specified position in this list.
- *
- * @param index index of function declaration to return.
- * @return the function declaration at the specified position in this list.
- * @throws java.lang.IndexOutOfBoundsException if index is out of range <tt>(index
- * < 0 || index >= size())</tt>.
- */
- public Outlineable get(int index) {
- return (Outlineable) children.get(index);
- }
-
- /**
- * Returns the number of declarations in this list.
- *
- * @return the number of declarations in this list.
- */
- public int size() {
- return children.size();
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.parser;
-
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import test.PHPVar;
-
-/**
- * A php variable declaration strongly inspired by the PHPFunctionDeclaration of Khartlage (:.
- * @author khartlage, Matthieu Casanova
- */
-public class PHPVarDeclaration extends PHPSegment {
-
- /** A PHPVar. */
- private final PHPVar variable;
- /**
- * Create a php variable declaration.
- * @param parent the parent object (it should be a php class)
- * @param name the name of the variable
- * @param index where the variable is in the file
- * @param value the value
- */
- public PHPVarDeclaration(Object parent, String name, int index, String value) {
- super(parent, name, index);
- variable = new PHPVar(name,value);
- }
-
- /**
- * Create a php variable declaration.
- * @param parent the parent object (it should be a php class)
- * @param name the name of the variable
- * @param index where the variable is in the file
- */
- public PHPVarDeclaration(Object parent, String name, int index) {
- this(parent, name, index,null);
- }
-
- /**
- * Get the image of a variable.
- * @return the image that represents a php variable
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_VAR;
- }
-
- /**
- * Get the PHPVar.
- * @return a phpvar object
- */
- public PHPVar getVariable() {
- return variable;
- }
-
- public String toString() {
- return variable.toString();
- }
-}
import net.sourceforge.phpdt.core.compiler.IScanner;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
import net.sourceforge.phpdt.core.compiler.InvalidInputException;
-import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
+import net.sourceforge.phpeclipse.internal.compiler.ast.StringLiteral;
+
+
public class Scanner implements IScanner, ITerminalSymbols {
/*
* APIs ares - getNextToken() which return the current type of the token
--- /dev/null
+package net.sourceforge.phpeclipse.actions;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.MessageFormat;
+import java.util.Hashtable;
+
+//import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
+import net.sourceforge.phpdt.internal.ui.util.StringUtil;
+import net.sourceforge.phpdt.ui.PreferenceConstants;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.views.PHPConsole;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.texteditor.MarkerUtilities;
+
+/**
+ * Calls the external parser and generates problem markers if necessary
+ */
+public class ExternalPHPParser {
+ private final static String PROBLEM_ID = "net.sourceforge.phpeclipse.problem";
+ // strings for external parser call
+ private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$
+ private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$
+ public static final int ERROR = 2;
+ public static final int WARNING = 1;
+ public static final int INFO = 0;
+ public static final int TASK = 3;
+ // TODO design error? Analyze why fileToParse must be static ???
+ final protected IFile fFileToParse;
+
+ public ExternalPHPParser(IFile file) {
+ fFileToParse = file;
+ }
+ /**
+ * Call the php parse command ( php -l -f <filename> ) and create
+ * markers according to the external parser output.
+ *
+ * @param file
+ * the file that will be parsed
+ */
+ public void phpExternalParse() {
+ //IFile file = (IFile) resource;
+ // final IPath path = file.getFullPath();
+ final IPreferenceStore store = PHPeclipsePlugin.getDefault()
+ .getPreferenceStore();
+ final String filename = fFileToParse.getLocation().toString();
+
+ final String[] arguments = {filename};
+ final MessageFormat form = new MessageFormat(store
+ .getString(PHPeclipsePlugin.EXTERNAL_PARSER_PREF));
+ final String command = form.format(arguments);
+
+ final String parserResult = getParserOutput(command,
+ "External parser: ");
+
+ try {
+ // parse the buffer to find the errors and warnings
+ createMarkers(parserResult, fFileToParse);
+ } catch (CoreException e) {
+ }
+ }
+
+ /**
+ * Create markers according to the external parser output.
+ *
+ * @param output
+ * the external parser output
+ * @param file
+ * the file that was parsed.
+ */
+ protected void createMarkers(final String output, final IFile file)
+ throws CoreException {
+ // delete all markers
+ file.deleteMarkers(PROBLEM_ID, false, 0);
+
+ int indx = 0;
+ int brIndx;
+ boolean flag = true;
+ while ((brIndx = output.indexOf("<br />", indx)) != -1) {
+ // newer php error output (tested with 4.2.3)
+ scanLine(output, file, indx, brIndx);
+ indx = brIndx + 6;
+ flag = false;
+ }
+ if (flag) {
+ while ((brIndx = output.indexOf("<br>", indx)) != -1) {
+ // older php error output (tested with 4.2.3)
+ scanLine(output, file, indx, brIndx);
+ indx = brIndx + 4;
+ }
+ }
+ }
+
+ private void scanLine(final String output, final IFile file,
+ final int indx, final int brIndx) throws CoreException {
+ String current;
+ // String outLineNumberString; never used
+ final StringBuffer lineNumberBuffer = new StringBuffer(10);
+ char ch;
+ current = output.substring(indx, brIndx);
+
+ if (current.indexOf(PARSE_WARNING_STRING) != -1
+ || current.indexOf(PARSE_ERROR_STRING) != -1) {
+ final int onLine = current.indexOf("on line <b>");
+ if (onLine != -1) {
+ lineNumberBuffer.delete(0, lineNumberBuffer.length());
+ for (int i = onLine; i < current.length(); i++) {
+ ch = current.charAt(i);
+ if ('0' <= ch && '9' >= ch) {
+ lineNumberBuffer.append(ch);
+ }
+ }
+
+ final int lineNumber = Integer.parseInt(lineNumberBuffer
+ .toString());
+
+ final Hashtable attributes = new Hashtable();
+
+ current = StringUtil.replaceAll(current, "\n", "");
+ current = StringUtil.replaceAll(current, "<b>", "");
+ current = StringUtil.replaceAll(current, "</b>", "");
+ MarkerUtilities.setMessage(attributes, current);
+
+ if (current.indexOf(PARSE_ERROR_STRING) != -1)
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_ERROR));
+ else if (current.indexOf(PARSE_WARNING_STRING) != -1)
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_WARNING));
+ else
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ MarkerUtilities.setLineNumber(attributes, lineNumber);
+ MarkerUtilities.createMarker(file, attributes, PROBLEM_ID);
+ }
+ }
+ }
+
+ /**
+ * This will set a marker.
+ *
+ * @param file
+ * the file that generated the marker
+ * @param message
+ * the message
+ * @param charStart
+ * the starting character
+ * @param charEnd
+ * the end character
+ * @param errorLevel
+ * the error level ({@link ExternalPHPParser#ERROR},
+ * {@link ExternalPHPParser#INFO},
+ * {@link ExternalPHPParser#WARNING}),
+ * {@link ExternalPHPParser#TASK})
+ * @throws CoreException
+ * an exception throwed by the MarkerUtilities
+ */
+ private void setMarker(final IFile file, final String message,
+ final int charStart, final int charEnd, final int errorLevel)
+ throws CoreException {
+ if (file != null) {
+ final Hashtable attributes = new Hashtable();
+ MarkerUtilities.setMessage(attributes, message);
+ switch (errorLevel) {
+ case ERROR :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_ERROR));
+ break;
+ case WARNING :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_WARNING));
+ break;
+ case INFO :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ break;
+ case TASK :
+ attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK));
+ break;
+ }
+ MarkerUtilities.setCharStart(attributes, charStart);
+ MarkerUtilities.setCharEnd(attributes, charEnd);
+ MarkerUtilities.createMarker(file, attributes, PROBLEM_ID);
+ }
+ }
+
+ /**
+ * This will set a marker.
+ *
+ * @param file
+ * the file that generated the marker
+ * @param message
+ * the message
+ * @param line
+ * the line number
+ * @param errorLevel
+ * the error level ({@link ExternalPHPParser#ERROR},
+ * {@link ExternalPHPParser#INFO},
+ * {@link ExternalPHPParser#WARNING})
+ * @throws CoreException
+ * an exception throwed by the MarkerUtilities
+ */
+ private void setMarker(final IFile file, final String message,
+ final int line, final int errorLevel, final String location)
+ throws CoreException {
+ if (file != null) {
+ String markerKind = PROBLEM_ID;
+ final Hashtable attributes = new Hashtable();
+ MarkerUtilities.setMessage(attributes, message);
+ switch (errorLevel) {
+ case ERROR :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_ERROR));
+ break;
+ case WARNING :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_WARNING));
+ break;
+ case INFO :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ break;
+ case TASK :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ markerKind = IMarker.TASK;
+ break;
+ }
+ attributes.put(IMarker.LOCATION, location);
+ MarkerUtilities.setLineNumber(attributes, line);
+ MarkerUtilities.createMarker(file, attributes, markerKind);
+ }
+ }
+
+ /**
+ * This will set a marker.
+ *
+ * @param message
+ * the message
+ * @param charStart
+ * the starting character
+ * @param charEnd
+ * the end character
+ * @param errorLevel
+ * the error level ({@link ExternalPHPParser#ERROR},
+ * {@link ExternalPHPParser#INFO},
+ * {@link ExternalPHPParser#WARNING})
+ * @throws CoreException
+ * an exception throwed by the MarkerUtilities
+ */
+ private void setMarker(final String message, final int charStart,
+ final int charEnd, final int errorLevel, final String location)
+ throws CoreException {
+ if (fFileToParse != null) {
+ setMarker(fFileToParse, message, charStart, charEnd, errorLevel,
+ location);
+ }
+ }
+
+ /**
+ * This will set a marker.
+ *
+ * @param file
+ * the file that generated the marker
+ * @param message
+ * the message
+ * @param charStart
+ * the starting character
+ * @param charEnd
+ * the end character
+ * @param errorLevel
+ * the error level ({@link ExternalPHPParser#ERROR},
+ * {@link ExternalPHPParser#INFO},
+ * {@link ExternalPHPParser#WARNING})
+ * @param location
+ * the location of the error
+ * @throws CoreException
+ * an exception throwed by the MarkerUtilities
+ */
+ private void setMarker(final IFile file, final String message,
+ final int charStart, final int charEnd, final int errorLevel,
+ final String location) throws CoreException {
+ if (file != null) {
+ final Hashtable attributes = new Hashtable();
+ MarkerUtilities.setMessage(attributes, message);
+ switch (errorLevel) {
+ case ERROR :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_ERROR));
+ break;
+ case WARNING :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_WARNING));
+ break;
+ case INFO :
+ attributes.put(IMarker.SEVERITY, new Integer(
+ IMarker.SEVERITY_INFO));
+ break;
+ case TASK :
+ attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK));
+ break;
+ }
+ attributes.put(IMarker.LOCATION, location);
+ MarkerUtilities.setCharStart(attributes, charStart);
+ MarkerUtilities.setCharEnd(attributes, charEnd);
+ MarkerUtilities.createMarker(file, attributes, PROBLEM_ID); //IMarker.PROBLEM);
+ }
+ }
+
+ private String getParserOutput(String command, String consoleMessage) {
+ try {
+ PHPConsole console = null;
+ try {
+ console = PHPConsole.getInstance();
+ if (console != null) {
+ console.write(consoleMessage + command + "\n");
+ }
+ } catch (Throwable th) {
+
+ }
+
+ Runtime runtime = Runtime.getRuntime();
+
+ // runs the command
+ Process p = runtime.exec(command);
+
+ // gets the input stream to have the post-compile-time information
+ InputStream stream = p.getInputStream();
+
+ // get the string from Stream
+ String consoleOutput = PHPConsole.getStringFromStream(stream);
+
+ // prints out the information
+ if (console != null) {
+ console.write(consoleOutput);
+ }
+ return consoleOutput;
+
+ } catch (IOException e) {
+ MessageDialog
+ .openInformation(null, "IOException: ", e.getMessage());
+ }
+ return "";
+ }
+}
\ No newline at end of file
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
-import test.PHPParserSuperclass;
public class PHPExternalParserAction implements IObjectActionDelegate {
// check if it's a file resource
switch (resource.getType()) {
-
+
case IResource.FILE :
// single file:
- IFile file = (IFile) resource;
- PHPParserSuperclass.phpExternalParse(file);
+ ExternalPHPParser parser = new ExternalPHPParser((IFile)resource);
+ parser.phpExternalParse();
}
}
}
**********************************************************************/
package net.sourceforge.phpeclipse.actions;
-import java.io.IOException;
-import java.io.InputStream;
import java.text.MessageFormat;
import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil;
store.getBoolean(PHPeclipsePlugin.APACHE_START_BACKGROUND));
}
- // public static void execute(String command, String consoleMessage) {
- // // MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command);
- // try {
- // PHPConsole console = PHPConsole.getInstance();
- // console.write(consoleMessage + command + "\n");
- // Runtime runtime = Runtime.getRuntime();
- //
- // // runs the command
- // Process p = runtime.exec(command);
- //
- // if (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PHPeclipsePlugin.SHOW_OUTPUT_IN_CONSOLE) == true) {
- //
- // OutputThread out = new OutputThread(p.getInputStream(), console);
- // OutputThread err = new OutputThread(p.getErrorStream(), console);
- // out.start();
- // err.start();
- //
- // }
- //
- // } catch (IOException e) {
- //
- // System.err.println("Problem");
- // e.printStackTrace();
- //
- // }
- //
- // }
-
/**
* Executes an external progam and saves the LaunchConfiguration under external tools
* @param command external tools command name
console.write(consoleMessage + "\n");
ExternalToolsUtil.execute(command, executable, arguments, background);
- // MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command);
- // try {
- // PHPConsole console = PHPConsole.getInstance();
- // console.write(consoleMessage + command + "\n");
- //
- // ExternalToolsUtil.execute()
- // Runtime runtime = Runtime.getRuntime();
- //
- // // runs the command
- // Process p = runtime.exec(command);
- //
- // // gets the input stream to have the post-compile-time information
- // InputStream stream = p.getInputStream();
- //
- // // get the string from Stream
- // String consoleOutput = PHPConsole.getStringFromStream(stream);
- //
- // // prints out the information
- // console.write(consoleOutput);
- // return consoleOutput;
- //
- // } catch (IOException e) {
- //
- // System.err.println("Problem");
- // e.printStackTrace();
- //
- // }
- // return "";
- }
- public static String getParserOutput(String command, String consoleMessage) {
- // MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command);
- try {
- PHPConsole console = null;
- try {
- console = PHPConsole.getInstance();
- if (console != null) {
- console.write(consoleMessage + command + "\n");
- }
- } catch (Throwable th) {
-
- }
-
- Runtime runtime = Runtime.getRuntime();
-
- // runs the command
- Process p = runtime.exec(command);
-
- // gets the input stream to have the post-compile-time information
- InputStream stream = p.getInputStream();
-
- // get the string from Stream
- String consoleOutput = PHPConsole.getStringFromStream(stream);
-
- // prints out the information
- if (console != null) {
- console.write(consoleOutput);
- }
- return consoleOutput;
-
- } catch (IOException e) {
-
- System.err.println("Problem");
- e.printStackTrace();
-
- }
- return "";
}
-
+
public void selectionChanged(IAction action, ISelection selection) {
}
}
- // static class OutputThread extends Thread {
- // InputStream fInputStream;
- // PHPConsole console;
- //
- // OutputThread(InputStream inputStream, PHPConsole console) {
- // this.fInputStream = inputStream;
- // this.console = console;
- // }
- //
- // public void run() {
- // try {
- // BufferedReader bin = new BufferedReader(new InputStreamReader(fInputStream));
- //
- // String bufferRow;
- // while ((bufferRow = bin.readLine()) != null) {
- //
- // // prints out the information
- // console.write( bufferRow );
- //
- // }
- // bin.close();
- //
- // } catch (IOException e) {
- // MessageDialog.openError(null, "Error in output", e.toString());
- // } finally {
- //
- // }
- // }
- // }
-
}
+++ /dev/null
-package net.sourceforge.phpeclipse.phpeditor;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
- Klaus Hartlage - www.eclipseproject.de
-**********************************************************************/
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.TreeSet;
-
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
-import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
-import net.sourceforge.phpdt.internal.ui.viewsupport.ImageDescriptorRegistry;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.BadPositionCategoryException;
-import org.eclipse.jface.text.DefaultPositionUpdater;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IPositionUpdater;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-import test.PHPParserManager;
-import test.PHPParserSuperclass;
-
-/**
- * A content outline page which always represents the functions of the
- * connected PHPEditor.
- */
-public class PHPContentOutlinePage extends AbstractContentOutlinePage {
- private static final String ERROR = "error"; //$NON-NLS-1$
- private static final String WARNING = "warning"; //$NON-NLS-1$
-
- protected static class SegmentComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- if (o1 instanceof OutlineableWithChildren && !(o2 instanceof OutlineableWithChildren)) {
- return 1;
- }
- if (o2 instanceof OutlineableWithChildren && !(o1 instanceof OutlineableWithChildren)) {
- return -1;
- }
- return ((Outlineable) o1).toString().compareToIgnoreCase(((Outlineable) o2).toString());
- }
- }
-
- /**
- * Divides the editor's document into ten segments and provides elements for them.
- */
- protected class ContentProvider implements ITreeContentProvider {
-
- protected final static String SEGMENTS = "__php_segments"; //$NON-NLS-1$
- protected IPositionUpdater fPositionUpdater = new DefaultPositionUpdater(SEGMENTS);
- protected List fContent = new ArrayList(10);
- protected TreeSet fVariables = new TreeSet();
-
- // private String getIdentifier(String text, int firstIndex) {
- // int i = firstIndex;
- // char c;
- // int textLength = text.length();
- // StringBuffer identifier = new StringBuffer();
- // while (i < textLength) {
- // c = text.charAt(i++);
- // if (Scanner.isPHPIdentifierPart(c) || (c == '$')) {
- // identifier.append(c);
- // } else if ((i == firstIndex + 1) && (c == '$')) {
- // identifier.append(c);
- // } else {
- // return identifier.toString();
- // }
- // }
- // return null;
- // }
-
- protected void parse(IDocument document) {
-
- // int lines = document.getNumberOfLines();
- // int increment = Math.max(Math.round((float) (lines / 10)), 10);
-
- String name;
- int index;
- String text = document.get();
- PHPParserSuperclass parser = PHPParserManager.getParser(null);
-
- PHPOutlineInfo outlineInfo = parser.parseInfo(fInput, text);
- fVariables = outlineInfo.getVariables();
-
- OutlineableWithChildren declarations = outlineInfo.getDeclarations();
- Outlineable temp;
- for (int i = 0; i < declarations.size(); i++) {
- temp = declarations.get(i);
- fContent.add(temp);
- }
- Collections.sort(fContent, new SegmentComparator());
- }
-
- /*
- * @see IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (oldInput != null) {
- IDocument document = fDocumentProvider.getDocument(oldInput);
- if (document != null) {
- try {
- document.removePositionCategory(SEGMENTS);
- } catch (BadPositionCategoryException x) {
- }
- document.removePositionUpdater(fPositionUpdater);
- }
- }
-
- fContent.clear();
- fVariables.clear();
-
- if (newInput != null) {
- IDocument document = fDocumentProvider.getDocument(newInput);
- if (document != null) {
- document.addPositionCategory(SEGMENTS);
- document.addPositionUpdater(fPositionUpdater);
-
- parse(document);
- }
- }
- }
-
- /*
- * @see IContentProvider#dispose
- */
- public void dispose() {
- if (fContent != null) {
- fContent.clear();
- fContent = null;
- }
- if (fVariables != null) {
- fVariables.clear();
- fVariables = null;
- }
- }
-
- /*
- * @see IContentProvider#isDeleted(Object)
- */
- public boolean isDeleted(Object element) {
- return false;
- }
-
- /**
- * returns all PHP variables
- */
- public Object[] getVariables() {
- return fVariables.toArray();
- }
-
- /*
- * @see IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object element) {
- return fContent.toArray();
- }
-
- /*
- * @see ITreeContentProvider#hasChildren(Object)
- */
- public boolean hasChildren(Object element) {
- if (element instanceof OutlineableWithChildren) {
- return !((OutlineableWithChildren) element).getList().isEmpty();
- }
- return element == fInput;
- }
-
- /*
- * @see ITreeContentProvider#getParent(Object)
- */
- public Object getParent(Object element) {
- if (element instanceof Outlineable) {
- return ((Outlineable) element).getParent();
- }
- return null;
- }
-
- /*
- * @see ITreeContentProvider#getChildren(Object)
- */
- public Object[] getChildren(Object element) {
- if (element == fInput)
- return fContent.toArray();
- if (element instanceof OutlineableWithChildren)
- return ((OutlineableWithChildren) element).getList().toArray();
- return new Object[0];
- }
- };
-
- protected class OutlineLabelProvider extends LabelProvider {
- private ImageDescriptorRegistry fRegistry;
-
- public OutlineLabelProvider() {
- fRegistry = PHPeclipsePlugin.getImageDescriptorRegistry();
- }
- /**
- * The <code>LabelProvider</code> implementation of this
- * <code>ILabelProvider</code> method returns <code>null</code>. Subclasses may
- * override.
- */
- public Image getImage(Object element) {
- if (element instanceof Outlineable) {
- ImageDescriptor descriptor = ((Outlineable) element).getImage();
- return fRegistry.get(descriptor);
- }
- return null;
- }
- }
-
- protected IDocumentProvider fDocumentProvider;
- protected ITextEditor fTextEditor;
- protected PHPEditor fEditor;
- protected ContentProvider fContentProvider;
-
- /**
- * Creates a content outline page using the given provider and the given editor.
- */
- public PHPContentOutlinePage(IDocumentProvider provider, ITextEditor editor) {
- super();
- fContentProvider = null;
- fDocumentProvider = provider;
- fTextEditor = editor;
- if (editor instanceof PHPEditor)
- fEditor = (PHPEditor) editor;
- }
-
- /* (non-Javadoc)
- * Method declared on ContentOutlinePage
- */
- public void createControl(Composite parent) {
-
- super.createControl(parent);
-
- TreeViewer viewer = getTreeViewer();
-
- fContentProvider = new ContentProvider();
- viewer.setContentProvider(fContentProvider);
- viewer.setLabelProvider(new OutlineLabelProvider());
-
- viewer.addSelectionChangedListener(this);
-
- if (fInput != null)
- viewer.setInput(fInput);
- }
-
- /* (non-Javadoc)
- * Method declared on ContentOutlinePage
- */
- public void selectionChanged(SelectionChangedEvent event) {
-
- super.selectionChanged(event);
-
- ISelection selection = event.getSelection();
- if (selection.isEmpty())
- fTextEditor.resetHighlightRange();
- else {
- Outlineable segment = (Outlineable) ((IStructuredSelection) selection).getFirstElement();
- int start = segment.getPosition().getOffset();
- int length = segment.getPosition().getLength();
- try {
- fTextEditor.setHighlightRange(start, length, true);
- } catch (IllegalArgumentException x) {
- fTextEditor.resetHighlightRange();
- }
- }
- }
-
- public Object[] getVariables() {
- if (fContentProvider != null) {
- return fContentProvider.getVariables();
- }
- return null;
- }
- // public ContentProvider getContentProvider() {
- // return contentProvider;
- // }
-
-}
import net.sourceforge.phpdt.internal.compiler.util.Util;
import net.sourceforge.phpdt.internal.core.builder.PHPBuilder;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.actions.ExternalPHPParser;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction;
-import test.PHPParserManager;
-import test.PHPParserSuperclass;
+//import test.PHPParserManager;
/**
* ClassDeclaration that defines the action for parsing the current PHP file
// } catch (IOException e) {
// }
} else {
- PHPParserSuperclass.phpExternalParse(fileToParse);
+ ExternalPHPParser parser = new ExternalPHPParser(fileToParse);
+ parser.phpExternalParse();
}
}
// } catch (CoreException e) {
return null;
}
- /**
- * Create marker for the parse error
- */
- // protected void setMarker(String message, int lineNumber) throws CoreException {
- //
- // Hashtable attributes = new Hashtable();
- // MarkerUtilities.setMessage(attributes, message);
- // if (message.startsWith(ERROR))
- // attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- // else if (message.startsWith(WARNING))
- // attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- // else
- // attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- // MarkerUtilities.setLineNumber(attributes, lineNumber);
- // MarkerUtilities.createMarker(fileToParse, attributes, IMarker.PROBLEM);
- // }
-
- // private String getIdentifier(InputStream iStream, int c) {
- // // int i = 0;
- // // char c;
- // // int textLength = text.length();
- // StringBuffer identifier = new StringBuffer();
- // identifier.append((char) c);
- // try {
- // while ((c = iStream.read()) != (-1)) {
- // if (Scanner.isPHPIdentifierPart((char) c)) {
- // identifier.append((char) c);
- // // } else if ((i == 0) && (c == '$')) {
- // // identifier.append((char)c);
- // } else {
- // return identifier.toString();
- // }
- // // i++;
- // }
- // } catch (IOException e) {
- // }
- // return identifier.toString();
- // }
+
+
protected static void parse(IFile fileToParse) {
-
- // StringBuffer buf = new StringBuffer();
- // int c0;
- // try {
- // while ((c0 = iStream.read()) != (-1)) {
- // buf.append((char) c0);
- // }
- // } catch (IOException e) {
- // return;
- // }
- // String input = buf.toString();
-
InputStream stream = null;
char[] charArray;
try {
stream = new BufferedInputStream(fileToParse.getContents());
charArray = Util.getInputStreamAsCharArray(stream, -1, null);
- PHPParserSuperclass parser = PHPParserManager.getParser(fileToParse);
- parser.parse(new String(charArray));
+ ExternalPHPParser parser = new ExternalPHPParser(fileToParse);
+ parser.phpExternalParse();
} catch (CoreException e) {
} catch (IOException e) {
} finally {
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. PHPParser.java */
-package test;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import java.util.Hashtable;
-import java.util.ArrayList;
-import java.io.StringReader;
-import java.io.*;
-import java.text.MessageFormat;
-
-import net.sourceforge.phpeclipse.actions.PHPStartApacheAction;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpdt.internal.compiler.ast.*;
-import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
-import net.sourceforge.phpdt.internal.corext.Assert;
-
-/**
- * A new php parser.
- * This php parser is inspired by the Java 1.2 grammar example
- * given with JavaCC. You can get JavaCC at http://www.webgain.com
- * You can test the parser with the PHPParserTestCase2.java
- * @author Matthieu Casanova
- */
-public final class PHPParser extends PHPParserSuperclass implements PHPParserConstants {
-
-//todo : fix the variables names bug
-//todo : handle tilde operator
-
-
- /** The current segment. */
- private static OutlineableWithChildren currentSegment;
-
- private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$
- private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$
- static PHPOutlineInfo outlineInfo;
-
- /** The error level of the current ParseException. */
- private static int errorLevel = ERROR;
- /** The message of the current ParseException. If it's null it's because the parse exception wasn't handled */
- private static String errorMessage;
-
- private static int errorStart = -1;
- private static int errorEnd = -1;
- private static PHPDocument phpDocument;
-
- private static final String SYNTAX_ERROR_CHAR = "syntax error";
- /**
- * The point where html starts.
- * It will be used by the token manager to create HTMLCode objects
- */
- public static int htmlStart;
-
- //ast stack
- private final static int AstStackIncrement = 100;
- /** The stack of node. */
- private static AstNode[] nodes;
- /** The cursor in expression stack. */
- private static int nodePtr;
-
- public static final boolean PARSER_DEBUG = false;
-
- public final void setFileToParse(final IFile fileToParse) {
- PHPParser.fileToParse = fileToParse;
- }
-
- public PHPParser() {
- }
-
- public PHPParser(final IFile fileToParse) {
- this(new StringReader(""));
- PHPParser.fileToParse = fileToParse;
- }
-
- public final void phpParserTester(final String strEval) throws ParseException {
- final StringReader stream = new StringReader(strEval);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(new StringReader(strEval));
- init();
- phpDocument = new PHPDocument(null,"_root".toCharArray());
- currentSegment = phpDocument;
- outlineInfo = new PHPOutlineInfo(null, currentSegment);
- token_source.SwitchTo(PHPParserTokenManager.PHPPARSING);
- phpTest();
- }
-
- public final void htmlParserTester(final File fileName) throws FileNotFoundException, ParseException {
- final Reader stream = new FileReader(fileName);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(stream);
- init();
- phpDocument = new PHPDocument(null,"_root".toCharArray());
- currentSegment = phpDocument;
- outlineInfo = new PHPOutlineInfo(null, currentSegment);
- phpFile();
- }
-
- public final void htmlParserTester(final String strEval) throws ParseException {
- final StringReader stream = new StringReader(strEval);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(stream);
- init();
- phpDocument = new PHPDocument(null,"_root".toCharArray());
- currentSegment = phpDocument;
- outlineInfo = new PHPOutlineInfo(null, currentSegment);
- phpFile();
- }
-
- /**
- * Reinitialize the parser.
- */
- private static final void init() {
- nodes = new AstNode[AstStackIncrement];
- nodePtr = -1;
- htmlStart = 0;
- }
-
- /**
- * Add an php node on the stack.
- * @param node the node that will be added to the stack
- */
- private static final void pushOnAstNodes(final AstNode node) {
- try {
- nodes[++nodePtr] = node;
- } catch (IndexOutOfBoundsException e) {
- final int oldStackLength = nodes.length;
- final AstNode[] oldStack = nodes;
- nodes = new AstNode[oldStackLength + AstStackIncrement];
- System.arraycopy(oldStack, 0, nodes, 0, oldStackLength);
- nodePtr = oldStackLength;
- nodes[nodePtr] = node;
- }
- }
-
- public final PHPOutlineInfo parseInfo(final Object parent, final String s) {
- phpDocument = new PHPDocument(parent,"_root".toCharArray());
- currentSegment = phpDocument;
- outlineInfo = new PHPOutlineInfo(parent, currentSegment);
- final StringReader stream = new StringReader(s);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(stream);
- init();
- try {
- parse();
- phpDocument.nodes = new AstNode[nodes.length];
- System.arraycopy(nodes,0,phpDocument.nodes,0,nodes.length);
- if (PHPeclipsePlugin.DEBUG) {
- PHPeclipsePlugin.log(1,phpDocument.toString());
- }
- } catch (ParseException e) {
- processParseException(e);
- }
- return outlineInfo;
- }
-
- /**
- * This function will throw the exception if we are in debug mode
- * and process it if we are in production mode.
- * this should be fast since the PARSER_DEBUG is static final so the difference will be at compile time
- * @param e the exception
- * @throws ParseException the thrown exception
- */
- private static void processParseExceptionDebug(final ParseException e) throws ParseException {
- if (PARSER_DEBUG) {
- throw e;
- }
- processParseException(e);
- }
- /**
- * This method will process the parse exception.
- * If the error message is null, the parse exception wasn't catched and a trace is written in the log
- * @param e the ParseException
- */
- private static void processParseException(final ParseException e) {
- if (errorMessage == null) {
- PHPeclipsePlugin.log(e);
- errorMessage = "this exception wasn't handled by the parser please tell us how to reproduce it";
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- }
- setMarker(e);
- errorMessage = null;
- // if (PHPeclipsePlugin.DEBUG) PHPeclipsePlugin.log(e);
- }
-
- /**
- * Create marker for the parse error.
- * @param e the ParseException
- */
- private static void setMarker(final ParseException e) {
- try {
- if (errorStart == -1) {
- setMarker(fileToParse,
- errorMessage,
- e.currentToken.sourceStart,
- e.currentToken.sourceEnd,
- errorLevel,
- "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+':'+e.currentToken.sourceEnd);
- } else {
- setMarker(fileToParse,
- errorMessage,
- errorStart,
- errorEnd,
- errorLevel,
- "Line " + e.currentToken.beginLine+", "+errorStart+':'+errorEnd);
- errorStart = -1;
- errorEnd = -1;
- }
- } catch (CoreException e2) {
- PHPeclipsePlugin.log(e2);
- }
- }
-
- private static void scanLine(final String output,
- final IFile file,
- final int indx,
- final int brIndx) throws CoreException {
- String current;
- final StringBuffer lineNumberBuffer = new StringBuffer(10);
- char ch;
- current = output.substring(indx, brIndx);
-
- if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) {
- final int onLine = current.indexOf("on line <b>");
- if (onLine != -1) {
- lineNumberBuffer.delete(0, lineNumberBuffer.length());
- for (int i = onLine; i < current.length(); i++) {
- ch = current.charAt(i);
- if ('0' <= ch && '9' >= ch) {
- lineNumberBuffer.append(ch);
- }
- }
-
- final int lineNumber = Integer.parseInt(lineNumberBuffer.toString());
-
- final Hashtable attributes = new Hashtable();
-
- current = current.replaceAll("\n", "");
- current = current.replaceAll("<b>", "");
- current = current.replaceAll("</b>", "");
- MarkerUtilities.setMessage(attributes, current);
-
- if (current.indexOf(PARSE_ERROR_STRING) != -1)
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- else if (current.indexOf(PARSE_WARNING_STRING) != -1)
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- else
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- MarkerUtilities.setLineNumber(attributes, lineNumber);
- MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
- }
- }
- }
-
- public final void parse(final String s) {
- final StringReader stream = new StringReader(s);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(stream);
- init();
- try {
- parse();
- } catch (ParseException e) {
- processParseException(e);
- }
- }
-
- /**
- * Call the php parse command ( php -l -f <filename> )
- * and create markers according to the external parser output
- */
- public static void phpExternalParse(final IFile file) {
- final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- final String filename = file.getLocation().toString();
-
- final String[] arguments = { filename };
- final MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.EXTERNAL_PARSER_PREF));
- final String command = form.format(arguments);
-
- final String parserResult = PHPStartApacheAction.getParserOutput(command, "External parser: ");
-
- try {
- // parse the buffer to find the errors and warnings
- createMarkers(parserResult, file);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- }
-
- /**
- * Put a new html block in the stack.
- */
- public final void createNewHTMLCode() {
- final int currentPosition = token.sourceStart;
- if (currentPosition == htmlStart ||
- currentPosition < htmlStart ||
- currentPosition > jj_input_stream.getCurrentBuffer().length()) {
- return;
- }
- final String html = jj_input_stream.getCurrentBuffer().substring(htmlStart, currentPosition);
- pushOnAstNodes(new HTMLCode(html, htmlStart,currentPosition));
- }
-
- /** Create a new task. */
- public final void createNewTask(final int todoStart) {
- final String todo = jj_input_stream.getCurrentBuffer().substring(todoStart,
- jj_input_stream.getCurrentBuffer().indexOf("\n",
- todoStart)-1);
- if (!PARSER_DEBUG) {
- try {
- setMarker(fileToParse,
- todo,
- jj_input_stream.getBeginLine(),
- TASK,
- "Line "+jj_input_stream.getBeginLine());
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- }
- }
-
- private final void parse() throws ParseException {
- phpFile();
- }
-
- final public void todo() throws ParseException {
- Token todoToken;
- todoToken = jj_consume_token(23);
- createNewTask(todoToken.sourceStart);
- }
-
- final public void phpTest() throws ParseException {
- Php();
- jj_consume_token(0);
- }
-
- final public void phpFile() throws ParseException {
- try {
- label_1:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPSTARTSHORT:
- case PHPSTARTLONG:
- case PHPECHOSTART:
- case PHPEND:
- case CLASS:
- case FUNCTION:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[0] = jj_gen;
- break label_1;
- }
- PhpBlock();
- }
- createNewHTMLCode();
- } catch (TokenMgrError e) {
- PHPeclipsePlugin.log(e);
- errorStart = jj_input_stream.getBeginOffset();
- errorEnd = jj_input_stream.getEndOffset();
- errorMessage = e.getMessage();
- errorLevel = ERROR;
- {if (true) throw generateParseException();}
- }
- }
-
-/**
- * A php block is a <?= expression [;]?>
- * or <?php somephpcode ?>
- * or <? somephpcode ?>
- */
- final public void PhpBlock() throws ParseException {
- final PHPEchoBlock phpEchoBlock;
- final Token token,phpEnd;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPECHOSTART:
- phpEchoBlock = phpEchoBlock();
- pushOnAstNodes(phpEchoBlock);
- break;
- case PHPSTARTSHORT:
- case PHPSTARTLONG:
- case PHPEND:
- case CLASS:
- case FUNCTION:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPSTARTSHORT:
- case PHPSTARTLONG:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPSTARTLONG:
- jj_consume_token(PHPSTARTLONG);
- break;
- case PHPSTARTSHORT:
- token = jj_consume_token(PHPSTARTSHORT);
- try {
- setMarker(fileToParse,
- "You should use '<?php' instead of '<?' it will avoid some problems with XML",
- token.sourceStart,
- token.sourceEnd,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- break;
- default:
- jj_la1[1] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[2] = jj_gen;
- ;
- }
- createNewHTMLCode();
- Php();
- try {
- phpEnd = jj_consume_token(PHPEND);
- htmlStart = phpEnd.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "'?>' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- break;
- default:
- jj_la1[3] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
- final public PHPEchoBlock phpEchoBlock() throws ParseException {
- final Expression expr;
- final PHPEchoBlock echoBlock;
- final Token token, token2;
- token = jj_consume_token(PHPECHOSTART);
- createNewHTMLCode();
- expr = Expression();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case SEMICOLON:
- jj_consume_token(SEMICOLON);
- break;
- default:
- jj_la1[4] = jj_gen;
- ;
- }
- token2 = jj_consume_token(PHPEND);
- htmlStart = token2.sourceEnd;
-
- echoBlock = new PHPEchoBlock(expr,token.sourceStart,token2.sourceEnd);
- pushOnAstNodes(echoBlock);
- {if (true) return echoBlock;}
- throw new Error("Missing return statement in function");
- }
-
- final public void Php() throws ParseException {
- label_2:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CLASS:
- case FUNCTION:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[5] = jj_gen;
- break label_2;
- }
- BlockStatement();
- }
- }
-
- final public ClassDeclaration ClassDeclaration() throws ParseException {
- final ClassDeclaration classDeclaration;
- Token className = null;
- final Token superclassName, token, extendsToken;
- String classNameImage = SYNTAX_ERROR_CHAR;
- String superclassNameImage = null;
- final int classEnd;
- token = jj_consume_token(CLASS);
- try {
- className = jj_consume_token(IDENTIFIER);
- classNameImage = className.image;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
- errorLevel = ERROR;
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case EXTENDS:
- extendsToken = jj_consume_token(EXTENDS);
- try {
- superclassName = jj_consume_token(IDENTIFIER);
- superclassNameImage = superclassName.image;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
- errorLevel = ERROR;
- errorStart = extendsToken.sourceEnd+1;
- errorEnd = extendsToken.sourceEnd+1;
- processParseExceptionDebug(e);
- superclassNameImage = SYNTAX_ERROR_CHAR;
- }
- break;
- default:
- jj_la1[6] = jj_gen;
- ;
- }
- int start, end;
- if (className == null) {
- start = token.sourceStart;
- end = token.sourceEnd;
- } else {
- start = className.sourceStart;
- end = className.sourceEnd;
- }
- if (superclassNameImage == null) {
-
- classDeclaration = new ClassDeclaration(currentSegment,
- classNameImage,
- start,
- end);
- } else {
- classDeclaration = new ClassDeclaration(currentSegment,
- classNameImage,
- superclassNameImage,
- start,
- end);
- }
- currentSegment.add(classDeclaration);
- currentSegment = classDeclaration;
- classEnd = ClassBody(classDeclaration);
- currentSegment = (OutlineableWithChildren) currentSegment.getParent();
- classDeclaration.sourceEnd = classEnd;
- pushOnAstNodes(classDeclaration);
- {if (true) return classDeclaration;}
- throw new Error("Missing return statement in function");
- }
-
- final public int ClassBody(final ClassDeclaration classDeclaration) throws ParseException {
-Token token;
- try {
- jj_consume_token(LBRACE);
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image + "'. '{' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- label_3:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case FUNCTION:
- case VAR:
- ;
- break;
- default:
- jj_la1[7] = jj_gen;
- break label_3;
- }
- ClassBodyDeclaration(classDeclaration);
- }
- try {
- token = jj_consume_token(RBRACE);
- {if (true) return token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. 'var', 'function' or '}' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- {if (true) return this.token.sourceEnd;}
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A class can contain only methods and fields.
- */
- final public void ClassBodyDeclaration(final ClassDeclaration classDeclaration) throws ParseException {
- final MethodDeclaration method;
- final FieldDeclaration field;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case FUNCTION:
- method = MethodDeclaration();
- method.analyzeCode();
- classDeclaration.addMethod(method);
- break;
- case VAR:
- field = FieldDeclaration();
- classDeclaration.addField(field);
- break;
- default:
- jj_la1[8] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
-
-/**
- * A class field declaration : it's var VariableDeclarator() (, VariableDeclarator())*;.
- * it is only used by ClassBodyDeclaration()
- */
- final public FieldDeclaration FieldDeclaration() throws ParseException {
- VariableDeclaration variableDeclaration;
- final VariableDeclaration[] list;
- final ArrayList arrayList = new ArrayList();
- final Token token;
- Token token2 = null;
- int pos;
- token = jj_consume_token(VAR);
- variableDeclaration = VariableDeclaratorNoSuffix();
- arrayList.add(variableDeclaration);
- pos = variableDeclaration.sourceEnd;
- label_4:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[9] = jj_gen;
- break label_4;
- }
- jj_consume_token(COMMA);
- variableDeclaration = VariableDeclaratorNoSuffix();
- arrayList.add(variableDeclaration);
- outlineInfo.addVariable(variableDeclaration.name());
- pos = variableDeclaration.sourceEnd;
- }
- try {
- token2 = jj_consume_token(SEMICOLON);
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected after variable declaration";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- list = new VariableDeclaration[arrayList.size()];
- arrayList.toArray(list);
- int end;
- if (token2 == null) {
- end = list[list.length-1].sourceEnd;
- } else {
- end = token2.sourceEnd;
- }
- {if (true) return new FieldDeclaration(list,
- token.sourceStart,
- end,
- currentSegment);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * a strict variable declarator : there cannot be a suffix here.
- * It will be used by fields and formal parameters
- */
- final public VariableDeclaration VariableDeclaratorNoSuffix() throws ParseException {
- final Token token, lbrace,rbrace;
- Expression expr, initializer = null;
- Token assignToken;
- Variable variable;
- jj_consume_token(DOLLAR);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENTIFIER:
- token = jj_consume_token(IDENTIFIER);
- variable = new Variable(token.image,token.sourceStart,token.sourceEnd);
- break;
- case LBRACE:
- lbrace = jj_consume_token(LBRACE);
- expr = Expression();
- rbrace = jj_consume_token(RBRACE);
- variable = new Variable(expr,lbrace.sourceStart,rbrace.sourceEnd);
- break;
- default:
- jj_la1[10] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ASSIGN:
- assignToken = jj_consume_token(ASSIGN);
- try {
- initializer = VariableInitializer();
- } catch (ParseException e) {
- errorMessage = "Literal expression expected in variable initializer";
- errorLevel = ERROR;
- errorStart = assignToken.sourceEnd +1;
- errorEnd = assignToken.sourceEnd +1;
- processParseExceptionDebug(e);
- }
- break;
- default:
- jj_la1[11] = jj_gen;
- ;
- }
- if (initializer == null) {
- {if (true) return new VariableDeclaration(currentSegment,
- variable,
- variable.sourceStart,
- variable.sourceEnd);}
- }
- {if (true) return new VariableDeclaration(currentSegment,
- variable,
- initializer,
- VariableDeclaration.EQUAL,
- variable.sourceStart);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * this will be used by static statement
- */
- final public VariableDeclaration VariableDeclarator() throws ParseException {
- final AbstractVariable variable;
- Expression initializer = null;
- final Token token;
- variable = VariableDeclaratorId();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ASSIGN:
- token = jj_consume_token(ASSIGN);
- try {
- initializer = VariableInitializer();
- } catch (ParseException e) {
- errorMessage = "Literal expression expected in variable initializer";
- errorLevel = ERROR;
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- break;
- default:
- jj_la1[12] = jj_gen;
- ;
- }
- if (initializer == null) {
- {if (true) return new VariableDeclaration(currentSegment,
- variable,
- variable.sourceStart,
- variable.sourceEnd);}
- }
- {if (true) return new VariableDeclaration(currentSegment,
- variable,
- initializer,
- VariableDeclaration.EQUAL,
- variable.sourceStart);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A Variable name.
- * @return the variable name (with suffix)
- */
- final public AbstractVariable VariableDeclaratorId() throws ParseException {
- AbstractVariable var;
- try {
- var = Variable();
- label_5:
- while (true) {
- if (jj_2_1(2)) {
- ;
- } else {
- break label_5;
- }
- var = VariableSuffix(var);
- }
- {if (true) return var;}
- } catch (ParseException e) {
- errorMessage = "'$' expected for variable identifier";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- {if (true) throw e;}
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Variable Variable() throws ParseException {
- Variable variable = null;
- final Token token;
- token = jj_consume_token(DOLLAR);
- variable = Var();
- {if (true) return variable;}
- throw new Error("Missing return statement in function");
- }
-
- final public Variable Var() throws ParseException {
- Variable variable = null;
- final Token token,token2;
- ConstantIdentifier constant;
- Expression expression;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOLLAR:
- token = jj_consume_token(DOLLAR);
- variable = Var();
- {if (true) return new Variable(variable,variable.sourceStart,variable.sourceEnd);}
- break;
- case LBRACE:
- token = jj_consume_token(LBRACE);
- expression = Expression();
- token2 = jj_consume_token(RBRACE);
- {if (true) return new Variable(expression,
- token.sourceStart,
- token2.sourceEnd);}
- break;
- case IDENTIFIER:
- token = jj_consume_token(IDENTIFIER);
- outlineInfo.addVariable('$' + token.image);
- {if (true) return new Variable(token.image,token.sourceStart,token.sourceEnd);}
- break;
- default:
- jj_la1[13] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression VariableInitializer() throws ParseException {
- final Expression expr;
- final Token token, token2;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case NULL:
- case TRUE:
- case FALSE:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- expr = Literal();
- {if (true) return expr;}
- break;
- case MINUS:
- token2 = jj_consume_token(MINUS);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTEGER_LITERAL:
- token = jj_consume_token(INTEGER_LITERAL);
- break;
- case FLOATING_POINT_LITERAL:
- token = jj_consume_token(FLOATING_POINT_LITERAL);
- break;
- default:
- jj_la1[14] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return new PrefixedUnaryExpression(new NumberLiteral(token),
- OperatorIds.MINUS,
- token2.sourceStart);}
- break;
- case PLUS:
- token2 = jj_consume_token(PLUS);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTEGER_LITERAL:
- token = jj_consume_token(INTEGER_LITERAL);
- break;
- case FLOATING_POINT_LITERAL:
- token = jj_consume_token(FLOATING_POINT_LITERAL);
- break;
- default:
- jj_la1[15] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return new PrefixedUnaryExpression(new NumberLiteral(token),
- OperatorIds.PLUS,
- token2.sourceStart);}
- break;
- case ARRAY:
- expr = ArrayDeclarator();
- {if (true) return expr;}
- break;
- case IDENTIFIER:
- token = jj_consume_token(IDENTIFIER);
- {if (true) return new ConstantIdentifier(token);}
- break;
- default:
- jj_la1[16] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public ArrayVariableDeclaration ArrayVariable() throws ParseException {
-final Expression expr,expr2;
- expr = Expression();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAYASSIGN:
- jj_consume_token(ARRAYASSIGN);
- expr2 = Expression();
- {if (true) return new ArrayVariableDeclaration(expr,expr2);}
- break;
- default:
- jj_la1[17] = jj_gen;
- ;
- }
- {if (true) return new ArrayVariableDeclaration(expr,jj_input_stream.getPosition());}
- throw new Error("Missing return statement in function");
- }
-
- final public ArrayVariableDeclaration[] ArrayInitializer() throws ParseException {
- ArrayVariableDeclaration expr;
- final ArrayList list = new ArrayList();
- jj_consume_token(LPAREN);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expr = ArrayVariable();
- list.add(expr);
- label_6:
- while (true) {
- if (jj_2_2(2)) {
- ;
- } else {
- break label_6;
- }
- jj_consume_token(COMMA);
- expr = ArrayVariable();
- list.add(expr);
- }
- break;
- default:
- jj_la1[18] = jj_gen;
- ;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- jj_consume_token(COMMA);
- list.add(null);
- break;
- default:
- jj_la1[19] = jj_gen;
- ;
- }
- jj_consume_token(RPAREN);
- final ArrayVariableDeclaration[] vars = new ArrayVariableDeclaration[list.size()];
- list.toArray(vars);
- {if (true) return vars;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A Method Declaration.
- * <b>function</b> MetodDeclarator() Block()
- */
- final public MethodDeclaration MethodDeclaration() throws ParseException {
- final MethodDeclaration functionDeclaration;
- final Block block;
- final OutlineableWithChildren seg = currentSegment;
- final Token token;
- token = jj_consume_token(FUNCTION);
- try {
- functionDeclaration = MethodDeclarator(token.sourceStart);
- outlineInfo.addVariable(functionDeclaration.name);
- } catch (ParseException e) {
- if (errorMessage != null) {if (true) throw e;}
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- {if (true) throw e;}
- }
- currentSegment = functionDeclaration;
- block = Block();
- functionDeclaration.statements = block.statements;
- currentSegment = seg;
- {if (true) return functionDeclaration;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A MethodDeclarator.
- * [&] IDENTIFIER(parameters ...).
- * @return a function description for the outline
- */
- final public MethodDeclaration MethodDeclarator(final int start) throws ParseException {
- Token identifier = null;
- Token reference = null;
- final ArrayList formalParameters = new ArrayList();
- String identifierChar = SYNTAX_ERROR_CHAR;
- int end = start;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case BIT_AND:
- reference = jj_consume_token(BIT_AND);
- end = reference.sourceEnd;
- break;
- default:
- jj_la1[20] = jj_gen;
- ;
- }
- try {
- identifier = jj_consume_token(IDENTIFIER);
- identifierChar = identifier.image;
- end = identifier.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceEnd;
- errorEnd = e.currentToken.next.sourceStart;
- processParseExceptionDebug(e);
- }
- end = FormalParameters(formalParameters);
- int nameStart, nameEnd;
- if (identifier == null) {
- if (reference == null) {
- nameStart = start + 9;
- nameEnd = start + 10;
- } else {
- nameStart = reference.sourceEnd + 1;
- nameEnd = reference.sourceEnd + 2;
- }
- } else {
- nameStart = identifier.sourceStart;
- nameEnd = identifier.sourceEnd;
- }
- {if (true) return new MethodDeclaration(currentSegment,
- identifierChar,
- formalParameters,
- reference != null,
- nameStart,
- nameEnd,
- start,
- end);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * FormalParameters follows method identifier.
- * (FormalParameter())
- */
- final public int FormalParameters(final ArrayList parameters) throws ParseException {
- VariableDeclaration var;
- final Token token;
- Token tok = this.token;
- int end = tok.sourceEnd;
- try {
- tok = jj_consume_token(LPAREN);
- end = tok.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected after function identifier";
- errorLevel = ERROR;
- errorStart = e.currentToken.next.sourceStart;
- errorEnd = e.currentToken.next.sourceEnd;
- processParseExceptionDebug(e);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case BIT_AND:
- case DOLLAR:
- var = FormalParameter();
- parameters.add(var);end = var.sourceEnd;
- label_7:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[21] = jj_gen;
- break label_7;
- }
- jj_consume_token(COMMA);
- var = FormalParameter();
- parameters.add(var);end = var.sourceEnd;
- }
- break;
- default:
- jj_la1[22] = jj_gen;
- ;
- }
- try {
- token = jj_consume_token(RPAREN);
- end = token.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "')' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.next.sourceStart;
- errorEnd = e.currentToken.next.sourceEnd;
- processParseExceptionDebug(e);
- }
- {if (true) return end;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A formal parameter.
- * $varname[=value] (,$varname[=value])
- */
- final public VariableDeclaration FormalParameter() throws ParseException {
- final VariableDeclaration variableDeclaration;
- Token token = null;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case BIT_AND:
- token = jj_consume_token(BIT_AND);
- break;
- default:
- jj_la1[23] = jj_gen;
- ;
- }
- variableDeclaration = VariableDeclaratorNoSuffix();
- outlineInfo.addVariable('$'+variableDeclaration.name());
- if (token != null) {
- variableDeclaration.setReference(true);
- }
- {if (true) return variableDeclaration;}
- throw new Error("Missing return statement in function");
- }
-
- final public ConstantIdentifier Type() throws ParseException {
- final Token token;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING:
- token = jj_consume_token(STRING);
- {if (true) return new ConstantIdentifier(token);}
- break;
- case BOOL:
- token = jj_consume_token(BOOL);
- {if (true) return new ConstantIdentifier(token);}
- break;
- case BOOLEAN:
- token = jj_consume_token(BOOLEAN);
- {if (true) return new ConstantIdentifier(token);}
- break;
- case REAL:
- token = jj_consume_token(REAL);
- {if (true) return new ConstantIdentifier(token);}
- break;
- case DOUBLE:
- token = jj_consume_token(DOUBLE);
- {if (true) return new ConstantIdentifier(token);}
- break;
- case FLOAT:
- token = jj_consume_token(FLOAT);
- {if (true) return new ConstantIdentifier(token);}
- break;
- case INT:
- token = jj_consume_token(INT);
- {if (true) return new ConstantIdentifier(token);}
- break;
- case INTEGER:
- token = jj_consume_token(INTEGER);
- {if (true) return new ConstantIdentifier(token);}
- break;
- case OBJECT:
- token = jj_consume_token(OBJECT);
- {if (true) return new ConstantIdentifier(token);}
- break;
- default:
- jj_la1[24] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression Expression() throws ParseException {
- final Expression expr;
- Expression initializer = null;
- int assignOperator = -1;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expr = ConditionalExpression();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ASSIGN:
- case PLUSASSIGN:
- case MINUSASSIGN:
- case STARASSIGN:
- case SLASHASSIGN:
- case ANDASSIGN:
- case ORASSIGN:
- case XORASSIGN:
- case DOTASSIGN:
- case REMASSIGN:
- case TILDEEQUAL:
- case LSHIFTASSIGN:
- case RSIGNEDSHIFTASSIGN:
- assignOperator = AssignmentOperator();
- try {
- initializer = Expression();
- } catch (ParseException e) {
- if (errorMessage != null) {
- {if (true) throw e;}
- }
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected";
- errorLevel = ERROR;
- errorEnd = jj_input_stream.getPosition();
- {if (true) throw e;}
- }
- break;
- default:
- jj_la1[25] = jj_gen;
- ;
- }
- if (assignOperator != -1) {// todo : change this, very very bad :(
- if (expr instanceof AbstractVariable) {
- {if (true) return new VariableDeclaration(currentSegment,
- (AbstractVariable) expr,
- initializer,
- expr.sourceStart,
- initializer.sourceEnd);}
- }
- String varName = expr.toStringExpression().substring(1);
- {if (true) return new VariableDeclaration(currentSegment,
- new Variable(varName,
- expr.sourceStart,
- expr.sourceEnd),
- expr.sourceStart,
- initializer.sourceEnd);}
- }
- {if (true) return expr;}
- break;
- case LIST:
- case PRINT:
- expr = ExpressionWBang();
- {if (true) return expr;}
- break;
- default:
- jj_la1[26] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression ExpressionWBang() throws ParseException {
- final Expression expr;
- final Token token;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case BANG:
- token = jj_consume_token(BANG);
- expr = ExpressionWBang();
- {if (true) return new PrefixedUnaryExpression(expr,OperatorIds.NOT,token.sourceStart);}
- break;
- case LIST:
- case PRINT:
- expr = ExpressionNoBang();
- {if (true) return expr;}
- break;
- default:
- jj_la1[27] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression ExpressionNoBang() throws ParseException {
- Expression expr;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LIST:
- expr = ListExpression();
- {if (true) return expr;}
- break;
- case PRINT:
- expr = PrintExpression();
- {if (true) return expr;}
- break;
- default:
- jj_la1[28] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * Any assignement operator.
- * @return the assignement operator id
- */
- final public int AssignmentOperator() throws ParseException {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ASSIGN:
- jj_consume_token(ASSIGN);
- {if (true) return VariableDeclaration.EQUAL;}
- break;
- case STARASSIGN:
- jj_consume_token(STARASSIGN);
- {if (true) return VariableDeclaration.STAR_EQUAL;}
- break;
- case SLASHASSIGN:
- jj_consume_token(SLASHASSIGN);
- {if (true) return VariableDeclaration.SLASH_EQUAL;}
- break;
- case REMASSIGN:
- jj_consume_token(REMASSIGN);
- {if (true) return VariableDeclaration.REM_EQUAL;}
- break;
- case PLUSASSIGN:
- jj_consume_token(PLUSASSIGN);
- {if (true) return VariableDeclaration.PLUS_EQUAL;}
- break;
- case MINUSASSIGN:
- jj_consume_token(MINUSASSIGN);
- {if (true) return VariableDeclaration.MINUS_EQUAL;}
- break;
- case LSHIFTASSIGN:
- jj_consume_token(LSHIFTASSIGN);
- {if (true) return VariableDeclaration.LSHIFT_EQUAL;}
- break;
- case RSIGNEDSHIFTASSIGN:
- jj_consume_token(RSIGNEDSHIFTASSIGN);
- {if (true) return VariableDeclaration.RSIGNEDSHIFT_EQUAL;}
- break;
- case ANDASSIGN:
- jj_consume_token(ANDASSIGN);
- {if (true) return VariableDeclaration.AND_EQUAL;}
- break;
- case XORASSIGN:
- jj_consume_token(XORASSIGN);
- {if (true) return VariableDeclaration.XOR_EQUAL;}
- break;
- case ORASSIGN:
- jj_consume_token(ORASSIGN);
- {if (true) return VariableDeclaration.OR_EQUAL;}
- break;
- case DOTASSIGN:
- jj_consume_token(DOTASSIGN);
- {if (true) return VariableDeclaration.DOT_EQUAL;}
- break;
- case TILDEEQUAL:
- jj_consume_token(TILDEEQUAL);
- {if (true) return VariableDeclaration.TILDE_EQUAL;}
- break;
- default:
- jj_la1[29] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression ConditionalExpression() throws ParseException {
- final Expression expr;
- Expression expr2 = null;
- Expression expr3 = null;
- expr = ConditionalOrExpression();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case HOOK:
- jj_consume_token(HOOK);
- expr2 = Expression();
- jj_consume_token(COLON);
- expr3 = ConditionalExpression();
- break;
- default:
- jj_la1[30] = jj_gen;
- ;
- }
- if (expr3 == null) {
- {if (true) return expr;}
- }
- {if (true) return new ConditionalExpression(expr,expr2,expr3);}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression ConditionalOrExpression() throws ParseException {
- Expression expr,expr2;
- int operator;
- expr = ConditionalAndExpression();
- label_8:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case OR_OR:
- case _ORL:
- ;
- break;
- default:
- jj_la1[31] = jj_gen;
- break label_8;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case OR_OR:
- jj_consume_token(OR_OR);
- operator = OperatorIds.OR_OR;
- break;
- case _ORL:
- jj_consume_token(_ORL);
- operator = OperatorIds.ORL;
- break;
- default:
- jj_la1[32] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- expr2 = ConditionalAndExpression();
- expr = new BinaryExpression(expr,expr2,operator);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression ConditionalAndExpression() throws ParseException {
- Expression expr,expr2;
- int operator;
- expr = ConcatExpression();
- label_9:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case AND_AND:
- case _ANDL:
- ;
- break;
- default:
- jj_la1[33] = jj_gen;
- break label_9;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case AND_AND:
- jj_consume_token(AND_AND);
- operator = OperatorIds.AND_AND;
- break;
- case _ANDL:
- jj_consume_token(_ANDL);
- operator = OperatorIds.ANDL;
- break;
- default:
- jj_la1[34] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- expr2 = ConcatExpression();
- expr = new BinaryExpression(expr,expr2,operator);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression ConcatExpression() throws ParseException {
- Expression expr,expr2;
- expr = InclusiveOrExpression();
- label_10:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOT:
- ;
- break;
- default:
- jj_la1[35] = jj_gen;
- break label_10;
- }
- jj_consume_token(DOT);
- expr2 = InclusiveOrExpression();
- expr = new BinaryExpression(expr,expr2,OperatorIds.DOT);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression InclusiveOrExpression() throws ParseException {
- Expression expr,expr2;
- expr = ExclusiveOrExpression();
- label_11:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case BIT_OR:
- ;
- break;
- default:
- jj_la1[36] = jj_gen;
- break label_11;
- }
- jj_consume_token(BIT_OR);
- expr2 = ExclusiveOrExpression();
- expr = new BinaryExpression(expr,expr2,OperatorIds.OR);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression ExclusiveOrExpression() throws ParseException {
- Expression expr,expr2;
- expr = AndExpression();
- label_12:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case XOR:
- ;
- break;
- default:
- jj_la1[37] = jj_gen;
- break label_12;
- }
- jj_consume_token(XOR);
- expr2 = AndExpression();
- expr = new BinaryExpression(expr,expr2,OperatorIds.XOR);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression AndExpression() throws ParseException {
- Expression expr,expr2;
- expr = EqualityExpression();
- label_13:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case BIT_AND:
- ;
- break;
- default:
- jj_la1[38] = jj_gen;
- break label_13;
- }
- jj_consume_token(BIT_AND);
- expr2 = EqualityExpression();
- expr = new BinaryExpression(expr,expr2,OperatorIds.AND);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression EqualityExpression() throws ParseException {
- Expression expr,expr2;
- int operator;
- Token token;
- expr = RelationalExpression();
- label_14:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case EQUAL_EQUAL:
- case NOT_EQUAL:
- case DIF:
- case BANGDOUBLEEQUAL:
- case TRIPLEEQUAL:
- ;
- break;
- default:
- jj_la1[39] = jj_gen;
- break label_14;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case EQUAL_EQUAL:
- token = jj_consume_token(EQUAL_EQUAL);
- operator = OperatorIds.EQUAL_EQUAL;
- break;
- case DIF:
- token = jj_consume_token(DIF);
- operator = OperatorIds.DIF;
- break;
- case NOT_EQUAL:
- token = jj_consume_token(NOT_EQUAL);
- operator = OperatorIds.DIF;
- break;
- case BANGDOUBLEEQUAL:
- token = jj_consume_token(BANGDOUBLEEQUAL);
- operator = OperatorIds.BANG_EQUAL_EQUAL;
- break;
- case TRIPLEEQUAL:
- token = jj_consume_token(TRIPLEEQUAL);
- operator = OperatorIds.EQUAL_EQUAL_EQUAL;
- break;
- default:
- jj_la1[40] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- try {
- expr2 = RelationalExpression();
- } catch (ParseException e) {
- if (errorMessage != null) {
- {if (true) throw e;}
- }
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected";
- errorLevel = ERROR;
- errorStart = token.sourceEnd +1;
- errorEnd = token.sourceEnd +1;
- expr2 = new ConstantIdentifier(SYNTAX_ERROR_CHAR,token.sourceEnd +1,token.sourceEnd +1);
- processParseExceptionDebug(e);
- }
- expr = new BinaryExpression(expr,expr2,operator);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression RelationalExpression() throws ParseException {
- Expression expr,expr2;
- int operator;
- expr = ShiftExpression();
- label_15:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case GT:
- case LT:
- case LE:
- case GE:
- ;
- break;
- default:
- jj_la1[41] = jj_gen;
- break label_15;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LT:
- jj_consume_token(LT);
- operator = OperatorIds.LESS;
- break;
- case GT:
- jj_consume_token(GT);
- operator = OperatorIds.GREATER;
- break;
- case LE:
- jj_consume_token(LE);
- operator = OperatorIds.LESS_EQUAL;
- break;
- case GE:
- jj_consume_token(GE);
- operator = OperatorIds.GREATER_EQUAL;
- break;
- default:
- jj_la1[42] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- expr2 = ShiftExpression();
- expr = new BinaryExpression(expr,expr2,operator);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression ShiftExpression() throws ParseException {
- Expression expr,expr2;
- int operator;
- expr = AdditiveExpression();
- label_16:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LSHIFT:
- case RSIGNEDSHIFT:
- case RUNSIGNEDSHIFT:
- ;
- break;
- default:
- jj_la1[43] = jj_gen;
- break label_16;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LSHIFT:
- jj_consume_token(LSHIFT);
- operator = OperatorIds.LEFT_SHIFT;
- break;
- case RSIGNEDSHIFT:
- jj_consume_token(RSIGNEDSHIFT);
- operator = OperatorIds.RIGHT_SHIFT;
- break;
- case RUNSIGNEDSHIFT:
- jj_consume_token(RUNSIGNEDSHIFT);
- operator = OperatorIds.UNSIGNED_RIGHT_SHIFT;
- break;
- default:
- jj_la1[44] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- expr2 = AdditiveExpression();
- expr = new BinaryExpression(expr,expr2,operator);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression AdditiveExpression() throws ParseException {
- Expression expr,expr2;
- int operator;
- expr = MultiplicativeExpression();
- label_17:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- case MINUS:
- ;
- break;
- default:
- jj_la1[45] = jj_gen;
- break label_17;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- jj_consume_token(PLUS);
- operator = OperatorIds.PLUS;
- break;
- case MINUS:
- jj_consume_token(MINUS);
- operator = OperatorIds.MINUS;
- break;
- default:
- jj_la1[46] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- expr2 = MultiplicativeExpression();
- expr = new BinaryExpression(expr,expr2,operator);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression MultiplicativeExpression() throws ParseException {
- Expression expr,expr2;
- int operator;
- try {
- expr = UnaryExpression();
- } catch (ParseException e) {
- if (errorMessage != null) {if (true) throw e;}
- errorMessage = "unexpected token '"+e.currentToken.next.image+'\'';
- errorLevel = ERROR;
- errorStart = this.token.sourceStart;
- errorEnd = this.token.sourceEnd;
- {if (true) throw e;}
- }
- label_18:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STAR:
- case SLASH:
- case REMAINDER:
- ;
- break;
- default:
- jj_la1[47] = jj_gen;
- break label_18;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STAR:
- jj_consume_token(STAR);
- operator = OperatorIds.MULTIPLY;
- break;
- case SLASH:
- jj_consume_token(SLASH);
- operator = OperatorIds.DIVIDE;
- break;
- case REMAINDER:
- jj_consume_token(REMAINDER);
- operator = OperatorIds.REMAINDER;
- break;
- default:
- jj_la1[48] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- expr2 = UnaryExpression();
- expr = new BinaryExpression(expr,expr2,operator);
- }
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * An unary expression starting with @, & or nothing
- */
- final public Expression UnaryExpression() throws ParseException {
- final Expression expr;
- /* <BIT_AND> expr = UnaryExpressionNoPrefix() //why did I had that ?
- {return new PrefixedUnaryExpression(expr,OperatorIds.AND,pos);}
- | */
- expr = AtNotTildeUnaryExpression();
- {if (true) return expr;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression AtNotTildeUnaryExpression() throws ParseException {
- final Expression expr;
- final Token token;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case AT:
- token = jj_consume_token(AT);
- expr = AtNotTildeUnaryExpression();
- {if (true) return new PrefixedUnaryExpression(expr,OperatorIds.AT,token.sourceStart);}
- break;
- case TILDE:
- token = jj_consume_token(TILDE);
- expr = AtNotTildeUnaryExpression();
- {if (true) return new PrefixedUnaryExpression(expr,OperatorIds.TWIDDLE,token.sourceStart);}
- break;
- case BANG:
- token = jj_consume_token(BANG);
- expr = AtNotUnaryExpression();
- {if (true) return new PrefixedUnaryExpression(expr,OperatorIds.NOT,token.sourceStart);}
- break;
- case ARRAY:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expr = UnaryExpressionNoPrefix();
- {if (true) return expr;}
- break;
- default:
- jj_la1[49] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * An expression prefixed (or not) by one or more @ and !.
- * @return the expression
- */
- final public Expression AtNotUnaryExpression() throws ParseException {
- final Expression expr;
- final Token token;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case AT:
- token = jj_consume_token(AT);
- expr = AtNotUnaryExpression();
- {if (true) return new PrefixedUnaryExpression(expr,OperatorIds.AT,token.sourceStart);}
- break;
- case BANG:
- token = jj_consume_token(BANG);
- expr = AtNotUnaryExpression();
- {if (true) return new PrefixedUnaryExpression(expr,OperatorIds.NOT,token.sourceStart);}
- break;
- case ARRAY:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expr = UnaryExpressionNoPrefix();
- {if (true) return expr;}
- break;
- default:
- jj_la1[50] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression UnaryExpressionNoPrefix() throws ParseException {
- final Expression expr;
- final Token token;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS:
- token = jj_consume_token(PLUS);
- expr = AtNotTildeUnaryExpression();
- {if (true) return new PrefixedUnaryExpression(expr,
- OperatorIds.PLUS,
- token.sourceStart);}
- break;
- case MINUS:
- token = jj_consume_token(MINUS);
- expr = AtNotTildeUnaryExpression();
- {if (true) return new PrefixedUnaryExpression(expr,
- OperatorIds.MINUS,
- token.sourceStart);}
- break;
- case PLUS_PLUS:
- case MINUS_MINUS:
- expr = PreIncDecExpression();
- {if (true) return expr;}
- break;
- case ARRAY:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expr = UnaryExpressionNotPlusMinus();
- {if (true) return expr;}
- break;
- default:
- jj_la1[51] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression PreIncDecExpression() throws ParseException {
-final Expression expr;
-final int operator;
-final Token token;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS_PLUS:
- token = jj_consume_token(PLUS_PLUS);
- operator = OperatorIds.PLUS_PLUS;
- break;
- case MINUS_MINUS:
- token = jj_consume_token(MINUS_MINUS);
- operator = OperatorIds.MINUS_MINUS;
- break;
- default:
- jj_la1[52] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- expr = PrimaryExpression();
- {if (true) return new PrefixedUnaryExpression(expr,operator,token.sourceStart);}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression UnaryExpressionNotPlusMinus() throws ParseException {
- final Expression expr;
- if (jj_2_3(2147483647)) {
- expr = CastExpression();
- {if (true) return expr;}
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case NEW:
- case BIT_AND:
- case DOLLAR:
- case IDENTIFIER:
- expr = PostfixExpression();
- {if (true) return expr;}
- break;
- case NULL:
- case TRUE:
- case FALSE:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- expr = Literal();
- {if (true) return expr;}
- break;
- case LPAREN:
- jj_consume_token(LPAREN);
- expr = Expression();
- try {
- jj_consume_token(RPAREN);
- } catch (ParseException e) {
- errorMessage = "')' expected";
- errorLevel = ERROR;
- errorStart = expr.sourceEnd +1;
- errorEnd = expr.sourceEnd +1;
- processParseExceptionDebug(e);
- }
- {if (true) return expr;}
- break;
- default:
- jj_la1[53] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public CastExpression CastExpression() throws ParseException {
-final ConstantIdentifier type;
-final Expression expr;
-final Token token,token1;
- token1 = jj_consume_token(LPAREN);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STRING:
- case OBJECT:
- case BOOL:
- case BOOLEAN:
- case REAL:
- case DOUBLE:
- case FLOAT:
- case INT:
- case INTEGER:
- type = Type();
- break;
- case ARRAY:
- token = jj_consume_token(ARRAY);
- type = new ConstantIdentifier(token);
- break;
- default:
- jj_la1[54] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- jj_consume_token(RPAREN);
- expr = UnaryExpression();
- {if (true) return new CastExpression(type,expr,token1.sourceStart,expr.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression PostfixExpression() throws ParseException {
- final Expression expr;
- int operator = -1;
- Token token = null;
- expr = PrimaryExpression();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS_PLUS:
- case MINUS_MINUS:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS_PLUS:
- token = jj_consume_token(PLUS_PLUS);
- operator = OperatorIds.PLUS_PLUS;
- break;
- case MINUS_MINUS:
- token = jj_consume_token(MINUS_MINUS);
- operator = OperatorIds.MINUS_MINUS;
- break;
- default:
- jj_la1[55] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[56] = jj_gen;
- ;
- }
- if (operator == -1) {
- {if (true) return expr;}
- }
- {if (true) return new PostfixedUnaryExpression(expr,operator,token.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression PrimaryExpression() throws ParseException {
- Expression expr;
- Token token = null;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case NEW:
- case BIT_AND:
- case DOLLAR:
- case IDENTIFIER:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case BIT_AND:
- token = jj_consume_token(BIT_AND);
- break;
- default:
- jj_la1[57] = jj_gen;
- ;
- }
- expr = refPrimaryExpression(token);
- {if (true) return expr;}
- break;
- case ARRAY:
- expr = ArrayDeclarator();
- {if (true) return expr;}
- break;
- default:
- jj_la1[58] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression refPrimaryExpression(final Token reference) throws ParseException {
- Expression expr;
- Expression expr2 = null;
- final Token identifier;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENTIFIER:
- identifier = jj_consume_token(IDENTIFIER);
- expr = new ConstantIdentifier(identifier);
- label_19:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case STATICCLASSACCESS:
- ;
- break;
- default:
- jj_la1[59] = jj_gen;
- break label_19;
- }
- jj_consume_token(STATICCLASSACCESS);
- expr2 = ClassIdentifier();
- expr = new ClassAccess(expr,
- expr2,
- ClassAccess.STATIC);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LPAREN:
- expr2 = Arguments(expr);
- break;
- default:
- jj_la1[60] = jj_gen;
- ;
- }
- if (expr2 == null) {
- if (reference != null) {
- ParseException e = generateParseException();
- errorMessage = "you cannot use a constant by reference";
- errorLevel = ERROR;
- errorStart = reference.sourceStart;
- errorEnd = reference.sourceEnd;
- processParseExceptionDebug(e);
- }
- {if (true) return expr;}
- }
- {if (true) return expr2;}
- break;
- case DOLLAR:
- expr = VariableDeclaratorId();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LPAREN:
- expr = Arguments(expr);
- break;
- default:
- jj_la1[61] = jj_gen;
- ;
- }
- {if (true) return expr;}
- break;
- case NEW:
- token = jj_consume_token(NEW);
- expr = ClassIdentifier();
- int start;
- if (reference == null) {
- start = token.sourceStart;
- } else {
- start = reference.sourceStart;
- }
- expr = new ClassInstantiation(expr,
- reference != null,
- start);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LPAREN:
- expr = Arguments(expr);
- break;
- default:
- jj_la1[62] = jj_gen;
- ;
- }
- {if (true) return expr;}
- break;
- default:
- jj_la1[63] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * An array declarator.
- * array(vars)
- * @return an array
- */
- final public ArrayInitializer ArrayDeclarator() throws ParseException {
- final ArrayVariableDeclaration[] vars;
- final Token token;
- token = jj_consume_token(ARRAY);
- vars = ArrayInitializer();
- {if (true) return new ArrayInitializer(vars,
- token.sourceStart,
- this.token.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression ClassIdentifier() throws ParseException {
- final Expression expr;
- final Token token;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENTIFIER:
- token = jj_consume_token(IDENTIFIER);
- {if (true) return new ConstantIdentifier(token);}
- break;
- case STRING:
- case OBJECT:
- case BOOL:
- case BOOLEAN:
- case REAL:
- case DOUBLE:
- case FLOAT:
- case INT:
- case INTEGER:
- expr = Type();
- {if (true) return expr;}
- break;
- case DOLLAR:
- expr = VariableDeclaratorId();
- {if (true) return expr;}
- break;
- default:
- jj_la1[64] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * Used by Variabledeclaratorid and primarysuffix
- */
- final public AbstractVariable VariableSuffix(final AbstractVariable prefix) throws ParseException {
- Expression expression = null;
- final Token classAccessToken,lbrace,rbrace;
- Token token;
- int pos;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CLASSACCESS:
- classAccessToken = jj_consume_token(CLASSACCESS);
- try {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACE:
- lbrace = jj_consume_token(LBRACE);
- expression = Expression();
- rbrace = jj_consume_token(RBRACE);
- expression = new Variable(expression,
- lbrace.sourceStart,
- rbrace.sourceEnd);
- break;
- case IDENTIFIER:
- token = jj_consume_token(IDENTIFIER);
- expression = new ConstantIdentifier(token.image,token.sourceStart,token.sourceEnd);
- break;
- case DOLLAR:
- expression = Variable();
- break;
- default:
- jj_la1[65] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function call or field access expected";
- errorLevel = ERROR;
- errorStart = classAccessToken.sourceEnd +1;
- errorEnd = classAccessToken.sourceEnd +1;
- processParseExceptionDebug(e);
- }
- {if (true) return new ClassAccess(prefix,
- expression,
- ClassAccess.NORMAL);}
- break;
- case LBRACKET:
- token = jj_consume_token(LBRACKET);
- pos = token.sourceEnd+1;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case STRING:
- case OBJECT:
- case BOOL:
- case BOOLEAN:
- case REAL:
- case DOUBLE:
- case FLOAT:
- case INT:
- case INTEGER:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expression = Expression();
- pos = expression.sourceEnd+1;
- break;
- case STRING:
- case OBJECT:
- case BOOL:
- case BOOLEAN:
- case REAL:
- case DOUBLE:
- case FLOAT:
- case INT:
- case INTEGER:
- expression = Type();
- pos = expression.sourceEnd+1;
- break;
- default:
- jj_la1[66] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[67] = jj_gen;
- ;
- }
- try {
- token = jj_consume_token(RBRACKET);
- pos = token.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "']' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {if (true) return new ArrayDeclarator(prefix,expression,pos);}
- break;
- case LBRACE:
- token = jj_consume_token(LBRACE);
- pos = token.sourceEnd+1;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case STRING:
- case OBJECT:
- case BOOL:
- case BOOLEAN:
- case REAL:
- case DOUBLE:
- case FLOAT:
- case INT:
- case INTEGER:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expression = Expression();
- pos = expression.sourceEnd+1;
- break;
- case STRING:
- case OBJECT:
- case BOOL:
- case BOOLEAN:
- case REAL:
- case DOUBLE:
- case FLOAT:
- case INT:
- case INTEGER:
- expression = Type();
- pos = expression.sourceEnd+1;
- break;
- default:
- jj_la1[68] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[69] = jj_gen;
- ;
- }
- try {
- token = jj_consume_token(RBRACE);
- pos = token.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "']' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {if (true) return new ArrayDeclarator(prefix,expression,pos);}
- break;
- default:
- jj_la1[70] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Literal Literal() throws ParseException {
- final Token token;
- StringLiteral literal;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case INTEGER_LITERAL:
- token = jj_consume_token(INTEGER_LITERAL);
- {if (true) return new NumberLiteral(token);}
- break;
- case FLOATING_POINT_LITERAL:
- token = jj_consume_token(FLOATING_POINT_LITERAL);
- {if (true) return new NumberLiteral(token);}
- break;
- case STRING_LITERAL:
- token = jj_consume_token(STRING_LITERAL);
- {if (true) return new StringLiteral(token);}
- break;
- case TRUE:
- token = jj_consume_token(TRUE);
- {if (true) return new TrueLiteral(token);}
- break;
- case FALSE:
- token = jj_consume_token(FALSE);
- {if (true) return new FalseLiteral(token);}
- break;
- case NULL:
- token = jj_consume_token(NULL);
- {if (true) return new NullLiteral(token);}
- break;
- case DOUBLEQUOTE:
- literal = evaluableString();
- {if (true) return literal;}
- break;
- default:
- jj_la1[71] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public StringLiteral evaluableString() throws ParseException {
- ArrayList list = new ArrayList();
- Token start,end;
- Token token,lbrace,rbrace;
- AbstractVariable var;
- Expression expr;
- start = jj_consume_token(DOUBLEQUOTE);
- label_20:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOLLARS:
- ;
- break;
- default:
- jj_la1[72] = jj_gen;
- break label_20;
- }
- jj_consume_token(DOLLARS);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENTIFIER:
- token = jj_consume_token(IDENTIFIER);
- list.add(new Variable(token.image,
- token.sourceStart,
- token.sourceEnd));
- break;
- case LBRACE1:
- lbrace = jj_consume_token(LBRACE1);
- token = jj_consume_token(ID);
- list.add(new Variable(token.image,
- token.sourceStart,
- token.sourceEnd));
- rbrace = jj_consume_token(RBRACE1);
- break;
- default:
- jj_la1[73] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- end = jj_consume_token(DOUBLEQUOTE2);
- AbstractVariable[] vars = new AbstractVariable[list.size()];
- list.toArray(vars);
- {if (true) return new StringLiteral(jj_input_stream.getCurrentBuffer().substring(start.sourceEnd,end.sourceStart),
- start.sourceStart,
- end.sourceEnd,
- vars);}
- throw new Error("Missing return statement in function");
- }
-
- final public FunctionCall Arguments(final Expression func) throws ParseException {
-Expression[] args = null;
-final Token token,lparen;
- lparen = jj_consume_token(LPAREN);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- args = ArgumentList();
- break;
- default:
- jj_la1[74] = jj_gen;
- ;
- }
- try {
- token = jj_consume_token(RPAREN);
- {if (true) return new FunctionCall(func,args,token.sourceEnd);}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list";
- errorLevel = ERROR;
- if (args == null) {
- errorStart = lparen.sourceEnd+1;
- errorEnd = lparen.sourceEnd+2;
- } else {
- errorStart = args[args.length-1].sourceEnd+1;
- errorEnd = args[args.length-1].sourceEnd+2;
- }
- processParseExceptionDebug(e);
- }
- int sourceEnd = (args == null && args.length != 0) ? lparen.sourceEnd+1 : args[args.length-1].sourceEnd;
- {if (true) return new FunctionCall(func,args,sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * An argument list is a list of arguments separated by comma :
- * argumentDeclaration() (, argumentDeclaration)*
- * @return an array of arguments
- */
- final public Expression[] ArgumentList() throws ParseException {
-Expression arg;
-final ArrayList list = new ArrayList();
-int pos;
-Token token;
- arg = Expression();
- list.add(arg);pos = arg.sourceEnd;
- label_21:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[75] = jj_gen;
- break label_21;
- }
- token = jj_consume_token(COMMA);
- pos = token.sourceEnd;
- try {
- arg = Expression();
- list.add(arg);
- pos = arg.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. An expression expected after a comma in argument list";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseException(e);
- }
- }
- final Expression[] arguments = new Expression[list.size()];
- list.toArray(arguments);
- {if (true) return arguments;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A Statement without break.
- * @return a statement
- */
- final public Statement StatementNoBreak() throws ParseException {
- final Statement statement;
- Token token = null;
- if (jj_2_4(2)) {
- statement = expressionStatement();
- {if (true) return statement;}
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IDENTIFIER:
- statement = LabeledStatement();
- {if (true) return statement;}
- break;
- case LBRACE:
- statement = Block();
- {if (true) return statement;}
- break;
- case SEMICOLON:
- statement = EmptyStatement();
- {if (true) return statement;}
- break;
- case SWITCH:
- statement = SwitchStatement();
- {if (true) return statement;}
- break;
- case IF:
- statement = IfStatement();
- {if (true) return statement;}
- break;
- case WHILE:
- statement = WhileStatement();
- {if (true) return statement;}
- break;
- case DO:
- statement = DoStatement();
- {if (true) return statement;}
- break;
- case FOR:
- statement = ForStatement();
- {if (true) return statement;}
- break;
- case FOREACH:
- statement = ForeachStatement();
- {if (true) return statement;}
- break;
- case CONTINUE:
- statement = ContinueStatement();
- {if (true) return statement;}
- break;
- case RETURN:
- statement = ReturnStatement();
- {if (true) return statement;}
- break;
- case ECHO:
- statement = EchoStatement();
- {if (true) return statement;}
- break;
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case AT:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case AT:
- token = jj_consume_token(AT);
- break;
- default:
- jj_la1[76] = jj_gen;
- ;
- }
- statement = IncludeStatement();
- if (token != null) {
- ((InclusionStatement)statement).silent = true;
- statement.sourceStart = token.sourceStart;
- }
- {if (true) return statement;}
- break;
- case STATIC:
- statement = StaticStatement();
- {if (true) return statement;}
- break;
- case GLOBAL:
- statement = GlobalStatement();
- {if (true) return statement;}
- break;
- case DEFINE:
- statement = defineStatement();
- currentSegment.add((Outlineable)statement);{if (true) return statement;}
- break;
- default:
- jj_la1[77] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A statement expression.
- * expression ;
- * @return an expression
- */
- final public Statement expressionStatement() throws ParseException {
- final Statement statement;
- final Token token;
- statement = Expression();
- try {
- token = jj_consume_token(SEMICOLON);
- statement.sourceEnd = token.sourceEnd;
- } catch (ParseException e) {
- if (e.currentToken.next.kind != PHPParserConstants.PHPEND) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
- errorLevel = ERROR;
- errorStart = statement.sourceEnd+1;
- errorEnd = statement.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- }
- {if (true) return statement;}
- throw new Error("Missing return statement in function");
- }
-
- final public Define defineStatement() throws ParseException {
- Expression defineName,defineValue;
- final Token defineToken;
- Token token;
- int pos;
- defineToken = jj_consume_token(DEFINE);
- pos = defineToken.sourceEnd+1;
- try {
- token = jj_consume_token(LPAREN);
- pos = token.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- try {
- defineName = Expression();
- pos = defineName.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- defineName = new StringLiteral(SYNTAX_ERROR_CHAR,pos,pos);
- }
- try {
- token = jj_consume_token(COMMA);
- pos = defineName.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- try {
- defineValue = Expression();
- pos = defineValue.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- defineValue = new StringLiteral(SYNTAX_ERROR_CHAR,pos,pos);
- }
- try {
- token = jj_consume_token(RPAREN);
- pos = token.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {if (true) return new Define(currentSegment,
- defineName,
- defineValue,
- defineToken.sourceStart,
- pos);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A Normal statement.
- */
- final public Statement Statement() throws ParseException {
- final Statement statement;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- statement = StatementNoBreak();
- {if (true) return statement;}
- break;
- case BREAK:
- statement = BreakStatement();
- {if (true) return statement;}
- break;
- default:
- jj_la1[78] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * An html block inside a php syntax.
- */
- final public HTMLBlock htmlBlock() throws ParseException {
- final int startIndex = nodePtr;
- final AstNode[] blockNodes;
- final int nbNodes;
- final Token phpEnd;
- phpEnd = jj_consume_token(PHPEND);
- htmlStart = phpEnd.sourceEnd;
- label_22:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPECHOSTART:
- ;
- break;
- default:
- jj_la1[79] = jj_gen;
- break label_22;
- }
- phpEchoBlock();
- }
- try {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPSTARTLONG:
- jj_consume_token(PHPSTARTLONG);
- break;
- case PHPSTARTSHORT:
- jj_consume_token(PHPSTARTSHORT);
- break;
- default:
- jj_la1[80] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- createNewHTMLCode();
- } catch (ParseException e) {
- errorMessage = "unexpected end of file , '<?php' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- {if (true) throw e;}
- }
- nbNodes = nodePtr - startIndex;
- if (nbNodes == 0) {
- {if (true) return null;}
- }
- blockNodes = new AstNode[nbNodes];
- System.arraycopy(nodes,startIndex+1,blockNodes,0,nbNodes);
- nodePtr = startIndex;
- {if (true) return new HTMLBlock(blockNodes);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * An include statement. It's "include" an expression;
- */
- final public InclusionStatement IncludeStatement() throws ParseException {
- Expression expr;
- final int keyword;
- final InclusionStatement inclusionStatement;
- final Token token, token2;
- int pos;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case REQUIRE:
- token = jj_consume_token(REQUIRE);
- keyword = InclusionStatement.REQUIRE;pos=token.sourceEnd;
- break;
- case REQUIRE_ONCE:
- token = jj_consume_token(REQUIRE_ONCE);
- keyword = InclusionStatement.REQUIRE_ONCE;pos=token.sourceEnd;
- break;
- case INCLUDE:
- token = jj_consume_token(INCLUDE);
- keyword = InclusionStatement.INCLUDE;pos=token.sourceEnd;
- break;
- case INCLUDE_ONCE:
- token = jj_consume_token(INCLUDE_ONCE);
- keyword = InclusionStatement.INCLUDE_ONCE;pos=token.sourceEnd;
- break;
- default:
- jj_la1[81] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- try {
- expr = Expression();
- pos = expr.sourceEnd;
- } catch (ParseException e) {
- if (errorMessage != null) {
- {if (true) throw e;}
- }
- errorMessage = "unexpected token '"+ e.currentToken.next.image+"', expression expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.next.sourceStart;
- errorEnd = e.currentToken.next.sourceEnd;
- expr = new ConstantIdentifier(SYNTAX_ERROR_CHAR,pos,pos);
- processParseExceptionDebug(e);
- }
- try {
- token2 = jj_consume_token(SEMICOLON);
- pos=token2.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.next.sourceStart;
- errorEnd = e.currentToken.next.sourceEnd;
- processParseExceptionDebug(e);
- }
- inclusionStatement = new InclusionStatement(currentSegment,
- keyword,
- expr,
- token.sourceStart,
- pos);
- currentSegment.add(inclusionStatement);
- {if (true) return inclusionStatement;}
- throw new Error("Missing return statement in function");
- }
-
- final public PrintExpression PrintExpression() throws ParseException {
- final Expression expr;
- final Token printToken;
- token = jj_consume_token(PRINT);
- expr = Expression();
- {if (true) return new PrintExpression(expr,token.sourceStart,expr.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public ListExpression ListExpression() throws ParseException {
- Expression expr = null;
- final Expression expression;
- final ArrayList list = new ArrayList();
- int pos;
- final Token listToken, rParen;
- Token token;
- listToken = jj_consume_token(LIST);
- pos = listToken.sourceEnd;
- try {
- token = jj_consume_token(LPAREN);
- pos = token.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected";
- errorLevel = ERROR;
- errorStart = listToken.sourceEnd+1;
- errorEnd = listToken.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOLLAR:
- expr = VariableDeclaratorId();
- list.add(expr);pos = expr.sourceEnd;
- break;
- default:
- jj_la1[82] = jj_gen;
- ;
- }
- if (expr == null) list.add(null);
- label_23:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[83] = jj_gen;
- break label_23;
- }
- try {
- token = jj_consume_token(COMMA);
- pos = token.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case DOLLAR:
- expr = VariableDeclaratorId();
- list.add(expr);pos = expr.sourceEnd;
- break;
- default:
- jj_la1[84] = jj_gen;
- ;
- }
- }
- try {
- rParen = jj_consume_token(RPAREN);
- pos = rParen.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ASSIGN:
- jj_consume_token(ASSIGN);
- expression = Expression();
- final AbstractVariable[] vars = new AbstractVariable[list.size()];
- list.toArray(vars);
- {if (true) return new ListExpression(vars,
- expression,
- listToken.sourceStart,
- expression.sourceEnd);}
- break;
- default:
- jj_la1[85] = jj_gen;
- ;
- }
- final AbstractVariable[] vars = new AbstractVariable[list.size()];
- list.toArray(vars);
- {if (true) return new ListExpression(vars,listToken.sourceStart,pos);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * An echo statement.
- * echo anyexpression (, otherexpression)*
- */
- final public EchoStatement EchoStatement() throws ParseException {
- final ArrayList expressions = new ArrayList();
- Expression expr;
- Token token;
- Token token2 = null;
- token = jj_consume_token(ECHO);
- expr = Expression();
- expressions.add(expr);
- label_24:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[86] = jj_gen;
- break label_24;
- }
- jj_consume_token(COMMA);
- expr = Expression();
- expressions.add(expr);
- }
- try {
- token2 = jj_consume_token(SEMICOLON);
- } catch (ParseException e) {
- if (e.currentToken.next.kind != 4) {
- errorMessage = "';' expected after 'echo' statement";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceEnd;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- }
- final Expression[] exprs = new Expression[expressions.size()];
- expressions.toArray(exprs);
- if (token2 == null) {
- {if (true) return new EchoStatement(exprs,token.sourceStart, exprs[exprs.length-1].sourceEnd);}
- }
- {if (true) return new EchoStatement(exprs,token.sourceStart, token2.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public GlobalStatement GlobalStatement() throws ParseException {
- Variable expr;
- final ArrayList vars = new ArrayList();
- final GlobalStatement global;
- final Token token, token2;
- int pos;
- token = jj_consume_token(GLOBAL);
- expr = Variable();
- vars.add(expr);pos = expr.sourceEnd+1;
- label_25:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[87] = jj_gen;
- break label_25;
- }
- jj_consume_token(COMMA);
- expr = Variable();
- vars.add(expr);pos = expr.sourceEnd+1;
- }
- try {
- token2 = jj_consume_token(SEMICOLON);
- pos = token2.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- final Variable[] variables = new Variable[vars.size()];
- vars.toArray(variables);
- global = new GlobalStatement(currentSegment,
- variables,
- token.sourceStart,
- pos);
- currentSegment.add(global);
- {if (true) return global;}
- throw new Error("Missing return statement in function");
- }
-
- final public StaticStatement StaticStatement() throws ParseException {
- final ArrayList vars = new ArrayList();
- VariableDeclaration expr;
- final Token token, token2;
- int pos;
- token = jj_consume_token(STATIC);
- expr = VariableDeclarator();
- vars.add(expr);pos = expr.sourceEnd+1;
- label_26:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[88] = jj_gen;
- break label_26;
- }
- jj_consume_token(COMMA);
- expr = VariableDeclarator();
- vars.add(expr);pos = expr.sourceEnd+1;
- }
- try {
- token2 = jj_consume_token(SEMICOLON);
- pos = token2.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseException(e);
- }
- final VariableDeclaration[] variables = new VariableDeclaration[vars.size()];
- vars.toArray(variables);
- {if (true) return new StaticStatement(variables,
- token.sourceStart,
- pos);}
- throw new Error("Missing return statement in function");
- }
-
- final public LabeledStatement LabeledStatement() throws ParseException {
- final Token label;
- final Statement statement;
- label = jj_consume_token(IDENTIFIER);
- jj_consume_token(COLON);
- statement = Statement();
- {if (true) return new LabeledStatement(label.image,statement,label.sourceStart,statement.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A Block is
- * {
- * statements
- * }.
- * @return a block
- */
- final public Block Block() throws ParseException {
- final ArrayList list = new ArrayList();
- Statement statement;
- final Token token, token2;
- int pos,start;
- try {
- token = jj_consume_token(LBRACE);
- pos = token.sourceEnd+1;start=token.sourceStart;
- } catch (ParseException e) {
- errorMessage = "'{' expected";
- errorLevel = ERROR;
- pos = this.token.sourceEnd+1;
- start=pos;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- label_27:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPEND:
- case CLASS:
- case FUNCTION:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[89] = jj_gen;
- break label_27;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CLASS:
- case FUNCTION:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- statement = BlockStatement();
- list.add(statement);pos = statement.sourceEnd+1;
- break;
- case PHPEND:
- statement = htmlBlock();
- if (statement != null) {
- list.add(statement);
- pos = statement.sourceEnd+1;
- }
- pos = this.token.sourceEnd+1;
- break;
- default:
- jj_la1[90] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- try {
- token2 = jj_consume_token(RBRACE);
- pos = token2.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.image +"', '}' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- final Statement[] statements = new Statement[list.size()];
- list.toArray(statements);
- {if (true) return new Block(statements,start,pos);}
- throw new Error("Missing return statement in function");
- }
-
- final public Statement BlockStatement() throws ParseException {
- final Statement statement;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- try {
- statement = Statement();
- if (phpDocument == currentSegment) pushOnAstNodes(statement);
- {if (true) return statement;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.image +"', a statement was expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- {if (true) throw e;}
- }
- break;
- case CLASS:
- statement = ClassDeclaration();
- {if (true) return statement;}
- break;
- case FUNCTION:
- statement = MethodDeclaration();
- if (phpDocument == currentSegment) pushOnAstNodes(statement);
- currentSegment.add((MethodDeclaration) statement);
- ((MethodDeclaration) statement).analyzeCode();
- {if (true) return statement;}
- break;
- default:
- jj_la1[91] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A Block statement that will not contain any 'break'
- */
- final public Statement BlockStatementNoBreak() throws ParseException {
- final Statement statement;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- statement = StatementNoBreak();
- {if (true) return statement;}
- break;
- case CLASS:
- statement = ClassDeclaration();
- {if (true) return statement;}
- break;
- case FUNCTION:
- statement = MethodDeclaration();
- currentSegment.add((MethodDeclaration) statement);
- ((MethodDeclaration) statement).analyzeCode();
- {if (true) return statement;}
- break;
- default:
- jj_la1[92] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * used only by ForInit()
- */
- final public Expression[] LocalVariableDeclaration() throws ParseException {
- final ArrayList list = new ArrayList();
- Expression var;
- var = Expression();
- list.add(var);
- label_28:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[93] = jj_gen;
- break label_28;
- }
- jj_consume_token(COMMA);
- var = Expression();
- list.add(var);
- }
- final Expression[] vars = new Expression[list.size()];
- list.toArray(vars);
- {if (true) return vars;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * used only by LocalVariableDeclaration().
- */
- final public VariableDeclaration LocalVariableDeclarator() throws ParseException {
- final Variable varName;
- Expression initializer = null;
- varName = Variable();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ASSIGN:
- jj_consume_token(ASSIGN);
- initializer = Expression();
- break;
- default:
- jj_la1[94] = jj_gen;
- ;
- }
- if (initializer == null) {
- {if (true) return new VariableDeclaration(currentSegment,
- varName,
- varName.sourceStart,
- varName.sourceEnd);}
- }
- {if (true) return new VariableDeclaration(currentSegment,
- varName,
- initializer,
- VariableDeclaration.EQUAL,
- varName.sourceStart);}
- throw new Error("Missing return statement in function");
- }
-
- final public EmptyStatement EmptyStatement() throws ParseException {
- final Token token;
- token = jj_consume_token(SEMICOLON);
- {if (true) return new EmptyStatement(token.sourceStart,token.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * used only by StatementExpressionList() which is used only by ForInit() and ForStatement()
- */
- final public Expression StatementExpression() throws ParseException {
- final Expression expr;
- final Token operator;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS_PLUS:
- case MINUS_MINUS:
- expr = PreIncDecExpression();
- {if (true) return expr;}
- break;
- case ARRAY:
- case NEW:
- case BIT_AND:
- case DOLLAR:
- case IDENTIFIER:
- expr = PrimaryExpression();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS_PLUS:
- case MINUS_MINUS:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PLUS_PLUS:
- operator = jj_consume_token(PLUS_PLUS);
- {if (true) return new PostfixedUnaryExpression(expr,
- OperatorIds.PLUS_PLUS,
- operator.sourceEnd);}
- break;
- case MINUS_MINUS:
- operator = jj_consume_token(MINUS_MINUS);
- {if (true) return new PostfixedUnaryExpression(expr,
- OperatorIds.MINUS_MINUS,
- operator.sourceEnd);}
- break;
- default:
- jj_la1[95] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- break;
- default:
- jj_la1[96] = jj_gen;
- ;
- }
- {if (true) return expr;}
- break;
- default:
- jj_la1[97] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public SwitchStatement SwitchStatement() throws ParseException {
- Expression variable;
- final AbstractCase[] cases;
- final Token switchToken,lparenToken,rparenToken;
- int pos;
- switchToken = jj_consume_token(SWITCH);
- pos = switchToken.sourceEnd+1;
- try {
- lparenToken = jj_consume_token(LPAREN);
- pos = lparenToken.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "'(' expected after 'switch'";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- try {
- variable = Expression();
- pos = variable.sourceEnd+1;
- } catch (ParseException e) {
- if (errorMessage != null) {
- {if (true) throw e;}
- }
- errorMessage = "expression expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- variable = new ConstantIdentifier(SYNTAX_ERROR_CHAR,pos,pos);
- }
- try {
- rparenToken = jj_consume_token(RPAREN);
- pos = rparenToken.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "')' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LBRACE:
- cases = switchStatementBrace();
- break;
- case COLON:
- cases = switchStatementColon(switchToken.sourceStart, switchToken.sourceEnd);
- break;
- default:
- jj_la1[98] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- {if (true) return new SwitchStatement(variable,
- cases,
- switchToken.sourceStart,
- this.token.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public AbstractCase[] switchStatementBrace() throws ParseException {
- AbstractCase cas;
- final ArrayList cases = new ArrayList();
- Token token;
- int pos;
- token = jj_consume_token(LBRACE);
- pos = token.sourceEnd;
- label_29:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CASE:
- case _DEFAULT:
- ;
- break;
- default:
- jj_la1[99] = jj_gen;
- break label_29;
- }
- cas = switchLabel0();
- cases.add(cas);pos = cas.sourceEnd;
- }
- try {
- token = jj_consume_token(RBRACE);
- pos = token.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "'}' expected";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- final AbstractCase[] abcase = new AbstractCase[cases.size()];
- cases.toArray(abcase);
- {if (true) return abcase;}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A Switch statement with : ... endswitch;
- * @param start the begin offset of the switch
- * @param end the end offset of the switch
- */
- final public AbstractCase[] switchStatementColon(final int start, final int end) throws ParseException {
- AbstractCase cas;
- final ArrayList cases = new ArrayList();
- Token token;
- int pos;
- token = jj_consume_token(COLON);
- pos = token.sourceEnd;
- try {
- setMarker(fileToParse,
- "Ugly syntax detected, you should switch () {...} instead of switch (): ... enswitch;",
- start,
- end,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- label_30:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CASE:
- case _DEFAULT:
- ;
- break;
- default:
- jj_la1[100] = jj_gen;
- break label_30;
- }
- cas = switchLabel0();
- cases.add(cas);pos = cas.sourceEnd;
- }
- try {
- token = jj_consume_token(ENDSWITCH);
- pos = token.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "'endswitch' expected";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- try {
- token = jj_consume_token(SEMICOLON);
- pos = token.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "';' expected after 'endswitch' keyword";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- final AbstractCase[] abcase = new AbstractCase[cases.size()];
- cases.toArray(abcase);
- {if (true) return abcase;}
- throw new Error("Missing return statement in function");
- }
-
- final public AbstractCase switchLabel0() throws ParseException {
- final Expression expr;
- Statement statement;
- final ArrayList stmts = new ArrayList();
- final Token token = this.token;
- final int start = this.token.next.sourceStart;
- expr = SwitchLabel();
- label_31:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPEND:
- case CLASS:
- case FUNCTION:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[101] = jj_gen;
- break label_31;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CLASS:
- case FUNCTION:
- case IF:
- case ARRAY:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- statement = BlockStatementNoBreak();
- stmts.add(statement);
- break;
- case PHPEND:
- statement = htmlBlock();
- if (statement != null) {stmts.add(statement);}
- break;
- case BREAK:
- statement = BreakStatement();
- stmts.add(statement);
- break;
- default:
- jj_la1[102] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- final int listSize = stmts.size();
- final Statement[] stmtsArray = new Statement[listSize];
- stmts.toArray(stmtsArray);
- if (expr == null) {//it's a default
- final int end = this.token.next.sourceStart;
- {if (true) return new DefaultCase(stmtsArray,start,end);}
- }
- if (listSize != 0) {
- {if (true) return new Case(expr,stmtsArray,expr.sourceStart,stmtsArray[listSize-1].sourceEnd);}
- } else {
- {if (true) return new Case(expr,stmtsArray,expr.sourceStart,expr.sourceEnd);}
- }
- throw new Error("Missing return statement in function");
- }
-
-/**
- * A SwitchLabel.
- * case Expression() :
- * default :
- * @return the if it was a case and null if not
- */
- final public Expression SwitchLabel() throws ParseException {
- final Expression expr;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case CASE:
- token = jj_consume_token(CASE);
- try {
- expr = Expression();
- } catch (ParseException e) {
- if (errorMessage != null) {if (true) throw e;}
- errorMessage = "expression expected after 'case' keyword";
- errorLevel = ERROR;
- errorStart = token.sourceEnd +1;
- errorEnd = token.sourceEnd +1;
- {if (true) throw e;}
- }
- try {
- token = jj_consume_token(COLON);
- } catch (ParseException e) {
- errorMessage = "':' expected after case expression";
- errorLevel = ERROR;
- errorStart = expr.sourceEnd+1;
- errorEnd = expr.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- {if (true) return expr;}
- break;
- case _DEFAULT:
- token = jj_consume_token(_DEFAULT);
- try {
- jj_consume_token(COLON);
- } catch (ParseException e) {
- errorMessage = "':' expected after 'default' keyword";
- errorLevel = ERROR;
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- {if (true) return null;}
- break;
- default:
- jj_la1[103] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Break BreakStatement() throws ParseException {
- Expression expression = null;
- final Token token, token2;
- int pos;
- token = jj_consume_token(BREAK);
- pos = token.sourceEnd+1;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expression = Expression();
- pos = expression.sourceEnd+1;
- break;
- default:
- jj_la1[104] = jj_gen;
- ;
- }
- try {
- token2 = jj_consume_token(SEMICOLON);
- pos = token2.sourceEnd;
- } catch (ParseException e) {
- errorMessage = "';' expected after 'break' keyword";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {if (true) return new Break(expression, token.sourceStart, pos);}
- throw new Error("Missing return statement in function");
- }
-
- final public IfStatement IfStatement() throws ParseException {
- final Expression condition;
- final IfStatement ifStatement;
- Token token;
- token = jj_consume_token(IF);
- condition = Condition("if");
- ifStatement = IfStatement0(condition,token.sourceStart,token.sourceEnd);
- {if (true) return ifStatement;}
- throw new Error("Missing return statement in function");
- }
-
- final public Expression Condition(final String keyword) throws ParseException {
- final Expression condition;
- try {
- jj_consume_token(LPAREN);
- } catch (ParseException e) {
- errorMessage = "'(' expected after " + keyword + " keyword";
- errorLevel = ERROR;
- errorStart = this.token.sourceEnd + 1;
- errorEnd = this.token.sourceEnd + 1;
- processParseExceptionDebug(e);
- }
- condition = Expression();
- try {
- jj_consume_token(RPAREN);
- } catch (ParseException e) {
- errorMessage = "')' expected after " + keyword + " keyword";
- errorLevel = ERROR;
- errorStart = condition.sourceEnd+1;
- errorEnd = condition.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- {if (true) return condition;}
- throw new Error("Missing return statement in function");
- }
-
- final public IfStatement IfStatement0(final Expression condition, final int start,final int end) throws ParseException {
- Statement statement;
- final Statement stmt;
- final Statement[] statementsArray;
- ElseIf elseifStatement;
- Else elseStatement = null;
- final ArrayList stmts;
- final ArrayList elseIfList = new ArrayList();
- final ElseIf[] elseIfs;
- int pos = jj_input_stream.getPosition();
- final int endStatements;
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- stmts = new ArrayList();
- label_32:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPEND:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[105] = jj_gen;
- break label_32;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- statement = Statement();
- stmts.add(statement);
- break;
- case PHPEND:
- statement = htmlBlock();
- if (statement != null) {stmts.add(statement);}
- break;
- default:
- jj_la1[106] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- endStatements = jj_input_stream.getPosition();
- label_33:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ELSEIF:
- ;
- break;
- default:
- jj_la1[107] = jj_gen;
- break label_33;
- }
- elseifStatement = ElseIfStatementColon();
- elseIfList.add(elseifStatement);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ELSE:
- elseStatement = ElseStatementColon();
- break;
- default:
- jj_la1[108] = jj_gen;
- ;
- }
- try {
- setMarker(fileToParse,
- "Ugly syntax detected, you should if () {...} instead of if (): ... endif;",
- start,
- end,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- try {
- jj_consume_token(ENDIF);
- } catch (ParseException e) {
- errorMessage = "'endif' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- {if (true) throw e;}
- }
- try {
- jj_consume_token(SEMICOLON);
- } catch (ParseException e) {
- errorMessage = "';' expected after 'endif' keyword";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- {if (true) throw e;}
- }
- elseIfs = new ElseIf[elseIfList.size()];
- elseIfList.toArray(elseIfs);
- if (stmts.size() == 1) {
- {if (true) return new IfStatement(condition,
- (Statement) stmts.get(0),
- elseIfs,
- elseStatement,
- pos,
- jj_input_stream.getPosition());}
- } else {
- statementsArray = new Statement[stmts.size()];
- stmts.toArray(statementsArray);
- {if (true) return new IfStatement(condition,
- new Block(statementsArray,pos,endStatements),
- elseIfs,
- elseStatement,
- pos,
- jj_input_stream.getPosition());}
- }
- break;
- case PHPEND:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- stmt = Statement();
- break;
- case PHPEND:
- stmt = htmlBlock();
- break;
- default:
- jj_la1[109] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- label_34:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ELSEIF:
- ;
- break;
- default:
- jj_la1[110] = jj_gen;
- break label_34;
- }
- elseifStatement = ElseIfStatement();
- elseIfList.add(elseifStatement);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ELSE:
- jj_consume_token(ELSE);
- try {
- pos = jj_input_stream.getPosition();
- statement = Statement();
- elseStatement = new Else(statement,pos,jj_input_stream.getPosition());
- } catch (ParseException e) {
- if (errorMessage != null) {
- {if (true) throw e;}
- }
- errorMessage = "unexpected token '"+e.currentToken.next.image+"', a statement was expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- {if (true) throw e;}
- }
- break;
- default:
- jj_la1[111] = jj_gen;
- ;
- }
- elseIfs = new ElseIf[elseIfList.size()];
- elseIfList.toArray(elseIfs);
- {if (true) return new IfStatement(condition,
- stmt,
- elseIfs,
- elseStatement,
- pos,
- jj_input_stream.getPosition());}
- break;
- default:
- jj_la1[112] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public ElseIf ElseIfStatementColon() throws ParseException {
- final Expression condition;
- Statement statement;
- final ArrayList list = new ArrayList();
- final Token elseifToken;
- elseifToken = jj_consume_token(ELSEIF);
- condition = Condition("elseif");
- jj_consume_token(COLON);
- label_35:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPEND:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[113] = jj_gen;
- break label_35;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- statement = Statement();
- list.add(statement);
- break;
- case PHPEND:
- statement = htmlBlock();
- if (statement != null) {list.add(statement);}
- break;
- default:
- jj_la1[114] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- final int sizeList = list.size();
- final Statement[] stmtsArray = new Statement[sizeList];
- list.toArray(stmtsArray);
- {if (true) return new ElseIf(condition,stmtsArray ,
- elseifToken.sourceStart,
- stmtsArray[sizeList-1].sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public Else ElseStatementColon() throws ParseException {
- Statement statement;
- final ArrayList list = new ArrayList();
- final Token elseToken;
- elseToken = jj_consume_token(ELSE);
- jj_consume_token(COLON);
- label_36:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case PHPEND:
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[115] = jj_gen;
- break label_36;
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- statement = Statement();
- list.add(statement);
- break;
- case PHPEND:
- statement = htmlBlock();
- if (statement != null) {list.add(statement);}
- break;
- default:
- jj_la1[116] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- final int sizeList = list.size();
- final Statement[] stmtsArray = new Statement[sizeList];
- list.toArray(stmtsArray);
- {if (true) return new Else(stmtsArray,elseToken.sourceStart,stmtsArray[sizeList-1].sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public ElseIf ElseIfStatement() throws ParseException {
- final Expression condition;
- //final Statement statement;
- final Token elseifToken;
- final Statement[] statement = new Statement[1];
- elseifToken = jj_consume_token(ELSEIF);
- condition = Condition("elseif");
- statement[0] = Statement();
- {if (true) return new ElseIf(condition,statement,elseifToken.sourceStart,statement[0].sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public WhileStatement WhileStatement() throws ParseException {
- final Expression condition;
- final Statement action;
- final Token whileToken;
- whileToken = jj_consume_token(WHILE);
- condition = Condition("while");
- action = WhileStatement0(whileToken.sourceStart,whileToken.sourceEnd);
- {if (true) return new WhileStatement(condition,action,whileToken.sourceStart,action.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public Statement WhileStatement0(final int start, final int end) throws ParseException {
- Statement statement;
- final ArrayList stmts = new ArrayList();
- final int pos = jj_input_stream.getPosition();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COLON:
- jj_consume_token(COLON);
- label_37:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[117] = jj_gen;
- break label_37;
- }
- statement = Statement();
- stmts.add(statement);
- }
- try {
- setMarker(fileToParse,
- "Ugly syntax detected, you should while () {...} instead of while (): ... endwhile;",
- start,
- end,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- try {
- jj_consume_token(ENDWHILE);
- } catch (ParseException e) {
- errorMessage = "'endwhile' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- {if (true) throw e;}
- }
- try {
- jj_consume_token(SEMICOLON);
- final Statement[] stmtsArray = new Statement[stmts.size()];
- stmts.toArray(stmtsArray);
- {if (true) return new Block(stmtsArray,pos,jj_input_stream.getPosition());}
- } catch (ParseException e) {
- errorMessage = "';' expected after 'endwhile' keyword";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- {if (true) throw e;}
- }
- break;
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- statement = Statement();
- {if (true) return statement;}
- break;
- default:
- jj_la1[118] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public DoStatement DoStatement() throws ParseException {
- final Statement action;
- final Expression condition;
- final Token token;
- Token token2 = null;
- token = jj_consume_token(DO);
- action = Statement();
- jj_consume_token(WHILE);
- condition = Condition("while");
- try {
- token2 = jj_consume_token(SEMICOLON);
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
- errorLevel = ERROR;
- errorStart = condition.sourceEnd+1;
- errorEnd = condition.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- if (token2 == null) {
- {if (true) return new DoStatement(condition,action,token.sourceStart,condition.sourceEnd);}
- }
- {if (true) return new DoStatement(condition,action,token.sourceStart,token2.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public ForeachStatement ForeachStatement() throws ParseException {
- Statement statement = null;
- Expression expression = null;
- ArrayVariableDeclaration variable = null;
- Token foreachToken;
- Token lparenToken = null;
- Token asToken = null;
- Token rparenToken = null;
- int pos;
- foreachToken = jj_consume_token(FOREACH);
- try {
- lparenToken = jj_consume_token(LPAREN);
- pos = lparenToken.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "'(' expected after 'foreach' keyword";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- {pos = foreachToken.sourceEnd+1;}
- }
- try {
- expression = Expression();
- pos = expression.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "variable expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- try {
- asToken = jj_consume_token(AS);
- pos = asToken.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "'as' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- try {
- variable = ArrayVariable();
- pos = variable.sourceEnd+1;
- } catch (ParseException e) {
- if (errorMessage != null) {if (true) throw e;}
- errorMessage = "variable expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- try {
- rparenToken = jj_consume_token(RPAREN);
- pos = rparenToken.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "')' expected after 'foreach' keyword";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- try {
- statement = Statement();
- pos = statement.sourceEnd+1;
- } catch (ParseException e) {
- if (errorMessage != null) {if (true) throw e;}
- errorMessage = "statement expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- {if (true) return new ForeachStatement(expression,
- variable,
- statement,
- foreachToken.sourceStart,
- pos);}
- throw new Error("Missing return statement in function");
- }
-
-/**
- * a for declaration.
- * @return a node representing the for statement
- */
- final public ForStatement ForStatement() throws ParseException {
-final Token token,tokenEndFor,token2,tokenColon;
-int pos;
-Expression[] initializations = null;
-Expression condition = null;
-Expression[] increments = null;
-Statement action;
-final ArrayList list = new ArrayList();
- token = jj_consume_token(FOR);
- try {
- jj_consume_token(LPAREN);
- } catch (ParseException e) {
- errorMessage = "'(' expected after 'for' keyword";
- errorLevel = ERROR;
- errorStart = token.sourceEnd;
- errorEnd = token.sourceEnd +1;
- processParseExceptionDebug(e);
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- initializations = ForInit();
- break;
- default:
- jj_la1[119] = jj_gen;
- ;
- }
- jj_consume_token(SEMICOLON);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- condition = Expression();
- break;
- default:
- jj_la1[120] = jj_gen;
- ;
- }
- jj_consume_token(SEMICOLON);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- increments = StatementExpressionList();
- break;
- default:
- jj_la1[121] = jj_gen;
- ;
- }
- jj_consume_token(RPAREN);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- action = Statement();
- {if (true) return new ForStatement(initializations,
- condition,
- increments,
- action,
- token.sourceStart,
- action.sourceEnd);}
- break;
- case COLON:
- tokenColon = jj_consume_token(COLON);
- pos = tokenColon.sourceEnd+1;
- label_38:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case IF:
- case ARRAY:
- case BREAK:
- case LIST:
- case PRINT:
- case ECHO:
- case INCLUDE:
- case REQUIRE:
- case INCLUDE_ONCE:
- case REQUIRE_ONCE:
- case GLOBAL:
- case DEFINE:
- case STATIC:
- case CONTINUE:
- case DO:
- case FOR:
- case NEW:
- case NULL:
- case RETURN:
- case SWITCH:
- case TRUE:
- case FALSE:
- case WHILE:
- case FOREACH:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- case LBRACE:
- case SEMICOLON:
- ;
- break;
- default:
- jj_la1[122] = jj_gen;
- break label_38;
- }
- action = Statement();
- list.add(action);pos = action.sourceEnd+1;
- }
- try {
- setMarker(fileToParse,
- "Ugly syntax detected, you should for () {...} instead of for (): ... endfor;",
- token.sourceStart,
- token.sourceEnd,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- try {
- tokenEndFor = jj_consume_token(ENDFOR);
- pos = tokenEndFor.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "'endfor' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- try {
- token2 = jj_consume_token(SEMICOLON);
- pos = token2.sourceEnd+1;
- } catch (ParseException e) {
- errorMessage = "';' expected after 'endfor' keyword";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- final Statement[] stmtsArray = new Statement[list.size()];
- list.toArray(stmtsArray);
- {if (true) return new ForStatement(initializations,
- condition,
- increments,
- new Block(stmtsArray,
- stmtsArray[0].sourceStart,
- stmtsArray[stmtsArray.length-1].sourceEnd),
- token.sourceStart,
- pos);}
- break;
- default:
- jj_la1[123] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression[] ForInit() throws ParseException {
- final Expression[] exprs;
- if (jj_2_5(2147483647)) {
- exprs = LocalVariableDeclaration();
- {if (true) return exprs;}
- } else {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- exprs = StatementExpressionList();
- {if (true) return exprs;}
- break;
- default:
- jj_la1[124] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- }
- throw new Error("Missing return statement in function");
- }
-
- final public Expression[] StatementExpressionList() throws ParseException {
- final ArrayList list = new ArrayList();
- final Expression expr;
- expr = Expression();
- list.add(expr);
- label_39:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case COMMA:
- ;
- break;
- default:
- jj_la1[125] = jj_gen;
- break label_39;
- }
- jj_consume_token(COMMA);
- Expression();
- list.add(expr);
- }
- final Expression[] exprsArray = new Expression[list.size()];
- list.toArray(exprsArray);
- {if (true) return exprsArray;}
- throw new Error("Missing return statement in function");
- }
-
- final public Continue ContinueStatement() throws ParseException {
- Expression expr = null;
- final Token token;
- Token token2 = null;
- token = jj_consume_token(CONTINUE);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expr = Expression();
- break;
- default:
- jj_la1[126] = jj_gen;
- ;
- }
- try {
- token2 = jj_consume_token(SEMICOLON);
- } catch (ParseException e) {
- errorMessage = "';' expected after 'continue' statement";
- errorLevel = ERROR;
- if (expr == null) {
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- } else {
- errorStart = expr.sourceEnd+1;
- errorEnd = expr.sourceEnd+1;
- }
- processParseExceptionDebug(e);
- }
- if (token2 == null) {
- if (expr == null) {
- {if (true) return new Continue(expr,token.sourceStart,token.sourceEnd);}
- }
- {if (true) return new Continue(expr,token.sourceStart,expr.sourceEnd);}
- }
- {if (true) return new Continue(expr,token.sourceStart,token2.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final public ReturnStatement ReturnStatement() throws ParseException {
- Expression expr = null;
- final Token token;
- Token token2 = null;
- token = jj_consume_token(RETURN);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ARRAY:
- case LIST:
- case PRINT:
- case NEW:
- case NULL:
- case TRUE:
- case FALSE:
- case AT:
- case BANG:
- case TILDE:
- case PLUS_PLUS:
- case MINUS_MINUS:
- case PLUS:
- case MINUS:
- case BIT_AND:
- case INTEGER_LITERAL:
- case FLOATING_POINT_LITERAL:
- case STRING_LITERAL:
- case DOUBLEQUOTE:
- case DOLLAR:
- case IDENTIFIER:
- case LPAREN:
- expr = Expression();
- break;
- default:
- jj_la1[127] = jj_gen;
- ;
- }
- try {
- token2 = jj_consume_token(SEMICOLON);
- } catch (ParseException e) {
- errorMessage = "';' expected after 'return' statement";
- errorLevel = ERROR;
- if (expr == null) {
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- } else {
- errorStart = expr.sourceEnd+1;
- errorEnd = expr.sourceEnd+1;
- }
- processParseExceptionDebug(e);
- }
- if (token2 == null) {
- if (expr == null) {
- {if (true) return new ReturnStatement(expr,token.sourceStart,token.sourceEnd);}
- }
- {if (true) return new ReturnStatement(expr,token.sourceStart,expr.sourceEnd);}
- }
- {if (true) return new ReturnStatement(expr,token.sourceStart,token2.sourceEnd);}
- throw new Error("Missing return statement in function");
- }
-
- final private boolean jj_2_1(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- boolean retval = !jj_3_1();
- jj_save(0, xla);
- return retval;
- }
-
- final private boolean jj_2_2(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- boolean retval = !jj_3_2();
- jj_save(1, xla);
- return retval;
- }
-
- final private boolean jj_2_3(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- boolean retval = !jj_3_3();
- jj_save(2, xla);
- return retval;
- }
-
- final private boolean jj_2_4(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- boolean retval = !jj_3_4();
- jj_save(3, xla);
- return retval;
- }
-
- final private boolean jj_2_5(int xla) {
- jj_la = xla; jj_lastpos = jj_scanpos = token;
- boolean retval = !jj_3_5();
- jj_save(4, xla);
- return retval;
- }
-
- final private boolean jj_3R_210() {
- if (jj_3R_116()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_209() {
- if (jj_3R_50()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_109() {
- if (jj_3R_114()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_115()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_208() {
- if (jj_scan_token(IDENTIFIER)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_203() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_208()) {
- jj_scanpos = xsp;
- if (jj_3R_209()) {
- jj_scanpos = xsp;
- if (jj_3R_210()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_110() {
- if (jj_scan_token(BIT_OR)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_109()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_103() {
- if (jj_3R_109()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_110()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_188() {
- if (jj_scan_token(ARRAY)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_198()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_132() {
- if (jj_scan_token(IDENTIFIER)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_106() {
- if (jj_scan_token(DOT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_103()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_131() {
- if (jj_scan_token(LBRACE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RBRACE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_97() {
- if (jj_3R_103()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_106()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_204() {
- if (jj_3R_207()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_122() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_130()) {
- jj_scanpos = xsp;
- if (jj_3R_131()) {
- jj_scanpos = xsp;
- if (jj_3R_132()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_130() {
- if (jj_scan_token(DOLLAR)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_122()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_108() {
- if (jj_scan_token(_ANDL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_107() {
- if (jj_scan_token(AND_AND)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_100() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_107()) {
- jj_scanpos = xsp;
- if (jj_3R_108()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_97()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_81() {
- if (jj_3R_97()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_100()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_79() {
- if (jj_scan_token(HOOK)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(COLON)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_73()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_195() {
- if (jj_scan_token(NEW)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_203()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_204()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_68() {
- if (jj_scan_token(DOLLAR)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_122()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_202() {
- if (jj_3R_207()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_194() {
- if (jj_3R_116()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_202()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_102() {
- if (jj_scan_token(_ORL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_101() {
- if (jj_scan_token(OR_OR)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_83() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_101()) {
- jj_scanpos = xsp;
- if (jj_3R_102()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_81()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3_1() {
- if (jj_3R_40()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_201() {
- if (jj_3R_207()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_76() {
- if (jj_3R_81()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_83()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_51() {
- if (jj_scan_token(COMMA)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_200() {
- if (jj_scan_token(STATICCLASSACCESS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_203()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_116() {
- if (jj_3R_68()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3_1()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_45() {
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_51()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_193() {
- if (jj_scan_token(IDENTIFIER)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_200()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- xsp = jj_scanpos;
- if (jj_3R_201()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_187() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_193()) {
- jj_scanpos = xsp;
- if (jj_3R_194()) {
- jj_scanpos = xsp;
- if (jj_3R_195()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_73() {
- if (jj_3R_76()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_79()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_178() {
- if (jj_3R_188()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3_5() {
- if (jj_3R_45()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_186() {
- if (jj_scan_token(BIT_AND)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_96() {
- if (jj_scan_token(TILDEEQUAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_95() {
- if (jj_scan_token(DOTASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_173() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_177()) {
- jj_scanpos = xsp;
- if (jj_3R_178()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_177() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_186()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_187()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_94() {
- if (jj_scan_token(ORASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_93() {
- if (jj_scan_token(XORASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_92() {
- if (jj_scan_token(ANDASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_91() {
- if (jj_scan_token(RSIGNEDSHIFTASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_90() {
- if (jj_scan_token(LSHIFTASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_89() {
- if (jj_scan_token(MINUSASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_88() {
- if (jj_scan_token(PLUSASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_87() {
- if (jj_scan_token(REMASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_86() {
- if (jj_scan_token(SLASHASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_85() {
- if (jj_scan_token(STARASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_84() {
- if (jj_scan_token(ASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_80() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_84()) {
- jj_scanpos = xsp;
- if (jj_3R_85()) {
- jj_scanpos = xsp;
- if (jj_3R_86()) {
- jj_scanpos = xsp;
- if (jj_3R_87()) {
- jj_scanpos = xsp;
- if (jj_3R_88()) {
- jj_scanpos = xsp;
- if (jj_3R_89()) {
- jj_scanpos = xsp;
- if (jj_3R_90()) {
- jj_scanpos = xsp;
- if (jj_3R_91()) {
- jj_scanpos = xsp;
- if (jj_3R_92()) {
- jj_scanpos = xsp;
- if (jj_3R_93()) {
- jj_scanpos = xsp;
- if (jj_3R_94()) {
- jj_scanpos = xsp;
- if (jj_3R_95()) {
- jj_scanpos = xsp;
- if (jj_3R_96()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_197() {
- if (jj_scan_token(MINUS_MINUS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_196() {
- if (jj_scan_token(PLUS_PLUS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_191() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_196()) {
- jj_scanpos = xsp;
- if (jj_3R_197()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_175() {
- if (jj_3R_173()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_191()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_99() {
- if (jj_3R_105()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_98() {
- if (jj_3R_104()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_82() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_98()) {
- jj_scanpos = xsp;
- if (jj_3R_99()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_190() {
- if (jj_scan_token(ARRAY)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_189() {
- if (jj_3R_50()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_78() {
- if (jj_3R_82()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_43() {
- if (jj_scan_token(ARRAY)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_77() {
- if (jj_scan_token(BANG)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_74()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_74() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_77()) {
- jj_scanpos = xsp;
- if (jj_3R_78()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_174() {
- if (jj_scan_token(LPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_189()) {
- jj_scanpos = xsp;
- if (jj_3R_190()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_144()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_42() {
- if (jj_3R_50()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_58() {
- if (jj_3R_74()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3_3() {
- if (jj_scan_token(LPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_42()) {
- jj_scanpos = xsp;
- if (jj_3R_43()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_172() {
- if (jj_scan_token(LPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_171() {
- if (jj_3R_176()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_170() {
- if (jj_3R_175()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_166() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_169()) {
- jj_scanpos = xsp;
- if (jj_3R_170()) {
- jj_scanpos = xsp;
- if (jj_3R_171()) {
- jj_scanpos = xsp;
- if (jj_3R_172()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_169() {
- if (jj_3R_174()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_44() {
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(SEMICOLON)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_168() {
- if (jj_scan_token(MINUS_MINUS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_167() {
- if (jj_scan_token(PLUS_PLUS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_75() {
- if (jj_3R_80()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_165() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_167()) {
- jj_scanpos = xsp;
- if (jj_3R_168()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_173()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_49() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_57()) {
- jj_scanpos = xsp;
- if (jj_3R_58()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_57() {
- if (jj_3R_73()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_75()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_67() {
- if (jj_scan_token(OBJECT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_161() {
- if (jj_3R_166()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_66() {
- if (jj_scan_token(INTEGER)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_65() {
- if (jj_scan_token(INT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_64() {
- if (jj_scan_token(FLOAT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_160() {
- if (jj_3R_165()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_63() {
- if (jj_scan_token(DOUBLE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_62() {
- if (jj_scan_token(REAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_61() {
- if (jj_scan_token(BOOLEAN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_60() {
- if (jj_scan_token(BOOL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_159() {
- if (jj_scan_token(MINUS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_148()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_50() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_59()) {
- jj_scanpos = xsp;
- if (jj_3R_60()) {
- jj_scanpos = xsp;
- if (jj_3R_61()) {
- jj_scanpos = xsp;
- if (jj_3R_62()) {
- jj_scanpos = xsp;
- if (jj_3R_63()) {
- jj_scanpos = xsp;
- if (jj_3R_64()) {
- jj_scanpos = xsp;
- if (jj_3R_65()) {
- jj_scanpos = xsp;
- if (jj_3R_66()) {
- jj_scanpos = xsp;
- if (jj_3R_67()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_59() {
- if (jj_scan_token(STRING)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_156() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_158()) {
- jj_scanpos = xsp;
- if (jj_3R_159()) {
- jj_scanpos = xsp;
- if (jj_3R_160()) {
- jj_scanpos = xsp;
- if (jj_3R_161()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_158() {
- if (jj_scan_token(PLUS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_148()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3_4() {
- if (jj_3R_44()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_164() {
- if (jj_3R_156()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_163() {
- if (jj_scan_token(BANG)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_157()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_157() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_162()) {
- jj_scanpos = xsp;
- if (jj_3R_163()) {
- jj_scanpos = xsp;
- if (jj_3R_164()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_162() {
- if (jj_scan_token(AT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_157()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_155() {
- if (jj_3R_156()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_216() {
- if (jj_scan_token(COMMA)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_154() {
- if (jj_scan_token(BANG)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_157()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_215() {
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_216()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_153() {
- if (jj_scan_token(TILDE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_148()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_148() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_152()) {
- jj_scanpos = xsp;
- if (jj_3R_153()) {
- jj_scanpos = xsp;
- if (jj_3R_154()) {
- jj_scanpos = xsp;
- if (jj_3R_155()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_152() {
- if (jj_scan_token(AT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_148()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_213() {
- if (jj_3R_215()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_144() {
- if (jj_3R_148()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_151() {
- if (jj_scan_token(REMAINDER)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_150() {
- if (jj_scan_token(SLASH)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_149() {
- if (jj_scan_token(STAR)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_207() {
- if (jj_scan_token(LPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_213()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_145() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_149()) {
- jj_scanpos = xsp;
- if (jj_3R_150()) {
- jj_scanpos = xsp;
- if (jj_3R_151()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_144()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_139() {
- if (jj_3R_144()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_145()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_212() {
- if (jj_scan_token(LBRACE1)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(ID)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RBRACE1)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_147() {
- if (jj_scan_token(MINUS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_211() {
- if (jj_scan_token(IDENTIFIER)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_146() {
- if (jj_scan_token(PLUS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_140() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_146()) {
- jj_scanpos = xsp;
- if (jj_3R_147()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_139()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_199() {
- if (jj_scan_token(DOLLARS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_211()) {
- jj_scanpos = xsp;
- if (jj_3R_212()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_133() {
- if (jj_3R_139()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_140()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_192() {
- if (jj_scan_token(DOUBLEQUOTE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_199()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- if (jj_scan_token(DOUBLEQUOTE2)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_113() {
- if (jj_scan_token(ASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_143() {
- if (jj_scan_token(RUNSIGNEDSHIFT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_142() {
- if (jj_scan_token(RSIGNEDSHIFT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_141() {
- if (jj_scan_token(LSHIFT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_185() {
- if (jj_3R_192()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_184() {
- if (jj_scan_token(NULL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_134() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_141()) {
- jj_scanpos = xsp;
- if (jj_3R_142()) {
- jj_scanpos = xsp;
- if (jj_3R_143()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_133()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_183() {
- if (jj_scan_token(FALSE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_182() {
- if (jj_scan_token(TRUE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_123() {
- if (jj_3R_133()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_134()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_181() {
- if (jj_scan_token(STRING_LITERAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_180() {
- if (jj_scan_token(FLOATING_POINT_LITERAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_117() {
- if (jj_3R_116()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_179() {
- if (jj_scan_token(INTEGER_LITERAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_176() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_179()) {
- jj_scanpos = xsp;
- if (jj_3R_180()) {
- jj_scanpos = xsp;
- if (jj_3R_181()) {
- jj_scanpos = xsp;
- if (jj_3R_182()) {
- jj_scanpos = xsp;
- if (jj_3R_183()) {
- jj_scanpos = xsp;
- if (jj_3R_184()) {
- jj_scanpos = xsp;
- if (jj_3R_185()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_138() {
- if (jj_scan_token(GE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_137() {
- if (jj_scan_token(LE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_136() {
- if (jj_scan_token(GT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_112() {
- if (jj_scan_token(COMMA)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_117()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_135() {
- if (jj_scan_token(LT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_124() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_135()) {
- jj_scanpos = xsp;
- if (jj_3R_136()) {
- jj_scanpos = xsp;
- if (jj_3R_137()) {
- jj_scanpos = xsp;
- if (jj_3R_138()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_123()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_120() {
- if (jj_3R_123()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_124()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_111() {
- if (jj_3R_116()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_72() {
- if (jj_3R_50()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_71() {
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_56() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_71()) {
- jj_scanpos = xsp;
- if (jj_3R_72()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_48() {
- if (jj_scan_token(LBRACE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_56()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RBRACE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_104() {
- if (jj_scan_token(LIST)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(LPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_111()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_112()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- if (jj_scan_token(RPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- xsp = jj_scanpos;
- if (jj_3R_113()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_206() {
- if (jj_scan_token(COMMA)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_70() {
- if (jj_3R_50()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3_2() {
- if (jj_scan_token(COMMA)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_41()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_55() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_69()) {
- jj_scanpos = xsp;
- if (jj_3R_70()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_69() {
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_205() {
- if (jj_3R_41()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3_2()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_47() {
- if (jj_scan_token(LBRACKET)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_55()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RBRACKET)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_129() {
- if (jj_scan_token(TRIPLEEQUAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_128() {
- if (jj_scan_token(BANGDOUBLEEQUAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_127() {
- if (jj_scan_token(NOT_EQUAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_126() {
- if (jj_scan_token(DIF)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_105() {
- if (jj_scan_token(PRINT)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_198() {
- if (jj_scan_token(LPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_205()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- xsp = jj_scanpos;
- if (jj_3R_206()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RPAREN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_125() {
- if (jj_scan_token(EQUAL_EQUAL)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_54() {
- if (jj_3R_68()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_121() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_125()) {
- jj_scanpos = xsp;
- if (jj_3R_126()) {
- jj_scanpos = xsp;
- if (jj_3R_127()) {
- jj_scanpos = xsp;
- if (jj_3R_128()) {
- jj_scanpos = xsp;
- if (jj_3R_129()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_120()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_53() {
- if (jj_scan_token(IDENTIFIER)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_118() {
- if (jj_3R_120()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_121()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_214() {
- if (jj_scan_token(ARRAYASSIGN)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_52() {
- if (jj_scan_token(LBRACE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_scan_token(RBRACE)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_41() {
- if (jj_3R_49()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_214()) jj_scanpos = xsp;
- else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_119() {
- if (jj_scan_token(BIT_AND)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_118()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_46() {
- if (jj_scan_token(CLASSACCESS)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_52()) {
- jj_scanpos = xsp;
- if (jj_3R_53()) {
- jj_scanpos = xsp;
- if (jj_3R_54()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_40() {
- Token xsp;
- xsp = jj_scanpos;
- if (jj_3R_46()) {
- jj_scanpos = xsp;
- if (jj_3R_47()) {
- jj_scanpos = xsp;
- if (jj_3R_48()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- final private boolean jj_3R_114() {
- if (jj_3R_118()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- Token xsp;
- while (true) {
- xsp = jj_scanpos;
- if (jj_3R_119()) { jj_scanpos = xsp; break; }
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- }
- return false;
- }
-
- final private boolean jj_3R_115() {
- if (jj_scan_token(XOR)) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- if (jj_3R_114()) return true;
- if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
- return false;
- }
-
- public PHPParserTokenManager token_source;
- SimpleCharStream jj_input_stream;
- public Token token, jj_nt;
- private int jj_ntk;
- private Token jj_scanpos, jj_lastpos;
- private int jj_la;
- public boolean lookingAhead = false;
- private boolean jj_semLA;
- private int jj_gen;
- final private int[] jj_la1 = new int[128];
- static private int[] jj_la1_0;
- static private int[] jj_la1_1;
- static private int[] jj_la1_2;
- static private int[] jj_la1_3;
- static private int[] jj_la1_4;
- static {
- jj_la1_0();
- jj_la1_1();
- jj_la1_2();
- jj_la1_3();
- jj_la1_4();
- }
- private static void jj_la1_0() {
- jj_la1_0 = new int[] {0x5800001e,0x6,0x6,0x5800001e,0x0,0x58000000,0x0,0x30000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x40000000,0x8,0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x58000010,0x58000010,0x58000000,0x58000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x58000010,0x58000010,0x0,0x0,0x40000010,0x40000010,0x80000000,0x0,0x40000010,0x80000000,0x0,0x40000010,0x40000010,0x40000010,0x40000010,0x40000010,0x40000000,0x40000000,0x0,0x0,0x0,0x40000000,0x40000000,0x0,0x0,0x0,0x0,};
- }
- private static void jj_la1_1() {
- jj_la1_1 = new int[] {0xd7541ffe,0x0,0x0,0xd7541ffe,0x0,0xd7541ffe,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc2000002,0x8000,0xc300001a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc300001a,0x18,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc3000002,0xc3000002,0xc3000002,0x0,0xc3000002,0x2,0x0,0x0,0x0,0x1000002,0x4000,0x0,0x0,0x0,0x1000000,0x0,0x0,0xc300001a,0xc300001a,0xc300001a,0xc300001a,0x2000,0xc2000000,0x0,0x0,0xc300001a,0x0,0x0,0x14541fe0,0xd7541ffe,0x0,0x0,0x3c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd7541ffe,0xd7541ffe,0xd7541ffe,0xd7541ffa,0x0,0x0,0x0,0x0,0x1000002,0x0,0x90000,0x90000,0xd7541ffe,0xd7541ffe,0x90000,0xc300001a,0xd7541ffe,0xd7541ffe,0x0,0x1,0xd7541ffe,0x0,0x1,0xd7541ffe,0xd7541ffe,0xd7541ffe,0xd7541ffe,0xd7541ffe,0xd7541ffe,0xd7541ffe,0xc300001a,0xc300001a,0xc300001a,0xd7541ffe,0xd7541ffe,0xc300001a,0x0,0xc300001a,0xc300001a,};
- }
- private static void jj_la1_2() {
- jj_la1_2 = new int[] {0x27870021,0x0,0x0,0x27870021,0x0,0x27870021,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x0,0x27870000,0x0,0x20000000,0x0,0x20000000,0x20000000,0xff80,0x0,0x27870000,0x20000,0x0,0x0,0x80000,0x200000,0x200000,0x400000,0x400000,0x0,0x40000000,0x80000000,0x20000000,0x0,0x0,0x0,0x0,0x0,0x0,0x6000000,0x6000000,0x18000000,0x18000000,0x27870000,0x27830000,0x27800000,0x1800000,0x20000000,0xff80,0x1800000,0x1800000,0x20000000,0x20000000,0x0,0x0,0x0,0x0,0x0,0xff80,0x0,0x2787ff80,0x2787ff80,0x2787ff80,0x2787ff80,0x0,0x0,0x0,0x0,0x27870000,0x0,0x10000,0x10021,0x27870021,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x27870021,0x27870021,0x27870021,0x27870021,0x0,0x0,0x1800000,0x1800000,0x21800000,0x100000,0x0,0x0,0x27870021,0x27870021,0x0,0x27870000,0x27870021,0x27870021,0x0,0x0,0x27870021,0x0,0x0,0x27970021,0x27870021,0x27870021,0x27870021,0x27870021,0x27870021,0x27970021,0x27870000,0x27870000,0x27870000,0x27870021,0x27970021,0x27870000,0x0,0x27870000,0x27870000,};
- }
- private static void jj_la1_3() {
- jj_la1_3 = new int[] {0x18011440,0x0,0x0,0x18011440,0x0,0x18011440,0x0,0x0,0x0,0x0,0x10000000,0x0,0x0,0x18000000,0x440,0x440,0x10011440,0x0,0x18011440,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x18011440,0x0,0x0,0x0,0x0,0x10,0x10,0x20,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xe,0xe,0x0,0x0,0x1,0x1,0x18011440,0x18011440,0x18011440,0x0,0x18011440,0x0,0x0,0x0,0x0,0x18000000,0x0,0x0,0x0,0x0,0x18000000,0x18000000,0x18000000,0x18011440,0x18011440,0x18011440,0x18011440,0x0,0x11440,0x20000,0x10080000,0x18011440,0x0,0x0,0x10000000,0x18011440,0x0,0x0,0x0,0x8000000,0x0,0x8000000,0x0,0x0,0x0,0x0,0x18011440,0x18011440,0x18011440,0x18011440,0x0,0x0,0x0,0x0,0x18000000,0x0,0x0,0x0,0x18011440,0x18011440,0x0,0x18011440,0x18011440,0x18011440,0x0,0x0,0x18011440,0x0,0x0,0x18011440,0x18011440,0x18011440,0x18011440,0x18011440,0x18011440,0x18011440,0x18011440,0x18011440,0x18011440,0x18011440,0x18011440,0x18011440,0x0,0x18011440,0x18011440,};
- }
- private static void jj_la1_4() {
- jj_la1_4 = new int[] {0x8a,0x0,0x0,0x8a,0x80,0x8a,0x0,0x0,0x0,0x100,0x8,0x80000,0x80000,0x8,0x0,0x0,0x0,0x0,0x2,0x100,0x0,0x100,0x0,0x0,0x0,0xfff80000,0x2,0x0,0x0,0xfff80000,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x79000,0x79000,0x6c00,0x6c00,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x2,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x2,0x2,0x0,0x0,0x8,0x2,0x2,0x2,0x2,0x28,0x0,0x0,0x0,0x2,0x100,0x0,0x88,0x8a,0x0,0x0,0x0,0x0,0x100,0x0,0x80000,0x100,0x100,0x100,0x8a,0x8a,0x8a,0x8a,0x100,0x80000,0x0,0x0,0x0,0x8,0x0,0x0,0x8a,0x8a,0x0,0x2,0x8a,0x8a,0x0,0x0,0x8a,0x0,0x0,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x8a,0x2,0x2,0x2,0x8a,0x8a,0x2,0x100,0x2,0x2,};
- }
- final private JJCalls[] jj_2_rtns = new JJCalls[5];
- private boolean jj_rescan = false;
- private int jj_gc = 0;
-
- public PHPParser(java.io.InputStream stream) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 128; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public void ReInit(java.io.InputStream stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 128; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public PHPParser(java.io.Reader stream) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 128; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public void ReInit(java.io.Reader stream) {
- jj_input_stream.ReInit(stream, 1, 1);
- token_source.ReInit(jj_input_stream);
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 128; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public PHPParser(PHPParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 128; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- public void ReInit(PHPParserTokenManager tm) {
- token_source = tm;
- token = new Token();
- jj_ntk = -1;
- jj_gen = 0;
- for (int i = 0; i < 128; i++) jj_la1[i] = -1;
- for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
- }
-
- final private Token jj_consume_token(int kind) throws ParseException {
- Token oldToken;
- if ((oldToken = token).next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- if (token.kind == kind) {
- jj_gen++;
- if (++jj_gc > 100) {
- jj_gc = 0;
- for (int i = 0; i < jj_2_rtns.length; i++) {
- JJCalls c = jj_2_rtns[i];
- while (c != null) {
- if (c.gen < jj_gen) c.first = null;
- c = c.next;
- }
- }
- }
- return token;
- }
- token = oldToken;
- jj_kind = kind;
- throw generateParseException();
- }
-
- final private boolean jj_scan_token(int kind) {
- if (jj_scanpos == jj_lastpos) {
- jj_la--;
- if (jj_scanpos.next == null) {
- jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
- } else {
- jj_lastpos = jj_scanpos = jj_scanpos.next;
- }
- } else {
- jj_scanpos = jj_scanpos.next;
- }
- if (jj_rescan) {
- int i = 0; Token tok = token;
- while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
- if (tok != null) jj_add_error_token(kind, i);
- }
- return (jj_scanpos.kind != kind);
- }
-
- final public Token getNextToken() {
- if (token.next != null) token = token.next;
- else token = token.next = token_source.getNextToken();
- jj_ntk = -1;
- jj_gen++;
- return token;
- }
-
- final public Token getToken(int index) {
- Token t = lookingAhead ? jj_scanpos : token;
- for (int i = 0; i < index; i++) {
- if (t.next != null) t = t.next;
- else t = t.next = token_source.getNextToken();
- }
- return t;
- }
-
- final private int jj_ntk() {
- if ((jj_nt=token.next) == null)
- return (jj_ntk = (token.next=token_source.getNextToken()).kind);
- else
- return (jj_ntk = jj_nt.kind);
- }
-
- private java.util.Vector jj_expentries = new java.util.Vector();
- private int[] jj_expentry;
- private int jj_kind = -1;
- private int[] jj_lasttokens = new int[100];
- private int jj_endpos;
-
- private void jj_add_error_token(int kind, int pos) {
- if (pos >= 100) return;
- if (pos == jj_endpos + 1) {
- jj_lasttokens[jj_endpos++] = kind;
- } else if (jj_endpos != 0) {
- jj_expentry = new int[jj_endpos];
- for (int i = 0; i < jj_endpos; i++) {
- jj_expentry[i] = jj_lasttokens[i];
- }
- boolean exists = false;
- for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) {
- int[] oldentry = (int[])(enum.nextElement());
- if (oldentry.length == jj_expentry.length) {
- exists = true;
- for (int i = 0; i < jj_expentry.length; i++) {
- if (oldentry[i] != jj_expentry[i]) {
- exists = false;
- break;
- }
- }
- if (exists) break;
- }
- }
- if (!exists) jj_expentries.addElement(jj_expentry);
- if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
- }
- }
-
- public ParseException generateParseException() {
- jj_expentries.removeAllElements();
- boolean[] la1tokens = new boolean[160];
- for (int i = 0; i < 160; i++) {
- la1tokens[i] = false;
- }
- if (jj_kind >= 0) {
- la1tokens[jj_kind] = true;
- jj_kind = -1;
- }
- for (int i = 0; i < 128; i++) {
- if (jj_la1[i] == jj_gen) {
- for (int j = 0; j < 32; j++) {
- if ((jj_la1_0[i] & (1<<j)) != 0) {
- la1tokens[j] = true;
- }
- if ((jj_la1_1[i] & (1<<j)) != 0) {
- la1tokens[32+j] = true;
- }
- if ((jj_la1_2[i] & (1<<j)) != 0) {
- la1tokens[64+j] = true;
- }
- if ((jj_la1_3[i] & (1<<j)) != 0) {
- la1tokens[96+j] = true;
- }
- if ((jj_la1_4[i] & (1<<j)) != 0) {
- la1tokens[128+j] = true;
- }
- }
- }
- }
- for (int i = 0; i < 160; i++) {
- if (la1tokens[i]) {
- jj_expentry = new int[1];
- jj_expentry[0] = i;
- jj_expentries.addElement(jj_expentry);
- }
- }
- jj_endpos = 0;
- jj_rescan_token();
- jj_add_error_token(0, 0);
- int[][] exptokseq = new int[jj_expentries.size()][];
- for (int i = 0; i < jj_expentries.size(); i++) {
- exptokseq[i] = (int[])jj_expentries.elementAt(i);
- }
- return new ParseException(token, exptokseq, tokenImage);
- }
-
- final public void enable_tracing() {
- }
-
- final public void disable_tracing() {
- }
-
- final private void jj_rescan_token() {
- jj_rescan = true;
- for (int i = 0; i < 5; i++) {
- JJCalls p = jj_2_rtns[i];
- do {
- if (p.gen > jj_gen) {
- jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
- switch (i) {
- case 0: jj_3_1(); break;
- case 1: jj_3_2(); break;
- case 2: jj_3_3(); break;
- case 3: jj_3_4(); break;
- case 4: jj_3_5(); break;
- }
- }
- p = p.next;
- } while (p != null);
- }
- jj_rescan = false;
- }
-
- final private void jj_save(int index, int xla) {
- JJCalls p = jj_2_rtns[index];
- while (p.gen > jj_gen) {
- if (p.next == null) { p = p.next = new JJCalls(); break; }
- p = p.next;
- }
- p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
- }
-
- static final class JJCalls {
- int gen;
- Token first;
- int arg;
- JJCalls next;
- }
-
-}
+++ /dev/null
-
-options {
- LOOKAHEAD = 1;
- CHOICE_AMBIGUITY_CHECK = 2;
- OTHER_AMBIGUITY_CHECK = 1;
- STATIC = false;
- DEBUG_PARSER = false;
- DEBUG_LOOKAHEAD = false;
- DEBUG_TOKEN_MANAGER = false;
- OPTIMIZE_TOKEN_MANAGER = false;
- ERROR_REPORTING = true;
- JAVA_UNICODE_ESCAPE = false;
- UNICODE_INPUT = false;
- IGNORE_CASE = true;
- USER_TOKEN_MANAGER = false;
- USER_CHAR_STREAM = false;
- BUILD_PARSER = true;
- BUILD_TOKEN_MANAGER = true;
- SANITY_CHECK = true;
- FORCE_LA_CHECK = false;
- COMMON_TOKEN_ACTION = true;
-}
-
-PARSER_BEGIN(PHPParser)
-package test;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import java.util.Hashtable;
-import java.util.ArrayList;
-import java.io.StringReader;
-import java.io.*;
-import java.text.MessageFormat;
-
-import net.sourceforge.phpeclipse.actions.PHPStartApacheAction;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpdt.internal.compiler.ast.*;
-import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
-import net.sourceforge.phpdt.internal.corext.Assert;
-
-/**
- * A new php parser.
- * This php parser is inspired by the Java 1.2 grammar example
- * given with JavaCC. You can get JavaCC at http://www.webgain.com
- * You can test the parser with the PHPParserTestCase2.java
- * @author Matthieu Casanova
- */
-public final class PHPParser extends PHPParserSuperclass {
-
-//todo : fix the variables names bug
-//todo : handle tilde operator
-
-
- /** The current segment. */
- private static OutlineableWithChildren currentSegment;
-
- private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$
- private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$
- static PHPOutlineInfo outlineInfo;
-
- /** The error level of the current ParseException. */
- private static int errorLevel = ERROR;
- /** The message of the current ParseException. If it's null it's because the parse exception wasn't handled */
- private static String errorMessage;
-
- private static int errorStart = -1;
- private static int errorEnd = -1;
- private static PHPDocument phpDocument;
-
- private static final String SYNTAX_ERROR_CHAR = "syntax error";
- /**
- * The point where html starts.
- * It will be used by the token manager to create HTMLCode objects
- */
- public static int htmlStart;
-
- //ast stack
- private final static int AstStackIncrement = 100;
- /** The stack of node. */
- private static AstNode[] nodes;
- /** The cursor in expression stack. */
- private static int nodePtr;
-
- public static final boolean PARSER_DEBUG = false;
-
- public final void setFileToParse(final IFile fileToParse) {
- PHPParser.fileToParse = fileToParse;
- }
-
- public PHPParser() {
- }
-
- public PHPParser(final IFile fileToParse) {
- this(new StringReader(""));
- PHPParser.fileToParse = fileToParse;
- }
-
- public final void phpParserTester(final String strEval) throws ParseException {
- final StringReader stream = new StringReader(strEval);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(new StringReader(strEval));
- init();
- phpDocument = new PHPDocument(null,"_root".toCharArray());
- currentSegment = phpDocument;
- outlineInfo = new PHPOutlineInfo(null, currentSegment);
- token_source.SwitchTo(PHPParserTokenManager.PHPPARSING);
- phpTest();
- }
-
- public final void htmlParserTester(final File fileName) throws FileNotFoundException, ParseException {
- final Reader stream = new FileReader(fileName);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(stream);
- init();
- phpDocument = new PHPDocument(null,"_root".toCharArray());
- currentSegment = phpDocument;
- outlineInfo = new PHPOutlineInfo(null, currentSegment);
- phpFile();
- }
-
- public final void htmlParserTester(final String strEval) throws ParseException {
- final StringReader stream = new StringReader(strEval);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(stream);
- init();
- phpDocument = new PHPDocument(null,"_root".toCharArray());
- currentSegment = phpDocument;
- outlineInfo = new PHPOutlineInfo(null, currentSegment);
- phpFile();
- }
-
- /**
- * Reinitialize the parser.
- */
- private static final void init() {
- nodes = new AstNode[AstStackIncrement];
- nodePtr = -1;
- htmlStart = 0;
- }
-
- /**
- * Add an php node on the stack.
- * @param node the node that will be added to the stack
- */
- private static final void pushOnAstNodes(final AstNode node) {
- try {
- nodes[++nodePtr] = node;
- } catch (IndexOutOfBoundsException e) {
- final int oldStackLength = nodes.length;
- final AstNode[] oldStack = nodes;
- nodes = new AstNode[oldStackLength + AstStackIncrement];
- System.arraycopy(oldStack, 0, nodes, 0, oldStackLength);
- nodePtr = oldStackLength;
- nodes[nodePtr] = node;
- }
- }
-
- public final PHPOutlineInfo parseInfo(final Object parent, final String s) {
- phpDocument = new PHPDocument(parent,"_root".toCharArray());
- currentSegment = phpDocument;
- outlineInfo = new PHPOutlineInfo(parent, currentSegment);
- final StringReader stream = new StringReader(s);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(stream);
- init();
- try {
- parse();
- phpDocument.nodes = new AstNode[nodes.length];
- System.arraycopy(nodes,0,phpDocument.nodes,0,nodes.length);
- if (PHPeclipsePlugin.DEBUG) {
- PHPeclipsePlugin.log(1,phpDocument.toString());
- }
- } catch (ParseException e) {
- processParseException(e);
- }
- return outlineInfo;
- }
-
- /**
- * This function will throw the exception if we are in debug mode
- * and process it if we are in production mode.
- * this should be fast since the PARSER_DEBUG is static final so the difference will be at compile time
- * @param e the exception
- * @throws ParseException the thrown exception
- */
- private static void processParseExceptionDebug(final ParseException e) throws ParseException {
- if (PARSER_DEBUG) {
- throw e;
- }
- processParseException(e);
- }
- /**
- * This method will process the parse exception.
- * If the error message is null, the parse exception wasn't catched and a trace is written in the log
- * @param e the ParseException
- */
- private static void processParseException(final ParseException e) {
- if (errorMessage == null) {
- PHPeclipsePlugin.log(e);
- errorMessage = "this exception wasn't handled by the parser please tell us how to reproduce it";
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- }
- setMarker(e);
- errorMessage = null;
- // if (PHPeclipsePlugin.DEBUG) PHPeclipsePlugin.log(e);
- }
-
- /**
- * Create marker for the parse error.
- * @param e the ParseException
- */
- private static void setMarker(final ParseException e) {
- try {
- if (errorStart == -1) {
- setMarker(fileToParse,
- errorMessage,
- e.currentToken.sourceStart,
- e.currentToken.sourceEnd,
- errorLevel,
- "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+':'+e.currentToken.sourceEnd);
- } else {
- setMarker(fileToParse,
- errorMessage,
- errorStart,
- errorEnd,
- errorLevel,
- "Line " + e.currentToken.beginLine+", "+errorStart+':'+errorEnd);
- errorStart = -1;
- errorEnd = -1;
- }
- } catch (CoreException e2) {
- PHPeclipsePlugin.log(e2);
- }
- }
-
- private static void scanLine(final String output,
- final IFile file,
- final int indx,
- final int brIndx) throws CoreException {
- String current;
- final StringBuffer lineNumberBuffer = new StringBuffer(10);
- char ch;
- current = output.substring(indx, brIndx);
-
- if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) {
- final int onLine = current.indexOf("on line <b>");
- if (onLine != -1) {
- lineNumberBuffer.delete(0, lineNumberBuffer.length());
- for (int i = onLine; i < current.length(); i++) {
- ch = current.charAt(i);
- if ('0' <= ch && '9' >= ch) {
- lineNumberBuffer.append(ch);
- }
- }
-
- final int lineNumber = Integer.parseInt(lineNumberBuffer.toString());
-
- final Hashtable attributes = new Hashtable();
-
- current = current.replaceAll("\n", "");
- current = current.replaceAll("<b>", "");
- current = current.replaceAll("</b>", "");
- MarkerUtilities.setMessage(attributes, current);
-
- if (current.indexOf(PARSE_ERROR_STRING) != -1)
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- else if (current.indexOf(PARSE_WARNING_STRING) != -1)
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- else
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- MarkerUtilities.setLineNumber(attributes, lineNumber);
- MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
- }
- }
- }
-
- public final void parse(final String s) {
- final StringReader stream = new StringReader(s);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- token_source = new PHPParserTokenManager(jj_input_stream);
- }
- ReInit(stream);
- init();
- try {
- parse();
- } catch (ParseException e) {
- processParseException(e);
- }
- }
-
- /**
- * Call the php parse command ( php -l -f <filename> )
- * and create markers according to the external parser output
- */
- public static void phpExternalParse(final IFile file) {
- final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- final String filename = file.getLocation().toString();
-
- final String[] arguments = { filename };
- final MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.EXTERNAL_PARSER_PREF));
- final String command = form.format(arguments);
-
- final String parserResult = PHPStartApacheAction.getParserOutput(command, "External parser: ");
-
- try {
- // parse the buffer to find the errors and warnings
- createMarkers(parserResult, file);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- }
-
- /**
- * Put a new html block in the stack.
- */
- public final void createNewHTMLCode() {
- final int currentPosition = token.sourceStart;
- if (currentPosition == htmlStart ||
- currentPosition < htmlStart ||
- currentPosition > jj_input_stream.getCurrentBuffer().length()) {
- return;
- }
- final String html = jj_input_stream.getCurrentBuffer().substring(htmlStart, currentPosition);
- pushOnAstNodes(new HTMLCode(html, htmlStart,currentPosition));
- }
-
- /** Create a new task. */
- public final void createNewTask(final int todoStart) {
- final String todo = jj_input_stream.getCurrentBuffer().substring(todoStart,
- jj_input_stream.getCurrentBuffer().indexOf("\n",
- todoStart)-1);
- if (!PARSER_DEBUG) {
- try {
- setMarker(fileToParse,
- todo,
- jj_input_stream.getBeginLine(),
- TASK,
- "Line "+jj_input_stream.getBeginLine());
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- }
- }
-
- private final void parse() throws ParseException {
- phpFile();
- }
-}
-
-PARSER_END(PHPParser)
-
-TOKEN_MGR_DECLS:
-{
- // CommonTokenAction: use the begins/ends fields added to the Jack
- // CharStream class to set corresponding fields in each Token (which was
- // also extended with new fields). By default Jack doesn't supply absolute
- // offsets, just line/column offsets
- void CommonTokenAction(Token t) {
- t.sourceStart = input_stream.getBeginOffset();
- t.sourceEnd = input_stream.getBeginOffset();
- } // CommonTokenAction
-} // TOKEN_MGR_DECLS
-
-<DEFAULT> TOKEN :
-{
- <PHPSTARTSHORT : "<?"> : PHPPARSING
-| <PHPSTARTLONG : "<?php"> : PHPPARSING
-| <PHPECHOSTART : "<?="> : PHPPARSING
-}
-
-<PHPPARSING, IN_SINGLE_LINE_COMMENT,IN_VARIABLE> TOKEN :
-{
- <PHPEND :"?>"> : DEFAULT
-}
-
-/* Skip any character if we are not in php mode */
-<DEFAULT> SKIP :
-{
- < ~[] >
-}
-
-
-/* WHITE SPACE */
-<PHPPARSING> SKIP :
-{
- " "
-| "\t"
-| "\n"
-| "\r"
-| "\f"
-}
-
-<IN_VARIABLE> SPECIAL_TOKEN :
-{
- " " : PHPPARSING
-| "\t" : PHPPARSING
-| "\n" : PHPPARSING
-| "\r" : PHPPARSING
-| "\f" : PHPPARSING
-}
-/* COMMENTS */
-<PHPPARSING> SPECIAL_TOKEN :
-{
- "//" : IN_SINGLE_LINE_COMMENT
-| "#" : IN_SINGLE_LINE_COMMENT
-| <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
-| "/*" : IN_MULTI_LINE_COMMENT
-}
-
-<IN_SINGLE_LINE_COMMENT> SPECIAL_TOKEN :
-{
- <SINGLE_LINE_COMMENT: "\n" | "\r" | "\r\n" > : PHPPARSING
-| < ~[] >
-}
-
-<IN_SINGLE_LINE_COMMENT,IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT> SPECIAL_TOKEN :
-{
- "todo"
-}
-
-void todo() :
-{Token todoToken;}
-{
- todoToken = "TODO" {createNewTask(todoToken.sourceStart);}
-}
-<IN_FORMAL_COMMENT> SPECIAL_TOKEN :
-{
- "*/" : PHPPARSING
-}
-
-<IN_MULTI_LINE_COMMENT> SPECIAL_TOKEN :
-{
- "*/" : PHPPARSING
-}
-
-<IN_SINGLE_LINE_COMMENT,IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT>
-MORE :
-{
- < ~[] >
-}
-
-/* KEYWORDS */
-<PHPPARSING> TOKEN :
-{
- <CLASS : "class">
-| <FUNCTION : "function">
-| <VAR : "var">
-| <IF : "if">
-| <ELSEIF : "elseif">
-| <ELSE : "else">
-| <ARRAY : "array">
-| <BREAK : "break">
-| <LIST : "list">
-}
-
-/* LANGUAGE CONSTRUCT */
-<PHPPARSING> TOKEN :
-{
- <PRINT : "print">
-| <ECHO : "echo">
-| <INCLUDE : "include">
-| <REQUIRE : "require">
-| <INCLUDE_ONCE : "include_once">
-| <REQUIRE_ONCE : "require_once">
-| <GLOBAL : "global">
-| <DEFINE : "define">
-| <STATIC : "static">
-}
-
-<PHPPARSING,IN_VARIABLE> TOKEN :
-{
- <CLASSACCESS : "->"> : PHPPARSING
-| <STATICCLASSACCESS : "::"> : PHPPARSING
-| <ARRAYASSIGN : "=>"> : PHPPARSING
-}
-
-/* RESERVED WORDS AND LITERALS */
-
-<PHPPARSING> TOKEN :
-{
- <CASE : "case">
-| <CONST : "const">
-| <CONTINUE : "continue">
-| <_DEFAULT : "default">
-| <DO : "do">
-| <EXTENDS : "extends">
-| <FOR : "for">
-| <GOTO : "goto">
-| <NEW : "new">
-| <NULL : "null">
-| <RETURN : "return">
-| <SUPER : "super">
-| <SWITCH : "switch">
-| <THIS : "this">
-| <TRUE : "true">
-| <FALSE : "false">
-| <WHILE : "while">
-| <ENDWHILE : "endwhile">
-| <ENDSWITCH: "endswitch">
-| <ENDIF : "endif">
-| <ENDFOR : "endfor">
-| <FOREACH : "foreach">
-| <AS : "as" >
-}
-
-/* TYPES */
-<PHPPARSING> TOKEN :
-{
- <STRING : "string">
-| <OBJECT : "object">
-| <BOOL : "bool">
-| <BOOLEAN : "boolean">
-| <REAL : "real">
-| <DOUBLE : "double">
-| <FLOAT : "float">
-| <INT : "int">
-| <INTEGER : "integer">
-}
-
-//Misc token
-<PHPPARSING,IN_VARIABLE> TOKEN :
-{
- <AT : "@"> : PHPPARSING
-| <BANG : "!"> : PHPPARSING
-| <TILDE : "~"> : PHPPARSING
-| <HOOK : "?"> : PHPPARSING
-| <COLON : ":"> : PHPPARSING
-}
-
-/* OPERATORS */
-<PHPPARSING,IN_VARIABLE> TOKEN :
-{
- <OR_OR : "||"> : PHPPARSING
-| <AND_AND : "&&"> : PHPPARSING
-| <PLUS_PLUS : "++"> : PHPPARSING
-| <MINUS_MINUS : "--"> : PHPPARSING
-| <PLUS : "+"> : PHPPARSING
-| <MINUS : "-"> : PHPPARSING
-| <STAR : "*"> : PHPPARSING
-| <SLASH : "/"> : PHPPARSING
-| <BIT_AND : "&"> : PHPPARSING
-| <BIT_OR : "|"> : PHPPARSING
-| <XOR : "^"> : PHPPARSING
-| <REMAINDER : "%"> : PHPPARSING
-| <LSHIFT : "<<"> : PHPPARSING
-| <RSIGNEDSHIFT : ">>"> : PHPPARSING
-| <RUNSIGNEDSHIFT : ">>>"> : PHPPARSING
-| <_ORL : "OR"> : PHPPARSING
-| <_ANDL : "AND"> : PHPPARSING
-}
-
-/* LITERALS */
-<PHPPARSING> TOKEN :
-{
- <INTEGER_LITERAL:
- <DECIMAL_LITERAL> (["l","L"])?
- | <HEX_LITERAL> (["l","L"])?
- | <OCTAL_LITERAL> (["l","L"])?
- >
-|
- <#DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
-|
- <#HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
-|
- <#OCTAL_LITERAL: "0" (["0"-"7"])* >
-|
- <FLOATING_POINT_LITERAL:
- (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
- | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
- | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
- | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
- >
-|
- <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
-|
- <STRING_LITERAL: (<STRING_2> | <STRING_3>)>
-//| <STRING_1: "\"" ( ~["\"","\\"] | "\\" ~[] )* "\"">
-| <STRING_2: "'" ( ~["'","\\"] | "\\" ~[] )* "'">
-| <STRING_3: "`" ( ~["`","\\"] | "\\" ~[] )* "`">
-}
-
-<IN_STRING,DOLLAR_IN_STRING> SKIP :
-{
- <ESCAPED : ("\\" ~[])> : IN_STRING
-}
-
-<PHPPARSING> TOKEN :
-{
- <DOUBLEQUOTE : "\""> : IN_STRING
-}
-
-
-<IN_STRING> TOKEN :
-{
- <DOLLARS : "$"> : DOLLAR_IN_STRING
-}
-
-<IN_STRING,DOLLAR_IN_STRING> TOKEN :
-{
- <DOUBLEQUOTE2 : "\""> : PHPPARSING
-}
-
-<DOLLAR_IN_STRING> TOKEN :
-{
- <LBRACE1 : "{"> : DOLLAR_IN_STRING_EXPR
-}
-
-<IN_STRING> SPECIAL_TOKEN :
-{
- <"{"> : SKIPSTRING
-}
-
-<SKIPSTRING> SPECIAL_TOKEN :
-{
- <"}"> : IN_STRING
-}
-
-<SKIPSTRING> SKIP :
-{
- <~[]>
-}
-
-<DOLLAR_IN_STRING_EXPR> TOKEN :
-{
- <RBRACE1 : "}"> : DOLLAR_IN_STRING
-}
-
-<DOLLAR_IN_STRING_EXPR> TOKEN :
-{
- <ID : (~["}"])*>
-}
-
-<IN_STRING> SKIP :
-{
- <~[]>
-}
-
-<DOLLAR_IN_STRING_EXPR,IN_STRING> SKIP :
-{
- <~[]>
-}
-/* IDENTIFIERS */
-
-
-<PHPPARSING,IN_VARIABLE> TOKEN : {<DOLLAR : "$"> : IN_VARIABLE}
-
-
-<PHPPARSING, IN_VARIABLE, DOLLAR_IN_STRING> TOKEN :
-{
- <IDENTIFIER: (<LETTER>|<SPECIAL>) (<LETTER>|<DIGIT>|<SPECIAL>)* >
-|
- < #LETTER:
- ["a"-"z"] | ["A"-"Z"]
- >
-|
- < #DIGIT:
- ["0"-"9"]
- >
-|
- < #SPECIAL:
- "_" | ["\u007f"-"\u00ff"]
- >
-}
-
-<DOLLAR_IN_STRING> SPECIAL_TOKEN :
-{
- < ~[] > : IN_STRING
-}
-/* SEPARATORS */
-
-<PHPPARSING,IN_VARIABLE> TOKEN :
-{
- <LPAREN : "("> : PHPPARSING
-| <RPAREN : ")"> : PHPPARSING
-| <LBRACE : "{"> : PHPPARSING
-| <RBRACE : "}"> : PHPPARSING
-| <LBRACKET : "["> : PHPPARSING
-| <RBRACKET : "]"> : PHPPARSING
-| <SEMICOLON : ";"> : PHPPARSING
-| <COMMA : ","> : PHPPARSING
-| <DOT : "."> : PHPPARSING
-}
-
-
-/* COMPARATOR */
-<PHPPARSING,IN_VARIABLE> TOKEN :
-{
- <GT : ">"> : PHPPARSING
-| <LT : "<"> : PHPPARSING
-| <EQUAL_EQUAL : "=="> : PHPPARSING
-| <LE : "<="> : PHPPARSING
-| <GE : ">="> : PHPPARSING
-| <NOT_EQUAL : "!="> : PHPPARSING
-| <DIF : "<>"> : PHPPARSING
-| <BANGDOUBLEEQUAL : "!=="> : PHPPARSING
-| <TRIPLEEQUAL : "==="> : PHPPARSING
-}
-
-/* ASSIGNATION */
-<PHPPARSING,IN_VARIABLE> TOKEN :
-{
- <ASSIGN : "="> : PHPPARSING
-| <PLUSASSIGN : "+="> : PHPPARSING
-| <MINUSASSIGN : "-="> : PHPPARSING
-| <STARASSIGN : "*="> : PHPPARSING
-| <SLASHASSIGN : "/="> : PHPPARSING
-| <ANDASSIGN : "&="> : PHPPARSING
-| <ORASSIGN : "|="> : PHPPARSING
-| <XORASSIGN : "^="> : PHPPARSING
-| <DOTASSIGN : ".="> : PHPPARSING
-| <REMASSIGN : "%="> : PHPPARSING
-| <TILDEEQUAL : "~="> : PHPPARSING
-| <LSHIFTASSIGN : "<<="> : PHPPARSING
-| <RSIGNEDSHIFTASSIGN : ">>="> : PHPPARSING
-}
-
-void phpTest() :
-{}
-{
- Php()
- <EOF>
-}
-
-void phpFile() :
-{}
-{
- try {
- (PhpBlock())*
- {createNewHTMLCode();}
- } catch (TokenMgrError e) {
- PHPeclipsePlugin.log(e);
- errorStart = jj_input_stream.getBeginOffset();
- errorEnd = jj_input_stream.getEndOffset();
- errorMessage = e.getMessage();
- errorLevel = ERROR;
- throw generateParseException();
- }
-}
-
-/**
- * A php block is a <?= expression [;]?>
- * or <?php somephpcode ?>
- * or <? somephpcode ?>
- */
-void PhpBlock() :
-{
- final PHPEchoBlock phpEchoBlock;
- final Token token,phpEnd;
-}
-{
- phpEchoBlock = phpEchoBlock()
- {pushOnAstNodes(phpEchoBlock);}
-|
- [ <PHPSTARTLONG>
- | token = <PHPSTARTSHORT>
- {try {
- setMarker(fileToParse,
- "You should use '<?php' instead of '<?' it will avoid some problems with XML",
- token.sourceStart,
- token.sourceEnd,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }}
- ]
- {createNewHTMLCode();}
- Php()
- try {
- phpEnd = <PHPEND>
- {htmlStart = phpEnd.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "'?>' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
-}
-
-PHPEchoBlock phpEchoBlock() :
-{
- final Expression expr;
- final PHPEchoBlock echoBlock;
- final Token token, token2;
-}
-{
- token = <PHPECHOSTART> {createNewHTMLCode();}
- expr = Expression() [ <SEMICOLON> ] token2 = <PHPEND>
- {
- htmlStart = token2.sourceEnd;
-
- echoBlock = new PHPEchoBlock(expr,token.sourceStart,token2.sourceEnd);
- pushOnAstNodes(echoBlock);
- return echoBlock;}
-}
-
-void Php() :
-{}
-{
- (BlockStatement())*
-}
-
-ClassDeclaration ClassDeclaration() :
-{
- final ClassDeclaration classDeclaration;
- Token className = null;
- final Token superclassName, token, extendsToken;
- String classNameImage = SYNTAX_ERROR_CHAR;
- String superclassNameImage = null;
- final int classEnd;
-}
-{
- token = <CLASS>
- try {
- className = <IDENTIFIER>
- {classNameImage = className.image;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
- errorLevel = ERROR;
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- [
- extendsToken = <EXTENDS>
- try {
- superclassName = <IDENTIFIER>
- {superclassNameImage = superclassName.image;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
- errorLevel = ERROR;
- errorStart = extendsToken.sourceEnd+1;
- errorEnd = extendsToken.sourceEnd+1;
- processParseExceptionDebug(e);
- superclassNameImage = SYNTAX_ERROR_CHAR;
- }
- ]
- {
- int start, end;
- if (className == null) {
- start = token.sourceStart;
- end = token.sourceEnd;
- } else {
- start = className.sourceStart;
- end = className.sourceEnd;
- }
- if (superclassNameImage == null) {
-
- classDeclaration = new ClassDeclaration(currentSegment,
- classNameImage,
- start,
- end);
- } else {
- classDeclaration = new ClassDeclaration(currentSegment,
- classNameImage,
- superclassNameImage,
- start,
- end);
- }
- currentSegment.add(classDeclaration);
- currentSegment = classDeclaration;
- }
- classEnd = ClassBody(classDeclaration)
- {currentSegment = (OutlineableWithChildren) currentSegment.getParent();
- classDeclaration.sourceEnd = classEnd;
- pushOnAstNodes(classDeclaration);
- return classDeclaration;}
-}
-
-int ClassBody(final ClassDeclaration classDeclaration) :
-{
-Token token;
-}
-{
- try {
- <LBRACE>
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image + "'. '{' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- ( ClassBodyDeclaration(classDeclaration) )*
- try {
- token = <RBRACE>
- {return token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. 'var', 'function' or '}' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- return this.token.sourceEnd;
- }
-}
-
-/**
- * A class can contain only methods and fields.
- */
-void ClassBodyDeclaration(final ClassDeclaration classDeclaration) :
-{
- final MethodDeclaration method;
- final FieldDeclaration field;
-}
-{
- method = MethodDeclaration() {method.analyzeCode();
- classDeclaration.addMethod(method);}
-| field = FieldDeclaration() {classDeclaration.addField(field);}
-}
-
-/**
- * A class field declaration : it's var VariableDeclarator() (, VariableDeclarator())*;.
- * it is only used by ClassBodyDeclaration()
- */
-FieldDeclaration FieldDeclaration() :
-{
- VariableDeclaration variableDeclaration;
- final VariableDeclaration[] list;
- final ArrayList arrayList = new ArrayList();
- final Token token;
- Token token2 = null;
- int pos;
-}
-{
- token = <VAR> variableDeclaration = VariableDeclaratorNoSuffix()
- {
- arrayList.add(variableDeclaration);
- pos = variableDeclaration.sourceEnd;
- }
- (
- <COMMA> variableDeclaration = VariableDeclaratorNoSuffix()
- {
- arrayList.add(variableDeclaration);
- outlineInfo.addVariable(variableDeclaration.name());
- pos = variableDeclaration.sourceEnd;
- }
- )*
- try {
- token2 = <SEMICOLON>
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected after variable declaration";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
-
- {list = new VariableDeclaration[arrayList.size()];
- arrayList.toArray(list);
- int end;
- if (token2 == null) {
- end = list[list.length-1].sourceEnd;
- } else {
- end = token2.sourceEnd;
- }
- return new FieldDeclaration(list,
- token.sourceStart,
- end,
- currentSegment);}
-}
-
-/**
- * a strict variable declarator : there cannot be a suffix here.
- * It will be used by fields and formal parameters
- */
-VariableDeclaration VariableDeclaratorNoSuffix() :
-{
- final Token token, lbrace,rbrace;
- Expression expr, initializer = null;
- Token assignToken;
- Variable variable;
-}
-{
- <DOLLAR>
- (
- token = <IDENTIFIER>
- {variable = new Variable(token.image,token.sourceStart,token.sourceEnd);}
- |
- lbrace = <LBRACE> expr = Expression() rbrace = <RBRACE>
- {variable = new Variable(expr,lbrace.sourceStart,rbrace.sourceEnd);}
- )
- [
- assignToken = <ASSIGN>
- try {
- initializer = VariableInitializer()
- } catch (ParseException e) {
- errorMessage = "Literal expression expected in variable initializer";
- errorLevel = ERROR;
- errorStart = assignToken.sourceEnd +1;
- errorEnd = assignToken.sourceEnd +1;
- processParseExceptionDebug(e);
- }
- ]
- {
- if (initializer == null) {
- return new VariableDeclaration(currentSegment,
- variable,
- variable.sourceStart,
- variable.sourceEnd);
- }
- return new VariableDeclaration(currentSegment,
- variable,
- initializer,
- VariableDeclaration.EQUAL,
- variable.sourceStart);
- }
-}
-
-/**
- * this will be used by static statement
- */
-VariableDeclaration VariableDeclarator() :
-{
- final AbstractVariable variable;
- Expression initializer = null;
- final Token token;
-}
-{
- variable = VariableDeclaratorId()
- [
- token = <ASSIGN>
- try {
- initializer = VariableInitializer()
- } catch (ParseException e) {
- errorMessage = "Literal expression expected in variable initializer";
- errorLevel = ERROR;
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- ]
- {
- if (initializer == null) {
- return new VariableDeclaration(currentSegment,
- variable,
- variable.sourceStart,
- variable.sourceEnd);
- }
- return new VariableDeclaration(currentSegment,
- variable,
- initializer,
- VariableDeclaration.EQUAL,
- variable.sourceStart);
- }
-}
-
-/**
- * A Variable name.
- * @return the variable name (with suffix)
- */
-AbstractVariable VariableDeclaratorId() :
-{
- AbstractVariable var;
-}
-{
- try {
- var = Variable()
- (
- LOOKAHEAD(2)
- var = VariableSuffix(var)
- )*
- {
- return var;
- }
- } catch (ParseException e) {
- errorMessage = "'$' expected for variable identifier";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- throw e;
- }
-}
-
-Variable Variable() :
-{
- Variable variable = null;
- final Token token;
-}
-{
- token = <DOLLAR> variable = Var()
- {
- return variable;
- }
-}
-
-Variable Var() :
-{
- Variable variable = null;
- final Token token,token2;
- ConstantIdentifier constant;
- Expression expression;
-}
-{
- token = <DOLLAR> variable = Var()
- {return new Variable(variable,variable.sourceStart,variable.sourceEnd);}
-|
- token = <LBRACE> expression = Expression() token2 = <RBRACE>
- {
- return new Variable(expression,
- token.sourceStart,
- token2.sourceEnd);
- }
-|
- token = <IDENTIFIER>
- {
- outlineInfo.addVariable('$' + token.image);
- return new Variable(token.image,token.sourceStart,token.sourceEnd);
- }
-}
-
-Expression VariableInitializer() :
-{
- final Expression expr;
- final Token token, token2;
-}
-{
- expr = Literal()
- {return expr;}
-|
- token2 = <MINUS> (token = <INTEGER_LITERAL> | token = <FLOATING_POINT_LITERAL>)
- {return new PrefixedUnaryExpression(new NumberLiteral(token),
- OperatorIds.MINUS,
- token2.sourceStart);}
-|
- token2 = <PLUS> (token = <INTEGER_LITERAL> | token = <FLOATING_POINT_LITERAL>)
- {return new PrefixedUnaryExpression(new NumberLiteral(token),
- OperatorIds.PLUS,
- token2.sourceStart);}
-|
- expr = ArrayDeclarator()
- {return expr;}
-|
- token = <IDENTIFIER>
- {return new ConstantIdentifier(token);}
-}
-
-ArrayVariableDeclaration ArrayVariable() :
-{
-final Expression expr,expr2;
-}
-{
- expr = Expression()
- [
- <ARRAYASSIGN> expr2 = Expression()
- {return new ArrayVariableDeclaration(expr,expr2);}
- ]
- {return new ArrayVariableDeclaration(expr,jj_input_stream.getPosition());}
-}
-
-ArrayVariableDeclaration[] ArrayInitializer() :
-{
- ArrayVariableDeclaration expr;
- final ArrayList list = new ArrayList();
-}
-{
- <LPAREN>
- [
- expr = ArrayVariable()
- {list.add(expr);}
- ( LOOKAHEAD(2) <COMMA> expr = ArrayVariable()
- {list.add(expr);}
- )*
- ]
- [
- <COMMA> {list.add(null);}
- ]
- <RPAREN>
- {
- final ArrayVariableDeclaration[] vars = new ArrayVariableDeclaration[list.size()];
- list.toArray(vars);
- return vars;}
-}
-
-/**
- * A Method Declaration.
- * <b>function</b> MetodDeclarator() Block()
- */
-MethodDeclaration MethodDeclaration() :
-{
- final MethodDeclaration functionDeclaration;
- final Block block;
- final OutlineableWithChildren seg = currentSegment;
- final Token token;
-}
-{
- token = <FUNCTION>
- try {
- functionDeclaration = MethodDeclarator(token.sourceStart)
- {outlineInfo.addVariable(functionDeclaration.name);}
- } catch (ParseException e) {
- if (errorMessage != null) throw e;
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- throw e;
- }
- {currentSegment = functionDeclaration;}
- block = Block()
- {functionDeclaration.statements = block.statements;
- currentSegment = seg;
- return functionDeclaration;}
-}
-
-/**
- * A MethodDeclarator.
- * [&] IDENTIFIER(parameters ...).
- * @return a function description for the outline
- */
-MethodDeclaration MethodDeclarator(final int start) :
-{
- Token identifier = null;
- Token reference = null;
- final ArrayList formalParameters = new ArrayList();
- String identifierChar = SYNTAX_ERROR_CHAR;
- int end = start;
-}
-{
- [reference = <BIT_AND> {end = reference.sourceEnd;}]
- try {
- identifier = <IDENTIFIER>
- {
- identifierChar = identifier.image;
- end = identifier.sourceEnd;
- }
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceEnd;
- errorEnd = e.currentToken.next.sourceStart;
- processParseExceptionDebug(e);
- }
- end = FormalParameters(formalParameters)
- {
- int nameStart, nameEnd;
- if (identifier == null) {
- if (reference == null) {
- nameStart = start + 9;
- nameEnd = start + 10;
- } else {
- nameStart = reference.sourceEnd + 1;
- nameEnd = reference.sourceEnd + 2;
- }
- } else {
- nameStart = identifier.sourceStart;
- nameEnd = identifier.sourceEnd;
- }
- return new MethodDeclaration(currentSegment,
- identifierChar,
- formalParameters,
- reference != null,
- nameStart,
- nameEnd,
- start,
- end);
- }
-}
-
-/**
- * FormalParameters follows method identifier.
- * (FormalParameter())
- */
-int FormalParameters(final ArrayList parameters) :
-{
- VariableDeclaration var;
- final Token token;
- Token tok = this.token;
- int end = tok.sourceEnd;
-}
-{
- try {
- tok = <LPAREN>
- {end = tok.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected after function identifier";
- errorLevel = ERROR;
- errorStart = e.currentToken.next.sourceStart;
- errorEnd = e.currentToken.next.sourceEnd;
- processParseExceptionDebug(e);
- }
- [
- var = FormalParameter()
- {parameters.add(var);end = var.sourceEnd;}
- (
- <COMMA> var = FormalParameter()
- {parameters.add(var);end = var.sourceEnd;}
- )*
- ]
- try {
- token = <RPAREN>
- {end = token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "')' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.next.sourceStart;
- errorEnd = e.currentToken.next.sourceEnd;
- processParseExceptionDebug(e);
- }
- {return end;}
-}
-
-/**
- * A formal parameter.
- * $varname[=value] (,$varname[=value])
- */
-VariableDeclaration FormalParameter() :
-{
- final VariableDeclaration variableDeclaration;
- Token token = null;
-}
-{
- [token = <BIT_AND>] variableDeclaration = VariableDeclaratorNoSuffix()
- {
- outlineInfo.addVariable('$'+variableDeclaration.name());
- if (token != null) {
- variableDeclaration.setReference(true);
- }
- return variableDeclaration;}
-}
-
-ConstantIdentifier Type() :
-{final Token token;}
-{
- token = <STRING> {return new ConstantIdentifier(token);}
-| token = <BOOL> {return new ConstantIdentifier(token);}
-| token = <BOOLEAN> {return new ConstantIdentifier(token);}
-| token = <REAL> {return new ConstantIdentifier(token);}
-| token = <DOUBLE> {return new ConstantIdentifier(token);}
-| token = <FLOAT> {return new ConstantIdentifier(token);}
-| token = <INT> {return new ConstantIdentifier(token);}
-| token = <INTEGER> {return new ConstantIdentifier(token);}
-| token = <OBJECT> {return new ConstantIdentifier(token);}
-}
-
-Expression Expression() :
-{
- final Expression expr;
- Expression initializer = null;
- int assignOperator = -1;
-}
-{
- LOOKAHEAD(1)
- expr = ConditionalExpression()
- [
- assignOperator = AssignmentOperator()
- try {
- initializer = Expression()
- } catch (ParseException e) {
- if (errorMessage != null) {
- throw e;
- }
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected";
- errorLevel = ERROR;
- errorEnd = jj_input_stream.getPosition();
- throw e;
- }
- ]
- {
- if (assignOperator != -1) {// todo : change this, very very bad :(
- if (expr instanceof AbstractVariable) {
- return new VariableDeclaration(currentSegment,
- (AbstractVariable) expr,
- initializer,
- expr.sourceStart,
- initializer.sourceEnd);
- }
- String varName = expr.toStringExpression().substring(1);
- return new VariableDeclaration(currentSegment,
- new Variable(varName,
- expr.sourceStart,
- expr.sourceEnd),
- expr.sourceStart,
- initializer.sourceEnd);
- }
- return expr;
- }
-| expr = ExpressionWBang() {return expr;}
-}
-
-Expression ExpressionWBang() :
-{
- final Expression expr;
- final Token token;
-}
-{
- token = <BANG> expr = ExpressionWBang()
- {return new PrefixedUnaryExpression(expr,OperatorIds.NOT,token.sourceStart);}
-| expr = ExpressionNoBang() {return expr;}
-}
-
-Expression ExpressionNoBang() :
-{
- Expression expr;
-}
-{
- expr = ListExpression() {return expr;}
-|
- expr = PrintExpression() {return expr;}
-}
-
-/**
- * Any assignement operator.
- * @return the assignement operator id
- */
-int AssignmentOperator() :
-{}
-{
- <ASSIGN> {return VariableDeclaration.EQUAL;}
-| <STARASSIGN> {return VariableDeclaration.STAR_EQUAL;}
-| <SLASHASSIGN> {return VariableDeclaration.SLASH_EQUAL;}
-| <REMASSIGN> {return VariableDeclaration.REM_EQUAL;}
-| <PLUSASSIGN> {return VariableDeclaration.PLUS_EQUAL;}
-| <MINUSASSIGN> {return VariableDeclaration.MINUS_EQUAL;}
-| <LSHIFTASSIGN> {return VariableDeclaration.LSHIFT_EQUAL;}
-| <RSIGNEDSHIFTASSIGN> {return VariableDeclaration.RSIGNEDSHIFT_EQUAL;}
-| <ANDASSIGN> {return VariableDeclaration.AND_EQUAL;}
-| <XORASSIGN> {return VariableDeclaration.XOR_EQUAL;}
-| <ORASSIGN> {return VariableDeclaration.OR_EQUAL;}
-| <DOTASSIGN> {return VariableDeclaration.DOT_EQUAL;}
-| <TILDEEQUAL> {return VariableDeclaration.TILDE_EQUAL;}
-}
-
-Expression ConditionalExpression() :
-{
- final Expression expr;
- Expression expr2 = null;
- Expression expr3 = null;
-}
-{
- expr = ConditionalOrExpression() [ <HOOK> expr2 = Expression() <COLON> expr3 = ConditionalExpression() ]
-{
- if (expr3 == null) {
- return expr;
- }
- return new ConditionalExpression(expr,expr2,expr3);
-}
-}
-
-Expression ConditionalOrExpression() :
-{
- Expression expr,expr2;
- int operator;
-}
-{
- expr = ConditionalAndExpression()
- (
- (
- <OR_OR> {operator = OperatorIds.OR_OR;}
- | <_ORL> {operator = OperatorIds.ORL;}
- )
- expr2 = ConditionalAndExpression()
- {
- expr = new BinaryExpression(expr,expr2,operator);
- }
- )*
- {return expr;}
-}
-
-Expression ConditionalAndExpression() :
-{
- Expression expr,expr2;
- int operator;
-}
-{
- expr = ConcatExpression()
- (
- ( <AND_AND> {operator = OperatorIds.AND_AND;}
- | <_ANDL> {operator = OperatorIds.ANDL;})
- expr2 = ConcatExpression() {expr = new BinaryExpression(expr,expr2,operator);}
- )*
- {return expr;}
-}
-
-Expression ConcatExpression() :
-{
- Expression expr,expr2;
-}
-{
- expr = InclusiveOrExpression()
- (
- <DOT> expr2 = InclusiveOrExpression()
- {expr = new BinaryExpression(expr,expr2,OperatorIds.DOT);}
- )*
- {return expr;}
-}
-
-Expression InclusiveOrExpression() :
-{
- Expression expr,expr2;
-}
-{
- expr = ExclusiveOrExpression()
- (<BIT_OR> expr2 = ExclusiveOrExpression()
- {expr = new BinaryExpression(expr,expr2,OperatorIds.OR);}
- )*
- {return expr;}
-}
-
-Expression ExclusiveOrExpression() :
-{
- Expression expr,expr2;
-}
-{
- expr = AndExpression()
- (
- <XOR> expr2 = AndExpression()
- {expr = new BinaryExpression(expr,expr2,OperatorIds.XOR);}
- )*
- {return expr;}
-}
-
-Expression AndExpression() :
-{
- Expression expr,expr2;
-}
-{
- expr = EqualityExpression()
- (
- LOOKAHEAD(1)
- <BIT_AND> expr2 = EqualityExpression()
- {expr = new BinaryExpression(expr,expr2,OperatorIds.AND);}
- )*
- {return expr;}
-}
-
-Expression EqualityExpression() :
-{
- Expression expr,expr2;
- int operator;
- Token token;
-}
-{
- expr = RelationalExpression()
- (
- ( token = <EQUAL_EQUAL> {operator = OperatorIds.EQUAL_EQUAL;}
- | token = <DIF> {operator = OperatorIds.DIF;}
- | token = <NOT_EQUAL> {operator = OperatorIds.DIF;}
- | token = <BANGDOUBLEEQUAL> {operator = OperatorIds.BANG_EQUAL_EQUAL;}
- | token = <TRIPLEEQUAL> {operator = OperatorIds.EQUAL_EQUAL_EQUAL;}
- )
- try {
- expr2 = RelationalExpression()
- } catch (ParseException e) {
- if (errorMessage != null) {
- throw e;
- }
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected";
- errorLevel = ERROR;
- errorStart = token.sourceEnd +1;
- errorEnd = token.sourceEnd +1;
- expr2 = new ConstantIdentifier(SYNTAX_ERROR_CHAR,token.sourceEnd +1,token.sourceEnd +1);
- processParseExceptionDebug(e);
- }
- {
- expr = new BinaryExpression(expr,expr2,operator);
- }
- )*
- {return expr;}
-}
-
-Expression RelationalExpression() :
-{
- Expression expr,expr2;
- int operator;
-}
-{
- expr = ShiftExpression()
- (
- ( <LT> {operator = OperatorIds.LESS;}
- | <GT> {operator = OperatorIds.GREATER;}
- | <LE> {operator = OperatorIds.LESS_EQUAL;}
- | <GE> {operator = OperatorIds.GREATER_EQUAL;})
- expr2 = ShiftExpression()
- {expr = new BinaryExpression(expr,expr2,operator);}
- )*
- {return expr;}
-}
-
-Expression ShiftExpression() :
-{
- Expression expr,expr2;
- int operator;
-}
-{
- expr = AdditiveExpression()
- (
- ( <LSHIFT> {operator = OperatorIds.LEFT_SHIFT;}
- | <RSIGNEDSHIFT> {operator = OperatorIds.RIGHT_SHIFT;}
- | <RUNSIGNEDSHIFT> {operator = OperatorIds.UNSIGNED_RIGHT_SHIFT;})
- expr2 = AdditiveExpression()
- {expr = new BinaryExpression(expr,expr2,operator);}
- )*
- {return expr;}
-}
-
-Expression AdditiveExpression() :
-{
- Expression expr,expr2;
- int operator;
-}
-{
- expr = MultiplicativeExpression()
- (
- LOOKAHEAD(1)
- ( <PLUS> {operator = OperatorIds.PLUS;}
- | <MINUS> {operator = OperatorIds.MINUS;}
- )
- expr2 = MultiplicativeExpression()
- {expr = new BinaryExpression(expr,expr2,operator);}
- )*
- {return expr;}
-}
-
-Expression MultiplicativeExpression() :
-{
- Expression expr,expr2;
- int operator;
-}
-{
- try {
- expr = UnaryExpression()
- } catch (ParseException e) {
- if (errorMessage != null) throw e;
- errorMessage = "unexpected token '"+e.currentToken.next.image+'\'';
- errorLevel = ERROR;
- errorStart = this.token.sourceStart;
- errorEnd = this.token.sourceEnd;
- throw e;
- }
- (
- ( <STAR> {operator = OperatorIds.MULTIPLY;}
- | <SLASH> {operator = OperatorIds.DIVIDE;}
- | <REMAINDER> {operator = OperatorIds.REMAINDER;})
- expr2 = UnaryExpression()
- {expr = new BinaryExpression(expr,expr2,operator);}
- )*
- {return expr;}
-}
-
-/**
- * An unary expression starting with @, & or nothing
- */
-Expression UnaryExpression() :
-{
- final Expression expr;
-}
-{
- /* <BIT_AND> expr = UnaryExpressionNoPrefix() //why did I had that ?
- {return new PrefixedUnaryExpression(expr,OperatorIds.AND,pos);}
-| */
- expr = AtNotTildeUnaryExpression() {return expr;}
-}
-
-Expression AtNotTildeUnaryExpression() :
-{
- final Expression expr;
- final Token token;
-}
-{
- token = <AT>
- expr = AtNotTildeUnaryExpression()
- {return new PrefixedUnaryExpression(expr,OperatorIds.AT,token.sourceStart);}
-|
- token = <TILDE>
- expr = AtNotTildeUnaryExpression()
- {return new PrefixedUnaryExpression(expr,OperatorIds.TWIDDLE,token.sourceStart);}
-|
- token = <BANG>
- expr = AtNotUnaryExpression()
- {return new PrefixedUnaryExpression(expr,OperatorIds.NOT,token.sourceStart);}
-|
- expr = UnaryExpressionNoPrefix()
- {return expr;}
-}
-
-/**
- * An expression prefixed (or not) by one or more @ and !.
- * @return the expression
- */
-Expression AtNotUnaryExpression() :
-{
- final Expression expr;
- final Token token;
-}
-{
- token = <AT>
- expr = AtNotUnaryExpression()
- {return new PrefixedUnaryExpression(expr,OperatorIds.AT,token.sourceStart);}
-|
- token = <BANG>
- expr = AtNotUnaryExpression()
- {return new PrefixedUnaryExpression(expr,OperatorIds.NOT,token.sourceStart);}
-|
- expr = UnaryExpressionNoPrefix()
- {return expr;}
-}
-
-Expression UnaryExpressionNoPrefix() :
-{
- final Expression expr;
- final Token token;
-}
-{
- token = <PLUS> expr = AtNotTildeUnaryExpression() {return new PrefixedUnaryExpression(expr,
- OperatorIds.PLUS,
- token.sourceStart);}
-|
- token = <MINUS> expr = AtNotTildeUnaryExpression() {return new PrefixedUnaryExpression(expr,
- OperatorIds.MINUS,
- token.sourceStart);}
-|
- expr = PreIncDecExpression()
- {return expr;}
-|
- expr = UnaryExpressionNotPlusMinus()
- {return expr;}
-}
-
-
-Expression PreIncDecExpression() :
-{
-final Expression expr;
-final int operator;
-final Token token;
-}
-{
- (
- token = <PLUS_PLUS> {operator = OperatorIds.PLUS_PLUS;}
- |
- token = <MINUS_MINUS> {operator = OperatorIds.MINUS_MINUS;}
- )
- expr = PrimaryExpression()
- {return new PrefixedUnaryExpression(expr,operator,token.sourceStart);}
-}
-
-Expression UnaryExpressionNotPlusMinus() :
-{
- final Expression expr;
-}
-{
- LOOKAHEAD( <LPAREN> (Type() | <ARRAY>) <RPAREN> )
- expr = CastExpression() {return expr;}
-| expr = PostfixExpression() {return expr;}
-| expr = Literal() {return expr;}
-| <LPAREN> expr = Expression()
- try {
- <RPAREN>
- } catch (ParseException e) {
- errorMessage = "')' expected";
- errorLevel = ERROR;
- errorStart = expr.sourceEnd +1;
- errorEnd = expr.sourceEnd +1;
- processParseExceptionDebug(e);
- }
- {return expr;}
-}
-
-CastExpression CastExpression() :
-{
-final ConstantIdentifier type;
-final Expression expr;
-final Token token,token1;
-}
-{
- token1 = <LPAREN>
- (
- type = Type()
- |
- token = <ARRAY> {type = new ConstantIdentifier(token);}
- )
- <RPAREN> expr = UnaryExpression()
- {return new CastExpression(type,expr,token1.sourceStart,expr.sourceEnd);}
-}
-
-Expression PostfixExpression() :
-{
- final Expression expr;
- int operator = -1;
- Token token = null;
-}
-{
- expr = PrimaryExpression()
- [
- token = <PLUS_PLUS> {operator = OperatorIds.PLUS_PLUS;}
- |
- token = <MINUS_MINUS> {operator = OperatorIds.MINUS_MINUS;}
- ]
- {
- if (operator == -1) {
- return expr;
- }
- return new PostfixedUnaryExpression(expr,operator,token.sourceEnd);
- }
-}
-
-Expression PrimaryExpression() :
-{
- Expression expr;
- Token token = null;
-}
-{
- [token = <BIT_AND>] expr = refPrimaryExpression(token)
- {return expr;}
-|
- expr = ArrayDeclarator()
- {return expr;}
-}
-
-Expression refPrimaryExpression(final Token reference) :
-{
- Expression expr;
- Expression expr2 = null;
- final Token identifier;
-}
-{
- identifier = <IDENTIFIER>
- {
- expr = new ConstantIdentifier(identifier);
- }
- (
- <STATICCLASSACCESS> expr2 = ClassIdentifier()
- {expr = new ClassAccess(expr,
- expr2,
- ClassAccess.STATIC);}
- )*
- [ expr2 = Arguments(expr) ]
- {
- if (expr2 == null) {
- if (reference != null) {
- ParseException e = generateParseException();
- errorMessage = "you cannot use a constant by reference";
- errorLevel = ERROR;
- errorStart = reference.sourceStart;
- errorEnd = reference.sourceEnd;
- processParseExceptionDebug(e);
- }
- return expr;
- }
- return expr2;
- }
-|
- expr = VariableDeclaratorId() //todo use the reference parameter ...
- [ expr = Arguments(expr) ]
- {return expr;}
-|
- token = <NEW>
- expr = ClassIdentifier()
- {
- int start;
- if (reference == null) {
- start = token.sourceStart;
- } else {
- start = reference.sourceStart;
- }
- expr = new ClassInstantiation(expr,
- reference != null,
- start);
- }
- [ expr = Arguments(expr) ]
- {return expr;}
-}
-
-/**
- * An array declarator.
- * array(vars)
- * @return an array
- */
-ArrayInitializer ArrayDeclarator() :
-{
- final ArrayVariableDeclaration[] vars;
- final Token token;
-}
-{
- token = <ARRAY> vars = ArrayInitializer()
- {return new ArrayInitializer(vars,
- token.sourceStart,
- this.token.sourceEnd);}
-}
-
-Expression ClassIdentifier():
-{
- final Expression expr;
- final Token token;
-}
-{
- token = <IDENTIFIER> {return new ConstantIdentifier(token);}
-| expr = Type() {return expr;}
-| expr = VariableDeclaratorId() {return expr;}
-}
-
-/**
- * Used by Variabledeclaratorid and primarysuffix
- */
-AbstractVariable VariableSuffix(final AbstractVariable prefix) :
-{
- Expression expression = null;
- final Token classAccessToken,lbrace,rbrace;
- Token token;
- int pos;
-}
-{
- classAccessToken = <CLASSACCESS>
- try {
- (
- lbrace = <LBRACE> expression = Expression() rbrace = <RBRACE>
- {
- expression = new Variable(expression,
- lbrace.sourceStart,
- rbrace.sourceEnd);
- }
- |
- token = <IDENTIFIER>
- {expression = new ConstantIdentifier(token.image,token.sourceStart,token.sourceEnd);}
- |
- expression = Variable()
- )
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function call or field access expected";
- errorLevel = ERROR;
- errorStart = classAccessToken.sourceEnd +1;
- errorEnd = classAccessToken.sourceEnd +1;
- processParseExceptionDebug(e);
- }
- {return new ClassAccess(prefix,
- expression,
- ClassAccess.NORMAL);}
-|
- token = <LBRACKET> {pos = token.sourceEnd+1;}
- [ expression = Expression() {pos = expression.sourceEnd+1;}
- | expression = Type() {pos = expression.sourceEnd+1;}] //Not good
- try {
- token = <RBRACKET>
- {pos = token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "']' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {return new ArrayDeclarator(prefix,expression,pos);}
-|
- token = <LBRACE> {pos = token.sourceEnd+1;}
- [ expression = Expression() {pos = expression.sourceEnd+1;}
- | expression = Type() {pos = expression.sourceEnd+1;}] //Not good
- try {
- token = <RBRACE>
- {pos = token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "']' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {return new ArrayDeclarator(prefix,expression,pos);}//todo : check braces here
-}
-
-Literal Literal() :
-{
- final Token token;
- StringLiteral literal;
-}
-{
- token = <INTEGER_LITERAL> {return new NumberLiteral(token);}
-| token = <FLOATING_POINT_LITERAL> {return new NumberLiteral(token);}
-| token = <STRING_LITERAL> {return new StringLiteral(token);}
-| token = <TRUE> {return new TrueLiteral(token);}
-| token = <FALSE> {return new FalseLiteral(token);}
-| token = <NULL> {return new NullLiteral(token);}
-| literal = evaluableString() {return literal;}
-}
-
-StringLiteral evaluableString() :
-{
- ArrayList list = new ArrayList();
- Token start,end;
- Token token,lbrace,rbrace;
- AbstractVariable var;
- Expression expr;
-}
-{
- start = <DOUBLEQUOTE>
- (
- <DOLLARS>
- (
- token = <IDENTIFIER> {list.add(new Variable(token.image,
- token.sourceStart,
- token.sourceEnd));}
- |
- lbrace = <LBRACE1>
- token = <ID>
- {list.add(new Variable(token.image,
- token.sourceStart,
- token.sourceEnd));}
- rbrace = <RBRACE1>
- )
- )*
- end = <DOUBLEQUOTE2>
- {
- AbstractVariable[] vars = new AbstractVariable[list.size()];
- list.toArray(vars);
- return new StringLiteral(jj_input_stream.getCurrentBuffer().substring(start.sourceEnd,end.sourceStart),
- start.sourceStart,
- end.sourceEnd,
- vars);
- }
-}
-
-FunctionCall Arguments(final Expression func) :
-{
-Expression[] args = null;
-final Token token,lparen;
-}
-{
- lparen = <LPAREN> [ args = ArgumentList() ]
- try {
- token = <RPAREN>
- {return new FunctionCall(func,args,token.sourceEnd);}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list";
- errorLevel = ERROR;
- if (args == null) {
- errorStart = lparen.sourceEnd+1;
- errorEnd = lparen.sourceEnd+2;
- } else {
- errorStart = args[args.length-1].sourceEnd+1;
- errorEnd = args[args.length-1].sourceEnd+2;
- }
- processParseExceptionDebug(e);
- }
- {
- int sourceEnd = (args == null && args.length != 0) ? lparen.sourceEnd+1 : args[args.length-1].sourceEnd;
- return new FunctionCall(func,args,sourceEnd);}
-}
-
-/**
- * An argument list is a list of arguments separated by comma :
- * argumentDeclaration() (, argumentDeclaration)*
- * @return an array of arguments
- */
-Expression[] ArgumentList() :
-{
-Expression arg;
-final ArrayList list = new ArrayList();
-int pos;
-Token token;
-}
-{
- arg = Expression()
- {list.add(arg);pos = arg.sourceEnd;}
- ( token = <COMMA> {pos = token.sourceEnd;}
- try {
- arg = Expression()
- {list.add(arg);
- pos = arg.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. An expression expected after a comma in argument list";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseException(e);
- }
- )*
- {
- final Expression[] arguments = new Expression[list.size()];
- list.toArray(arguments);
- return arguments;}
-}
-
-/**
- * A Statement without break.
- * @return a statement
- */
-Statement StatementNoBreak() :
-{
- final Statement statement;
- Token token = null;
-}
-{
- LOOKAHEAD(2)
- statement = expressionStatement() {return statement;}
-| LOOKAHEAD(1)
- statement = LabeledStatement() {return statement;}
-| statement = Block() {return statement;}
-| statement = EmptyStatement() {return statement;}
-| statement = SwitchStatement() {return statement;}
-| statement = IfStatement() {return statement;}
-| statement = WhileStatement() {return statement;}
-| statement = DoStatement() {return statement;}
-| statement = ForStatement() {return statement;}
-| statement = ForeachStatement() {return statement;}
-| statement = ContinueStatement() {return statement;}
-| statement = ReturnStatement() {return statement;}
-| statement = EchoStatement() {return statement;}
-| [token=<AT>] statement = IncludeStatement()
- {if (token != null) {
- ((InclusionStatement)statement).silent = true;
- statement.sourceStart = token.sourceStart;
- }
- return statement;}
-| statement = StaticStatement() {return statement;}
-| statement = GlobalStatement() {return statement;}
-| statement = defineStatement() {currentSegment.add((Outlineable)statement);return statement;}
-}
-
-/**
- * A statement expression.
- * expression ;
- * @return an expression
- */
-Statement expressionStatement() :
-{
- final Statement statement;
- final Token token;
-}
-{
- statement = Expression()
- try {
- token = <SEMICOLON>
- {statement.sourceEnd = token.sourceEnd;}
- } catch (ParseException e) {
- if (e.currentToken.next.kind != PHPParserConstants.PHPEND) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
- errorLevel = ERROR;
- errorStart = statement.sourceEnd+1;
- errorEnd = statement.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- }
- {return statement;}
-}
-
-Define defineStatement() :
-{
- Expression defineName,defineValue;
- final Token defineToken;
- Token token;
- int pos;
-}
-{
- defineToken = <DEFINE> {pos = defineToken.sourceEnd+1;}
- try {
- token = <LPAREN>
- {pos = token.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- try {
- defineName = Expression()
- {pos = defineName.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- defineName = new StringLiteral(SYNTAX_ERROR_CHAR,pos,pos);
- }
- try {
- token = <COMMA>
- {pos = defineName.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- try {
- defineValue = Expression()
- {pos = defineValue.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- defineValue = new StringLiteral(SYNTAX_ERROR_CHAR,pos,pos);
- }
- try {
- token = <RPAREN>
- {pos = token.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {return new Define(currentSegment,
- defineName,
- defineValue,
- defineToken.sourceStart,
- pos);}
-}
-
-/**
- * A Normal statement.
- */
-Statement Statement() :
-{
- final Statement statement;
-}
-{
- statement = StatementNoBreak() {return statement;}
-| statement = BreakStatement() {return statement;}
-}
-
-/**
- * An html block inside a php syntax.
- */
-HTMLBlock htmlBlock() :
-{
- final int startIndex = nodePtr;
- final AstNode[] blockNodes;
- final int nbNodes;
- final Token phpEnd;
-}
-{
- phpEnd = <PHPEND>
- {htmlStart = phpEnd.sourceEnd;}
- (phpEchoBlock())*
- try {
- (<PHPSTARTLONG> | <PHPSTARTSHORT>)
- {createNewHTMLCode();}
- } catch (ParseException e) {
- errorMessage = "unexpected end of file , '<?php' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- throw e;
- }
- {
- nbNodes = nodePtr - startIndex;
- if (nbNodes == 0) {
- return null;
- }
- blockNodes = new AstNode[nbNodes];
- System.arraycopy(nodes,startIndex+1,blockNodes,0,nbNodes);
- nodePtr = startIndex;
- return new HTMLBlock(blockNodes);}
-}
-
-/**
- * An include statement. It's "include" an expression;
- */
-InclusionStatement IncludeStatement() :
-{
- Expression expr;
- final int keyword;
- final InclusionStatement inclusionStatement;
- final Token token, token2;
- int pos;
-}
-{
- ( token = <REQUIRE> {keyword = InclusionStatement.REQUIRE;pos=token.sourceEnd;}
- | token = <REQUIRE_ONCE> {keyword = InclusionStatement.REQUIRE_ONCE;pos=token.sourceEnd;}
- | token = <INCLUDE> {keyword = InclusionStatement.INCLUDE;pos=token.sourceEnd;}
- | token = <INCLUDE_ONCE> {keyword = InclusionStatement.INCLUDE_ONCE;pos=token.sourceEnd;})
- try {
- expr = Expression()
- {pos = expr.sourceEnd;}
- } catch (ParseException e) {
- if (errorMessage != null) {
- throw e;
- }
- errorMessage = "unexpected token '"+ e.currentToken.next.image+"', expression expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.next.sourceStart;
- errorEnd = e.currentToken.next.sourceEnd;
- expr = new ConstantIdentifier(SYNTAX_ERROR_CHAR,pos,pos);
- processParseExceptionDebug(e);
- }
- try {
- token2 = <SEMICOLON>
- {pos=token2.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.next.sourceStart;
- errorEnd = e.currentToken.next.sourceEnd;
- processParseExceptionDebug(e);
- }
- {
- inclusionStatement = new InclusionStatement(currentSegment,
- keyword,
- expr,
- token.sourceStart,
- pos);
- currentSegment.add(inclusionStatement);
- return inclusionStatement;
- }
-}
-
-PrintExpression PrintExpression() :
-{
- final Expression expr;
- final Token printToken;
-}
-{
- token = <PRINT> expr = Expression()
- {return new PrintExpression(expr,token.sourceStart,expr.sourceEnd);}
-}
-
-ListExpression ListExpression() :
-{
- Expression expr = null;
- final Expression expression;
- final ArrayList list = new ArrayList();
- int pos;
- final Token listToken, rParen;
- Token token;
-}
-{
- listToken = <LIST> {pos = listToken.sourceEnd;}
- try {
- token = <LPAREN> {pos = token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected";
- errorLevel = ERROR;
- errorStart = listToken.sourceEnd+1;
- errorEnd = listToken.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- [
- expr = VariableDeclaratorId()
- {list.add(expr);pos = expr.sourceEnd;}
- ]
- {if (expr == null) list.add(null);}
- (
- try {
- token = <COMMA>
- {pos = token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- [expr = VariableDeclaratorId() {list.add(expr);pos = expr.sourceEnd;}]
- )*
- try {
- rParen = <RPAREN>
- {pos = rParen.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- [ <ASSIGN> expression = Expression()
- {
- final AbstractVariable[] vars = new AbstractVariable[list.size()];
- list.toArray(vars);
- return new ListExpression(vars,
- expression,
- listToken.sourceStart,
- expression.sourceEnd);}
- ]
- {
- final AbstractVariable[] vars = new AbstractVariable[list.size()];
- list.toArray(vars);
- return new ListExpression(vars,listToken.sourceStart,pos);}
-}
-
-/**
- * An echo statement.
- * echo anyexpression (, otherexpression)*
- */
-EchoStatement EchoStatement() :
-{
- final ArrayList expressions = new ArrayList();
- Expression expr;
- Token token;
- Token token2 = null;
-}
-{
- token = <ECHO> expr = Expression()
- {expressions.add(expr);}
- (
- <COMMA> expr = Expression()
- {expressions.add(expr);}
- )*
- try {
- token2 = <SEMICOLON>
- } catch (ParseException e) {
- if (e.currentToken.next.kind != 4) {
- errorMessage = "';' expected after 'echo' statement";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceEnd;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- }
- {
- final Expression[] exprs = new Expression[expressions.size()];
- expressions.toArray(exprs);
- if (token2 == null) {
- return new EchoStatement(exprs,token.sourceStart, exprs[exprs.length-1].sourceEnd);
- }
- return new EchoStatement(exprs,token.sourceStart, token2.sourceEnd);
- }
-}
-
-GlobalStatement GlobalStatement() :
-{
- Variable expr;
- final ArrayList vars = new ArrayList();
- final GlobalStatement global;
- final Token token, token2;
- int pos;
-}
-{
- token = <GLOBAL>
- expr = Variable()
- {vars.add(expr);pos = expr.sourceEnd+1;}
- (<COMMA>
- expr = Variable()
- {vars.add(expr);pos = expr.sourceEnd+1;}
- )*
- try {
- token2 = <SEMICOLON>
- {pos = token2.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {
- final Variable[] variables = new Variable[vars.size()];
- vars.toArray(variables);
- global = new GlobalStatement(currentSegment,
- variables,
- token.sourceStart,
- pos);
- currentSegment.add(global);
- return global;}
-}
-
-StaticStatement StaticStatement() :
-{
- final ArrayList vars = new ArrayList();
- VariableDeclaration expr;
- final Token token, token2;
- int pos;
-}
-{
- token = <STATIC> expr = VariableDeclarator() {vars.add(expr);pos = expr.sourceEnd+1;}
- (
- <COMMA> expr = VariableDeclarator() {vars.add(expr);pos = expr.sourceEnd+1;}
- )*
- try {
- token2 = <SEMICOLON>
- {pos = token2.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseException(e);
- }
- {
- final VariableDeclaration[] variables = new VariableDeclaration[vars.size()];
- vars.toArray(variables);
- return new StaticStatement(variables,
- token.sourceStart,
- pos);}
-}
-
-LabeledStatement LabeledStatement() :
-{
- final Token label;
- final Statement statement;
-}
-{
- label = <IDENTIFIER> <COLON> statement = Statement()
- {return new LabeledStatement(label.image,statement,label.sourceStart,statement.sourceEnd);}
-}
-
-/**
- * A Block is
- * {
- * statements
- * }.
- * @return a block
- */
-Block Block() :
-{
- final ArrayList list = new ArrayList();
- Statement statement;
- final Token token, token2;
- int pos,start;
-}
-{
- try {
- token = <LBRACE>
- {pos = token.sourceEnd+1;start=token.sourceStart;}
- } catch (ParseException e) {
- errorMessage = "'{' expected";
- errorLevel = ERROR;
- pos = this.token.sourceEnd+1;
- start=pos;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- ( statement = BlockStatement() {list.add(statement);pos = statement.sourceEnd+1;}
- | statement = htmlBlock() {if (statement != null) {
- list.add(statement);
- pos = statement.sourceEnd+1;
- }
- pos = this.token.sourceEnd+1;
- }
- )*
- try {
- token2 = <RBRACE>
- {pos = token2.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.image +"', '}' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {
- final Statement[] statements = new Statement[list.size()];
- list.toArray(statements);
- return new Block(statements,start,pos);}
-}
-
-Statement BlockStatement() :
-{
- final Statement statement;
-}
-{
- try {
- statement = Statement() {if (phpDocument == currentSegment) pushOnAstNodes(statement);
- return statement;}
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.image +"', a statement was expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- throw e;
- }
-| statement = ClassDeclaration() {return statement;}
-| statement = MethodDeclaration() {if (phpDocument == currentSegment) pushOnAstNodes(statement);
- currentSegment.add((MethodDeclaration) statement);
- ((MethodDeclaration) statement).analyzeCode();
- return statement;}
-}
-
-/**
- * A Block statement that will not contain any 'break'
- */
-Statement BlockStatementNoBreak() :
-{
- final Statement statement;
-}
-{
- statement = StatementNoBreak() {return statement;}
-| statement = ClassDeclaration() {return statement;}
-| statement = MethodDeclaration() {currentSegment.add((MethodDeclaration) statement);
- ((MethodDeclaration) statement).analyzeCode();
- return statement;}
-}
-
-/**
- * used only by ForInit()
- */
-Expression[] LocalVariableDeclaration() :
-{
- final ArrayList list = new ArrayList();
- Expression var;
-}
-{
- var = Expression()
- {list.add(var);}
- ( <COMMA> var = Expression() {list.add(var);})*
- {
- final Expression[] vars = new Expression[list.size()];
- list.toArray(vars);
- return vars;
- }
-}
-
-/**
- * used only by LocalVariableDeclaration().
- */
-VariableDeclaration LocalVariableDeclarator() :
-{
- final Variable varName;
- Expression initializer = null;
-}
-{
- varName = Variable() [ <ASSIGN> initializer = Expression() ]
- {
- if (initializer == null) {
- return new VariableDeclaration(currentSegment,
- varName,
- varName.sourceStart,
- varName.sourceEnd);
- }
- return new VariableDeclaration(currentSegment,
- varName,
- initializer,
- VariableDeclaration.EQUAL,
- varName.sourceStart);
- }
-}
-
-EmptyStatement EmptyStatement() :
-{
- final Token token;
-}
-{
- token = <SEMICOLON>
- {return new EmptyStatement(token.sourceStart,token.sourceEnd);}
-}
-
-/**
- * used only by StatementExpressionList() which is used only by ForInit() and ForStatement()
- */
-Expression StatementExpression() :
-{
- final Expression expr;
- final Token operator;
-}
-{
- expr = PreIncDecExpression() {return expr;}
-|
- expr = PrimaryExpression()
- [ operator = <PLUS_PLUS> {return new PostfixedUnaryExpression(expr,
- OperatorIds.PLUS_PLUS,
- operator.sourceEnd);}
- | operator = <MINUS_MINUS> {return new PostfixedUnaryExpression(expr,
- OperatorIds.MINUS_MINUS,
- operator.sourceEnd);}
- ]
- {return expr;}
-}
-
-SwitchStatement SwitchStatement() :
-{
- Expression variable;
- final AbstractCase[] cases;
- final Token switchToken,lparenToken,rparenToken;
- int pos;
-}
-{
- switchToken = <SWITCH> {pos = switchToken.sourceEnd+1;}
- try {
- lparenToken = <LPAREN>
- {pos = lparenToken.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "'(' expected after 'switch'";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- try {
- variable = Expression() {pos = variable.sourceEnd+1;}
- } catch (ParseException e) {
- if (errorMessage != null) {
- throw e;
- }
- errorMessage = "expression expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- variable = new ConstantIdentifier(SYNTAX_ERROR_CHAR,pos,pos);
- }
- try {
- rparenToken = <RPAREN> {pos = rparenToken.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "')' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- ( cases = switchStatementBrace()
- | cases = switchStatementColon(switchToken.sourceStart, switchToken.sourceEnd))
- {return new SwitchStatement(variable,
- cases,
- switchToken.sourceStart,
- this.token.sourceEnd);}
-}
-
-AbstractCase[] switchStatementBrace() :
-{
- AbstractCase cas;
- final ArrayList cases = new ArrayList();
- Token token;
- int pos;
-}
-{
- token = <LBRACE> {pos = token.sourceEnd;}
- ( cas = switchLabel0() {cases.add(cas);pos = cas.sourceEnd;})*
- try {
- token = <RBRACE>
- {pos = token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "'}' expected";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- {
- final AbstractCase[] abcase = new AbstractCase[cases.size()];
- cases.toArray(abcase);
- return abcase;
- }
-}
-
-/**
- * A Switch statement with : ... endswitch;
- * @param start the begin offset of the switch
- * @param end the end offset of the switch
- */
-AbstractCase[] switchStatementColon(final int start, final int end) :
-{
- AbstractCase cas;
- final ArrayList cases = new ArrayList();
- Token token;
- int pos;
-}
-{
- token = <COLON> {pos = token.sourceEnd;}
- {try {
- setMarker(fileToParse,
- "Ugly syntax detected, you should switch () {...} instead of switch (): ... enswitch;",
- start,
- end,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }}
- ( cas = switchLabel0() {cases.add(cas);pos = cas.sourceEnd;})*
- try {
- token = <ENDSWITCH> {pos = token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "'endswitch' expected";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- try {
- token = <SEMICOLON> {pos = token.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "';' expected after 'endswitch' keyword";
- errorLevel = ERROR;
- errorStart = pos+1;
- errorEnd = pos+1;
- processParseExceptionDebug(e);
- }
- {
- final AbstractCase[] abcase = new AbstractCase[cases.size()];
- cases.toArray(abcase);
- return abcase;
- }
-}
-
-AbstractCase switchLabel0() :
-{
- final Expression expr;
- Statement statement;
- final ArrayList stmts = new ArrayList();
- final Token token = this.token;
- final int start = this.token.next.sourceStart;
-}
-{
- expr = SwitchLabel()
- ( statement = BlockStatementNoBreak() {stmts.add(statement);}
- | statement = htmlBlock() {if (statement != null) {stmts.add(statement);}}
- | statement = BreakStatement() {stmts.add(statement);})*
- //[ statement = BreakStatement() {stmts.add(statement);}]
- {
- final int listSize = stmts.size();
- final Statement[] stmtsArray = new Statement[listSize];
- stmts.toArray(stmtsArray);
- if (expr == null) {//it's a default
- final int end = this.token.next.sourceStart;
- return new DefaultCase(stmtsArray,start,end);
- }
- if (listSize != 0) {
- return new Case(expr,stmtsArray,expr.sourceStart,stmtsArray[listSize-1].sourceEnd);
- } else {
- return new Case(expr,stmtsArray,expr.sourceStart,expr.sourceEnd);
- }
- }
-}
-
-/**
- * A SwitchLabel.
- * case Expression() :
- * default :
- * @return the if it was a case and null if not
- */
-Expression SwitchLabel() :
-{
- final Expression expr;
-}
-{
- token = <CASE>
- try {
- expr = Expression()
- } catch (ParseException e) {
- if (errorMessage != null) throw e;
- errorMessage = "expression expected after 'case' keyword";
- errorLevel = ERROR;
- errorStart = token.sourceEnd +1;
- errorEnd = token.sourceEnd +1;
- throw e;
- }
- try {
- token = <COLON>
- } catch (ParseException e) {
- errorMessage = "':' expected after case expression";
- errorLevel = ERROR;
- errorStart = expr.sourceEnd+1;
- errorEnd = expr.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- {return expr;}
-|
- token = <_DEFAULT>
- try {
- <COLON>
- } catch (ParseException e) {
- errorMessage = "':' expected after 'default' keyword";
- errorLevel = ERROR;
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- {return null;}
-}
-
-Break BreakStatement() :
-{
- Expression expression = null;
- final Token token, token2;
- int pos;
-}
-{
- token = <BREAK> {pos = token.sourceEnd+1;}
- [ expression = Expression() {pos = expression.sourceEnd+1;}]
- try {
- token2 = <SEMICOLON>
- {pos = token2.sourceEnd;}
- } catch (ParseException e) {
- errorMessage = "';' expected after 'break' keyword";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {return new Break(expression, token.sourceStart, pos);}
-}
-
-IfStatement IfStatement() :
-{
- final Expression condition;
- final IfStatement ifStatement;
- Token token;
-}
-{
- token = <IF> condition = Condition("if")
- ifStatement = IfStatement0(condition,token.sourceStart,token.sourceEnd)
- {return ifStatement;}
-}
-
-
-Expression Condition(final String keyword) :
-{
- final Expression condition;
-}
-{
- try {
- <LPAREN>
- } catch (ParseException e) {
- errorMessage = "'(' expected after " + keyword + " keyword";
- errorLevel = ERROR;
- errorStart = this.token.sourceEnd + 1;
- errorEnd = this.token.sourceEnd + 1;
- processParseExceptionDebug(e);
- }
- condition = Expression()
- try {
- <RPAREN>
- } catch (ParseException e) {
- errorMessage = "')' expected after " + keyword + " keyword";
- errorLevel = ERROR;
- errorStart = condition.sourceEnd+1;
- errorEnd = condition.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- {return condition;}
-}
-
-IfStatement IfStatement0(final Expression condition, final int start,final int end) :
-{
- Statement statement;
- final Statement stmt;
- final Statement[] statementsArray;
- ElseIf elseifStatement;
- Else elseStatement = null;
- final ArrayList stmts;
- final ArrayList elseIfList = new ArrayList();
- final ElseIf[] elseIfs;
- int pos = jj_input_stream.getPosition();
- final int endStatements;
-}
-{
- <COLON>
- {stmts = new ArrayList();}
- ( statement = Statement() {stmts.add(statement);}
- | statement = htmlBlock() {if (statement != null) {stmts.add(statement);}})*
- {endStatements = jj_input_stream.getPosition();}
- (elseifStatement = ElseIfStatementColon() {elseIfList.add(elseifStatement);})*
- [elseStatement = ElseStatementColon()]
-
- {try {
- setMarker(fileToParse,
- "Ugly syntax detected, you should if () {...} instead of if (): ... endif;",
- start,
- end,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }}
- try {
- <ENDIF>
- } catch (ParseException e) {
- errorMessage = "'endif' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- throw e;
- }
- try {
- <SEMICOLON>
- } catch (ParseException e) {
- errorMessage = "';' expected after 'endif' keyword";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- throw e;
- }
- {
- elseIfs = new ElseIf[elseIfList.size()];
- elseIfList.toArray(elseIfs);
- if (stmts.size() == 1) {
- return new IfStatement(condition,
- (Statement) stmts.get(0),
- elseIfs,
- elseStatement,
- pos,
- jj_input_stream.getPosition());
- } else {
- statementsArray = new Statement[stmts.size()];
- stmts.toArray(statementsArray);
- return new IfStatement(condition,
- new Block(statementsArray,pos,endStatements),
- elseIfs,
- elseStatement,
- pos,
- jj_input_stream.getPosition());
- }
- }
-
-|
- (stmt = Statement() | stmt = htmlBlock())
- ( LOOKAHEAD(1) elseifStatement = ElseIfStatement() {elseIfList.add(elseifStatement);})*
- [ LOOKAHEAD(1)
- <ELSE>
- try {
- {pos = jj_input_stream.getPosition();}
- statement = Statement()
- {elseStatement = new Else(statement,pos,jj_input_stream.getPosition());}
- } catch (ParseException e) {
- if (errorMessage != null) {
- throw e;
- }
- errorMessage = "unexpected token '"+e.currentToken.next.image+"', a statement was expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- throw e;
- }
- ]
- {
- elseIfs = new ElseIf[elseIfList.size()];
- elseIfList.toArray(elseIfs);
- return new IfStatement(condition,
- stmt,
- elseIfs,
- elseStatement,
- pos,
- jj_input_stream.getPosition());}
-}
-
-ElseIf ElseIfStatementColon() :
-{
- final Expression condition;
- Statement statement;
- final ArrayList list = new ArrayList();
- final Token elseifToken;
-}
-{
- elseifToken = <ELSEIF> condition = Condition("elseif")
- <COLON> ( statement = Statement() {list.add(statement);}
- | statement = htmlBlock() {if (statement != null) {list.add(statement);}})*
- {
- final int sizeList = list.size();
- final Statement[] stmtsArray = new Statement[sizeList];
- list.toArray(stmtsArray);
- return new ElseIf(condition,stmtsArray ,
- elseifToken.sourceStart,
- stmtsArray[sizeList-1].sourceEnd);}
-}
-
-Else ElseStatementColon() :
-{
- Statement statement;
- final ArrayList list = new ArrayList();
- final Token elseToken;
-}
-{
- elseToken = <ELSE> <COLON> ( statement = Statement() {list.add(statement);}
- | statement = htmlBlock() {if (statement != null) {list.add(statement);}})*
- {
- final int sizeList = list.size();
- final Statement[] stmtsArray = new Statement[sizeList];
- list.toArray(stmtsArray);
- return new Else(stmtsArray,elseToken.sourceStart,stmtsArray[sizeList-1].sourceEnd);}
-}
-
-ElseIf ElseIfStatement() :
-{
- final Expression condition;
- //final Statement statement;
- final Token elseifToken;
- final Statement[] statement = new Statement[1];
-}
-{
- elseifToken = <ELSEIF> condition = Condition("elseif") statement[0] = Statement()
- {
- return new ElseIf(condition,statement,elseifToken.sourceStart,statement[0].sourceEnd);}
-}
-
-WhileStatement WhileStatement() :
-{
- final Expression condition;
- final Statement action;
- final Token whileToken;
-}
-{
- whileToken = <WHILE>
- condition = Condition("while")
- action = WhileStatement0(whileToken.sourceStart,whileToken.sourceEnd)
- {return new WhileStatement(condition,action,whileToken.sourceStart,action.sourceEnd);}
-}
-
-Statement WhileStatement0(final int start, final int end) :
-{
- Statement statement;
- final ArrayList stmts = new ArrayList();
- final int pos = jj_input_stream.getPosition();
-}
-{
- <COLON> (statement = Statement() {stmts.add(statement);})*
- {try {
- setMarker(fileToParse,
- "Ugly syntax detected, you should while () {...} instead of while (): ... endwhile;",
- start,
- end,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }}
- try {
- <ENDWHILE>
- } catch (ParseException e) {
- errorMessage = "'endwhile' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- throw e;
- }
- try {
- <SEMICOLON>
- {
- final Statement[] stmtsArray = new Statement[stmts.size()];
- stmts.toArray(stmtsArray);
- return new Block(stmtsArray,pos,jj_input_stream.getPosition());}
- } catch (ParseException e) {
- errorMessage = "';' expected after 'endwhile' keyword";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- throw e;
- }
-|
- statement = Statement()
- {return statement;}
-}
-
-DoStatement DoStatement() :
-{
- final Statement action;
- final Expression condition;
- final Token token;
- Token token2 = null;
-}
-{
- token = <DO> action = Statement() <WHILE> condition = Condition("while")
- try {
- token2 = <SEMICOLON>
- } catch (ParseException e) {
- errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
- errorLevel = ERROR;
- errorStart = condition.sourceEnd+1;
- errorEnd = condition.sourceEnd+1;
- processParseExceptionDebug(e);
- }
- {
- if (token2 == null) {
- return new DoStatement(condition,action,token.sourceStart,condition.sourceEnd);
- }
- return new DoStatement(condition,action,token.sourceStart,token2.sourceEnd);
- }
-}
-
-ForeachStatement ForeachStatement() :
-{
- Statement statement = null;
- Expression expression = null;
- ArrayVariableDeclaration variable = null;
- Token foreachToken;
- Token lparenToken = null;
- Token asToken = null;
- Token rparenToken = null;
- int pos;
-}
-{
- foreachToken = <FOREACH>
- try {
- lparenToken = <LPAREN>
- {pos = lparenToken.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "'(' expected after 'foreach' keyword";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- {pos = foreachToken.sourceEnd+1;}
- }
- try {
- expression = Expression()
- {pos = expression.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "variable expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- try {
- asToken = <AS>
- {pos = asToken.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "'as' expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- try {
- variable = ArrayVariable()
- {pos = variable.sourceEnd+1;}
- } catch (ParseException e) {
- if (errorMessage != null) throw e;
- errorMessage = "variable expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- try {
- rparenToken = <RPAREN>
- {pos = rparenToken.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "')' expected after 'foreach' keyword";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- try {
- statement = Statement()
- {pos = statement.sourceEnd+1;}
- } catch (ParseException e) {
- if (errorMessage != null) throw e;
- errorMessage = "statement expected";
- errorLevel = ERROR;
- errorStart = e.currentToken.sourceStart;
- errorEnd = e.currentToken.sourceEnd;
- processParseExceptionDebug(e);
- }
- {
- return new ForeachStatement(expression,
- variable,
- statement,
- foreachToken.sourceStart,
- pos);}
-
-}
-
-/**
- * a for declaration.
- * @return a node representing the for statement
- */
-ForStatement ForStatement() :
-{
-final Token token,tokenEndFor,token2,tokenColon;
-int pos;
-Expression[] initializations = null;
-Expression condition = null;
-Expression[] increments = null;
-Statement action;
-final ArrayList list = new ArrayList();
-}
-{
- token = <FOR>
- try {
- <LPAREN>
- } catch (ParseException e) {
- errorMessage = "'(' expected after 'for' keyword";
- errorLevel = ERROR;
- errorStart = token.sourceEnd;
- errorEnd = token.sourceEnd +1;
- processParseExceptionDebug(e);
- }
- [ initializations = ForInit() ] <SEMICOLON>
- [ condition = Expression() ] <SEMICOLON>
- [ increments = StatementExpressionList() ] <RPAREN>
- (
- action = Statement()
- {return new ForStatement(initializations,
- condition,
- increments,
- action,
- token.sourceStart,
- action.sourceEnd);}
- |
- tokenColon = <COLON> {pos = tokenColon.sourceEnd+1;}
- (action = Statement() {list.add(action);pos = action.sourceEnd+1;})*
- {
- try {
- setMarker(fileToParse,
- "Ugly syntax detected, you should for () {...} instead of for (): ... endfor;",
- token.sourceStart,
- token.sourceEnd,
- INFO,
- "Line " + token.beginLine);
- } catch (CoreException e) {
- PHPeclipsePlugin.log(e);
- }
- }
- try {
- tokenEndFor = <ENDFOR>
- {pos = tokenEndFor.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "'endfor' expected";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- try {
- token2 = <SEMICOLON>
- {pos = token2.sourceEnd+1;}
- } catch (ParseException e) {
- errorMessage = "';' expected after 'endfor' keyword";
- errorLevel = ERROR;
- errorStart = pos;
- errorEnd = pos;
- processParseExceptionDebug(e);
- }
- {
- final Statement[] stmtsArray = new Statement[list.size()];
- list.toArray(stmtsArray);
- return new ForStatement(initializations,
- condition,
- increments,
- new Block(stmtsArray,
- stmtsArray[0].sourceStart,
- stmtsArray[stmtsArray.length-1].sourceEnd),
- token.sourceStart,
- pos);}
- )
-}
-
-Expression[] ForInit() :
-{
- final Expression[] exprs;
-}
-{
- LOOKAHEAD(LocalVariableDeclaration())
- exprs = LocalVariableDeclaration()
- {return exprs;}
-|
- exprs = StatementExpressionList()
- {return exprs;}
-}
-
-Expression[] StatementExpressionList() :
-{
- final ArrayList list = new ArrayList();
- final Expression expr;
-}
-{
- expr = Expression() {list.add(expr);}
- (<COMMA> Expression() {list.add(expr);})*
- {
- final Expression[] exprsArray = new Expression[list.size()];
- list.toArray(exprsArray);
- return exprsArray;
- }
-}
-
-Continue ContinueStatement() :
-{
- Expression expr = null;
- final Token token;
- Token token2 = null;
-}
-{
- token = <CONTINUE> [ expr = Expression() ]
- try {
- token2 = <SEMICOLON>
- } catch (ParseException e) {
- errorMessage = "';' expected after 'continue' statement";
- errorLevel = ERROR;
- if (expr == null) {
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- } else {
- errorStart = expr.sourceEnd+1;
- errorEnd = expr.sourceEnd+1;
- }
- processParseExceptionDebug(e);
- }
- {
- if (token2 == null) {
- if (expr == null) {
- return new Continue(expr,token.sourceStart,token.sourceEnd);
- }
- return new Continue(expr,token.sourceStart,expr.sourceEnd);
- }
- return new Continue(expr,token.sourceStart,token2.sourceEnd);
- }
-}
-
-ReturnStatement ReturnStatement() :
-{
- Expression expr = null;
- final Token token;
- Token token2 = null;
-}
-{
- token = <RETURN> [ expr = Expression() ]
- try {
- token2 = <SEMICOLON>
- } catch (ParseException e) {
- errorMessage = "';' expected after 'return' statement";
- errorLevel = ERROR;
- if (expr == null) {
- errorStart = token.sourceEnd+1;
- errorEnd = token.sourceEnd+1;
- } else {
- errorStart = expr.sourceEnd+1;
- errorEnd = expr.sourceEnd+1;
- }
- processParseExceptionDebug(e);
- }
- {
- if (token2 == null) {
- if (expr == null) {
- return new ReturnStatement(expr,token.sourceStart,token.sourceEnd);
- }
- return new ReturnStatement(expr,token.sourceStart,expr.sourceEnd);
- }
- return new ReturnStatement(expr,token.sourceStart,token2.sourceEnd);
- }
-}
-
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. PHPParserConstants.java */
-package test;
-
-public interface PHPParserConstants {
-
- int EOF = 0;
- int PHPSTARTSHORT = 1;
- int PHPSTARTLONG = 2;
- int PHPECHOSTART = 3;
- int PHPEND = 4;
- int SINGLE_LINE_COMMENT = 20;
- int CLASS = 27;
- int FUNCTION = 28;
- int VAR = 29;
- int IF = 30;
- int ELSEIF = 31;
- int ELSE = 32;
- int ARRAY = 33;
- int BREAK = 34;
- int LIST = 35;
- int PRINT = 36;
- int ECHO = 37;
- int INCLUDE = 38;
- int REQUIRE = 39;
- int INCLUDE_ONCE = 40;
- int REQUIRE_ONCE = 41;
- int GLOBAL = 42;
- int DEFINE = 43;
- int STATIC = 44;
- int CLASSACCESS = 45;
- int STATICCLASSACCESS = 46;
- int ARRAYASSIGN = 47;
- int CASE = 48;
- int CONST = 49;
- int CONTINUE = 50;
- int _DEFAULT = 51;
- int DO = 52;
- int EXTENDS = 53;
- int FOR = 54;
- int GOTO = 55;
- int NEW = 56;
- int NULL = 57;
- int RETURN = 58;
- int SUPER = 59;
- int SWITCH = 60;
- int THIS = 61;
- int TRUE = 62;
- int FALSE = 63;
- int WHILE = 64;
- int ENDWHILE = 65;
- int ENDSWITCH = 66;
- int ENDIF = 67;
- int ENDFOR = 68;
- int FOREACH = 69;
- int AS = 70;
- int STRING = 71;
- int OBJECT = 72;
- int BOOL = 73;
- int BOOLEAN = 74;
- int REAL = 75;
- int DOUBLE = 76;
- int FLOAT = 77;
- int INT = 78;
- int INTEGER = 79;
- int AT = 80;
- int BANG = 81;
- int TILDE = 82;
- int HOOK = 83;
- int COLON = 84;
- int OR_OR = 85;
- int AND_AND = 86;
- int PLUS_PLUS = 87;
- int MINUS_MINUS = 88;
- int PLUS = 89;
- int MINUS = 90;
- int STAR = 91;
- int SLASH = 92;
- int BIT_AND = 93;
- int BIT_OR = 94;
- int XOR = 95;
- int REMAINDER = 96;
- int LSHIFT = 97;
- int RSIGNEDSHIFT = 98;
- int RUNSIGNEDSHIFT = 99;
- int _ORL = 100;
- int _ANDL = 101;
- int INTEGER_LITERAL = 102;
- int DECIMAL_LITERAL = 103;
- int HEX_LITERAL = 104;
- int OCTAL_LITERAL = 105;
- int FLOATING_POINT_LITERAL = 106;
- int EXPONENT = 107;
- int STRING_LITERAL = 108;
- int STRING_2 = 109;
- int STRING_3 = 110;
- int ESCAPED = 111;
- int DOUBLEQUOTE = 112;
- int DOLLARS = 113;
- int DOUBLEQUOTE2 = 114;
- int LBRACE1 = 115;
- int RBRACE1 = 119;
- int ID = 120;
- int DOLLAR = 123;
- int IDENTIFIER = 124;
- int LETTER = 125;
- int DIGIT = 126;
- int SPECIAL = 127;
- int LPAREN = 129;
- int RPAREN = 130;
- int LBRACE = 131;
- int RBRACE = 132;
- int LBRACKET = 133;
- int RBRACKET = 134;
- int SEMICOLON = 135;
- int COMMA = 136;
- int DOT = 137;
- int GT = 138;
- int LT = 139;
- int EQUAL_EQUAL = 140;
- int LE = 141;
- int GE = 142;
- int NOT_EQUAL = 143;
- int DIF = 144;
- int BANGDOUBLEEQUAL = 145;
- int TRIPLEEQUAL = 146;
- int ASSIGN = 147;
- int PLUSASSIGN = 148;
- int MINUSASSIGN = 149;
- int STARASSIGN = 150;
- int SLASHASSIGN = 151;
- int ANDASSIGN = 152;
- int ORASSIGN = 153;
- int XORASSIGN = 154;
- int DOTASSIGN = 155;
- int REMASSIGN = 156;
- int TILDEEQUAL = 157;
- int LSHIFTASSIGN = 158;
- int RSIGNEDSHIFTASSIGN = 159;
-
- int DEFAULT = 0;
- int PHPPARSING = 1;
- int IN_SINGLE_LINE_COMMENT = 2;
- int IN_VARIABLE = 3;
- int IN_FORMAL_COMMENT = 4;
- int IN_MULTI_LINE_COMMENT = 5;
- int IN_STRING = 6;
- int DOLLAR_IN_STRING = 7;
- int SKIPSTRING = 8;
- int DOLLAR_IN_STRING_EXPR = 9;
-
- String[] tokenImage = {
- "<EOF>",
- "\"<?\"",
- "\"<?php\"",
- "\"<?=\"",
- "\"?>\"",
- "<token of kind 5>",
- "\" \"",
- "\"\\t\"",
- "\"\\n\"",
- "\"\\r\"",
- "\"\\f\"",
- "\" \"",
- "\"\\t\"",
- "\"\\n\"",
- "\"\\r\"",
- "\"\\f\"",
- "\"//\"",
- "\"#\"",
- "<token of kind 18>",
- "\"/*\"",
- "<SINGLE_LINE_COMMENT>",
- "<token of kind 21>",
- "\"todo\"",
- "\"TODO\"",
- "\"*/\"",
- "\"*/\"",
- "<token of kind 26>",
- "\"class\"",
- "\"function\"",
- "\"var\"",
- "\"if\"",
- "\"elseif\"",
- "\"else\"",
- "\"array\"",
- "\"break\"",
- "\"list\"",
- "\"print\"",
- "\"echo\"",
- "\"include\"",
- "\"require\"",
- "\"include_once\"",
- "\"require_once\"",
- "\"global\"",
- "\"define\"",
- "\"static\"",
- "\"->\"",
- "\"::\"",
- "\"=>\"",
- "\"case\"",
- "\"const\"",
- "\"continue\"",
- "\"default\"",
- "\"do\"",
- "\"extends\"",
- "\"for\"",
- "\"goto\"",
- "\"new\"",
- "\"null\"",
- "\"return\"",
- "\"super\"",
- "\"switch\"",
- "\"this\"",
- "\"true\"",
- "\"false\"",
- "\"while\"",
- "\"endwhile\"",
- "\"endswitch\"",
- "\"endif\"",
- "\"endfor\"",
- "\"foreach\"",
- "\"as\"",
- "\"string\"",
- "\"object\"",
- "\"bool\"",
- "\"boolean\"",
- "\"real\"",
- "\"double\"",
- "\"float\"",
- "\"int\"",
- "\"integer\"",
- "\"@\"",
- "\"!\"",
- "\"~\"",
- "\"?\"",
- "\":\"",
- "\"||\"",
- "\"&&\"",
- "\"++\"",
- "\"--\"",
- "\"+\"",
- "\"-\"",
- "\"*\"",
- "\"/\"",
- "\"&\"",
- "\"|\"",
- "\"^\"",
- "\"%\"",
- "\"<<\"",
- "\">>\"",
- "\">>>\"",
- "\"OR\"",
- "\"AND\"",
- "<INTEGER_LITERAL>",
- "<DECIMAL_LITERAL>",
- "<HEX_LITERAL>",
- "<OCTAL_LITERAL>",
- "<FLOATING_POINT_LITERAL>",
- "<EXPONENT>",
- "<STRING_LITERAL>",
- "<STRING_2>",
- "<STRING_3>",
- "<ESCAPED>",
- "\"\\\"\"",
- "\"$\"",
- "\"\\\"\"",
- "\"{\"",
- "\"{\"",
- "\"}\"",
- "<token of kind 118>",
- "\"}\"",
- "<ID>",
- "<token of kind 121>",
- "<token of kind 122>",
- "\"$\"",
- "<IDENTIFIER>",
- "<LETTER>",
- "<DIGIT>",
- "<SPECIAL>",
- "<token of kind 128>",
- "\"(\"",
- "\")\"",
- "\"{\"",
- "\"}\"",
- "\"[\"",
- "\"]\"",
- "\";\"",
- "\",\"",
- "\".\"",
- "\">\"",
- "\"<\"",
- "\"==\"",
- "\"<=\"",
- "\">=\"",
- "\"!=\"",
- "\"<>\"",
- "\"!==\"",
- "\"===\"",
- "\"=\"",
- "\"+=\"",
- "\"-=\"",
- "\"*=\"",
- "\"/=\"",
- "\"&=\"",
- "\"|=\"",
- "\"^=\"",
- "\".=\"",
- "\"%=\"",
- "\"~=\"",
- "\"<<=\"",
- "\">>=\"",
- };
-
-}
+++ /dev/null
-package test;
-
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-
-import org.eclipse.core.resources.IFile;
-
-public class PHPParserManager {
-
-
- public static PHPParserSuperclass getParser(IFile fileToParse) {
- try {
- PHPParserSuperclass actualParser;
- if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) {
- actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
- } else {
- actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
- }
- actualParser.setFileToParse(fileToParse);
- return actualParser;
- } catch (InstantiationException e) {
- PHPeclipsePlugin.log(e);
- } catch (IllegalAccessException e) {
- PHPeclipsePlugin.log(e);
- } catch (ClassNotFoundException e) {
- PHPeclipsePlugin.log(e);
- }
- return null;
- }
-
- public static PHPParserSuperclass getParser() {
- try {
- PHPParserSuperclass actualParser;
- if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) {
- actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
- } else {
- actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance();
- }
- return actualParser;
- } catch (InstantiationException e) {
- PHPeclipsePlugin.log(e);
- } catch (IllegalAccessException e) {
- PHPeclipsePlugin.log(e);
- } catch (ClassNotFoundException e) {
- PHPeclipsePlugin.log(e);
- }
- return null;
- }
-
- /**
- * To avoid instantiation.
- */
- private PHPParserManager() {
- }
-}
+++ /dev/null
-package test;
-
-import java.text.MessageFormat;
-import java.util.Hashtable;
-
-import net.sourceforge.phpdt.core.IJavaModelMarker;
-import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
-import net.sourceforge.phpdt.internal.core.builder.PHPBuilder;
-import net.sourceforge.phpdt.internal.ui.util.StringUtil;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.actions.PHPStartApacheAction;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-
-/**
- * The superclass for our PHP parsers.
- * @author Matthieu Casanova
- */
-public abstract class PHPParserSuperclass {
- // strings for external parser call
- private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$
- private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$
- public static final int ERROR = 2;
- public static final int WARNING = 1;
- public static final int INFO = 0;
- public static final int TASK = 3;
- // TODO design error? Analyze why fileToParse must be static ???
- protected static IFile fileToParse;
-
- /**
- * Call the php parse command ( php -l -f <filename> )
- * and create markers according to the external parser output.
- * @param file the file that will be parsed
- */
- public static void phpExternalParse(final IFile file) {
- //IFile file = (IFile) resource;
- // final IPath path = file.getFullPath();
- final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- final String filename = file.getLocation().toString();
-
- final String[] arguments = {filename};
- final MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.EXTERNAL_PARSER_PREF));
- final String command = form.format(arguments);
-
- final String parserResult = PHPStartApacheAction.getParserOutput(command, "External parser: ");
-
- try {
- // parse the buffer to find the errors and warnings
- createMarkers(parserResult, file);
- } catch (CoreException e) {
- }
- }
-
- /**
- * Create markers according to the external parser output.
- * @param output the external parser output
- * @param file the file that was parsed.
- */
- protected static void createMarkers(final String output, final IFile file) throws CoreException {
- // delete all markers
-// file.deleteMarkers(IMarker.PROBLEM, false, 0);
- PHPBuilder.removeProblemsAndTasksFor(file);
-
- int indx = 0;
- int brIndx;
- boolean flag = true;
- while ((brIndx = output.indexOf("<br />", indx)) != -1) {
- // newer php error output (tested with 4.2.3)
- scanLine(output, file, indx, brIndx);
- indx = brIndx + 6;
- flag = false;
- }
- if (flag) {
- while ((brIndx = output.indexOf("<br>", indx)) != -1) {
- // older php error output (tested with 4.2.3)
- scanLine(output, file, indx, brIndx);
- indx = brIndx + 4;
- }
- }
- }
-
- private static void scanLine(final String output, final IFile file, final int indx, final int brIndx) throws CoreException {
- String current;
- // String outLineNumberString; never used
- final StringBuffer lineNumberBuffer = new StringBuffer(10);
- char ch;
- current = output.substring(indx, brIndx);
-
- if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) {
- final int onLine = current.indexOf("on line <b>");
- if (onLine != -1) {
- lineNumberBuffer.delete(0, lineNumberBuffer.length());
- for (int i = onLine; i < current.length(); i++) {
- ch = current.charAt(i);
- if ('0' <= ch && '9' >= ch) {
- lineNumberBuffer.append(ch);
- }
- }
-
- final int lineNumber = Integer.parseInt(lineNumberBuffer.toString());
-
- final Hashtable attributes = new Hashtable();
-
- current = StringUtil.replaceAll(current, "\n", "");
- current = StringUtil.replaceAll(current, "<b>", "");
- current = StringUtil.replaceAll(current, "</b>", "");
- MarkerUtilities.setMessage(attributes, current);
-
- if (current.indexOf(PARSE_ERROR_STRING) != -1)
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- else if (current.indexOf(PARSE_WARNING_STRING) != -1)
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- else
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- MarkerUtilities.setLineNumber(attributes, lineNumber);
-// MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
- MarkerUtilities.createMarker(file, attributes, IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
- }
- }
- }
-
- /**
- * This will parse the file and generate the outline info
- * @param parent the parent object
- * @param s the string that should be parsed
- * @return the outline info
- */
- public abstract PHPOutlineInfo parseInfo(Object parent, String s);
-
- /**
- * This will change the file to parse.
- * @param fileToParse the file that should be parsed
- */
- public abstract void setFileToParse(IFile fileToParse);
-
- /**
- * This will parse the given string
- * @param s the string to parse
- * @throws CoreException an exception that can be launched
- */
- public abstract void parse(String s) throws CoreException;
-
- /**
- * This will set a marker.
- * @param file the file that generated the marker
- * @param message the message
- * @param charStart the starting character
- * @param charEnd the end character
- * @param errorLevel the error level ({@link PHPParserSuperclass#ERROR},
- * {@link PHPParserSuperclass#INFO},{@link PHPParserSuperclass#WARNING}),{@link PHPParserSuperclass#TASK})
- * @throws CoreException an exception throwed by the MarkerUtilities
- */
- public static void setMarker(
- final IFile file,
- final String message,
- final int charStart,
- final int charEnd,
- final int errorLevel)
- throws CoreException {
- if (file != null) {
- final Hashtable attributes = new Hashtable();
- MarkerUtilities.setMessage(attributes, message);
- switch (errorLevel) {
- case ERROR:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- break;
- case WARNING:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- break;
- case INFO:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- break;
- case TASK:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK));
- break;
- }
- MarkerUtilities.setCharStart(attributes, charStart);
- MarkerUtilities.setCharEnd(attributes, charEnd);
-// MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
- MarkerUtilities.createMarker(file, attributes, IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
- }
- }
-
- /**
- * This will set a marker.
- * @param file the file that generated the marker
- * @param message the message
- * @param line the line number
- * @param errorLevel the error level ({@link PHPParserSuperclass#ERROR},
- * {@link PHPParserSuperclass#INFO},{@link PHPParserSuperclass#WARNING})
- * @throws CoreException an exception throwed by the MarkerUtilities
- */
- public static void setMarker(final IFile file,
- final String message,
- final int line,
- final int errorLevel,
- final String location)
- throws CoreException {
- if (file != null) {
-// String markerKind = IMarker.PROBLEM;
- String markerKind = IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER;
- final Hashtable attributes = new Hashtable();
- MarkerUtilities.setMessage(attributes, message);
- switch (errorLevel) {
- case ERROR:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- break;
- case WARNING:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- break;
- case INFO:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- break;
- case TASK:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
-// markerKind = IMarker.TASK;
- markerKind = IJavaModelMarker.TASK_MARKER;
- break;
- }
- attributes.put(IMarker.LOCATION, location);
- MarkerUtilities.setLineNumber(attributes, line);
- MarkerUtilities.createMarker(file, attributes, markerKind);
- }
- }
-
- /**
- * This will set a marker.
- * @param message the message
- * @param charStart the starting character
- * @param charEnd the end character
- * @param errorLevel the error level ({@link PHPParserSuperclass#ERROR},
- * {@link PHPParserSuperclass#INFO},{@link PHPParserSuperclass#WARNING})
- * @throws CoreException an exception throwed by the MarkerUtilities
- */
- public static void setMarker(final String message,
- final int charStart,
- final int charEnd,
- final int errorLevel,
- final String location)
- throws CoreException {
- if (fileToParse != null) {
- setMarker(fileToParse, message, charStart, charEnd, errorLevel, location);
- }
- }
-
- /**
- * This will set a marker.
- * @param file the file that generated the marker
- * @param message the message
- * @param charStart the starting character
- * @param charEnd the end character
- * @param errorLevel the error level ({@link PHPParserSuperclass#ERROR},
- * {@link PHPParserSuperclass#INFO},{@link PHPParserSuperclass#WARNING})
- * @param location the location of the error
- * @throws CoreException an exception throwed by the MarkerUtilities
- */
- public static void setMarker(final IFile file,
- final String message,
- final int charStart,
- final int charEnd,
- final int errorLevel,
- final String location)
- throws CoreException {
- if (file != null) {
- final Hashtable attributes = new Hashtable();
- MarkerUtilities.setMessage(attributes, message);
- switch (errorLevel) {
- case ERROR:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
- break;
- case WARNING:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
- break;
- case INFO:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
- break;
- case TASK:
- attributes.put(IMarker.SEVERITY, new Integer(IMarker.TASK));
- break;
- }
- attributes.put(IMarker.LOCATION, location);
- MarkerUtilities.setCharStart(attributes, charStart);
- MarkerUtilities.setCharEnd(attributes, charEnd);
-// MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
- MarkerUtilities.createMarker(file, attributes, IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
- }
- }
-}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. PHPParserTokenManager.java */
-package test;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-import org.eclipse.jface.preference.IPreferenceStore;
-import java.util.Hashtable;
-import java.util.ArrayList;
-import java.io.StringReader;
-import java.io.*;
-import java.text.MessageFormat;
-import net.sourceforge.phpeclipse.actions.PHPStartApacheAction;
-import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpdt.internal.compiler.ast.*;
-import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren;
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
-import net.sourceforge.phpdt.internal.corext.Assert;
-
-public class PHPParserTokenManager implements PHPParserConstants
-{
- // CommonTokenAction: use the begins/ends fields added to the Jack
- // CharStream class to set corresponding fields in each Token (which was
- // also extended with new fields). By default Jack doesn't supply absolute
- // offsets, just line/column offsets
- void CommonTokenAction(Token t) {
- t.sourceStart = input_stream.getBeginOffset();
- t.sourceEnd = input_stream.getBeginOffset();
- }
- public java.io.PrintStream debugStream = System.out;
- public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
-private final int jjStopAtPos(int pos, int kind)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- return pos + 1;
-}
-private final int jjMoveStringLiteralDfa0_5()
-{
- switch(curChar)
- {
- case 42:
- return jjMoveStringLiteralDfa1_5(0x2000000L);
- case 84:
- case 116:
- return jjMoveStringLiteralDfa1_5(0x400000L);
- default :
- return 1;
- }
-}
-private final int jjMoveStringLiteralDfa1_5(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 1;
- }
- switch(curChar)
- {
- case 47:
- if ((active0 & 0x2000000L) != 0L)
- return jjStopAtPos(1, 25);
- break;
- case 79:
- case 111:
- return jjMoveStringLiteralDfa2_5(active0, 0x400000L);
- default :
- return 2;
- }
- return 2;
-}
-private final int jjMoveStringLiteralDfa2_5(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return 2;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 2;
- }
- switch(curChar)
- {
- case 68:
- case 100:
- return jjMoveStringLiteralDfa3_5(active0, 0x400000L);
- default :
- return 3;
- }
-}
-private final int jjMoveStringLiteralDfa3_5(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return 3;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 3;
- }
- switch(curChar)
- {
- case 79:
- case 111:
- if ((active0 & 0x400000L) != 0L)
- return jjStopAtPos(3, 22);
- break;
- default :
- return 4;
- }
- return 4;
-}
-private final int jjMoveStringLiteralDfa0_8()
-{
- switch(curChar)
- {
- case 125:
- return jjStopAtPos(0, 117);
- default :
- return 1;
- }
-}
-private final int jjStopStringLiteralDfa_9(int pos, long active0, long active1)
-{
- switch (pos)
- {
- default :
- return -1;
- }
-}
-private final int jjStartNfa_9(int pos, long active0, long active1)
-{
- return jjMoveNfa_9(jjStopStringLiteralDfa_9(pos, active0, active1), pos + 1);
-}
-private final int jjStartNfaWithStates_9(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_9(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_9()
-{
- switch(curChar)
- {
- case 125:
- return jjStopAtPos(0, 119);
- default :
- return jjMoveNfa_9(0, 0);
- }
-}
-private final void jjCheckNAdd(int state)
-{
- if (jjrounds[state] != jjround)
- {
- jjstateSet[jjnewStateCnt++] = state;
- jjrounds[state] = jjround;
- }
-}
-private final void jjAddStates(int start, int end)
-{
- do {
- jjstateSet[jjnewStateCnt++] = jjnextStates[start];
- } while (start++ != end);
-}
-private final void jjCheckNAddTwoStates(int state1, int state2)
-{
- jjCheckNAdd(state1);
- jjCheckNAdd(state2);
-}
-private final void jjCheckNAddStates(int start, int end)
-{
- do {
- jjCheckNAdd(jjnextStates[start]);
- } while (start++ != end);
-}
-private final void jjCheckNAddStates(int start)
-{
- jjCheckNAdd(jjnextStates[start]);
- jjCheckNAdd(jjnextStates[start + 1]);
-}
-static final long[] jjbitVec0 = {
- 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-private final int jjMoveNfa_9(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 1;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- kind = 120;
- jjstateSet[jjnewStateCnt++] = 0;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if ((0xdfffffffffffffffL & l) == 0L)
- break;
- kind = 120;
- jjstateSet[jjnewStateCnt++] = 0;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 120)
- kind = 120;
- jjstateSet[jjnewStateCnt++] = 0;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-private final int jjMoveStringLiteralDfa0_0()
-{
- switch(curChar)
- {
- case 60:
- return jjMoveStringLiteralDfa1_0(0xeL);
- case 84:
- case 116:
- return jjMoveStringLiteralDfa1_0(0x800000L);
- default :
- return 1;
- }
-}
-private final int jjMoveStringLiteralDfa1_0(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 1;
- }
- switch(curChar)
- {
- case 63:
- if ((active0 & 0x2L) != 0L)
- {
- jjmatchedKind = 1;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_0(active0, 0xcL);
- case 79:
- case 111:
- return jjMoveStringLiteralDfa2_0(active0, 0x800000L);
- default :
- return 2;
- }
-}
-private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return 2;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 2;
- }
- switch(curChar)
- {
- case 61:
- if ((active0 & 0x8L) != 0L)
- return jjStopAtPos(2, 3);
- break;
- case 68:
- case 100:
- return jjMoveStringLiteralDfa3_0(active0, 0x800000L);
- case 80:
- case 112:
- return jjMoveStringLiteralDfa3_0(active0, 0x4L);
- default :
- return 3;
- }
- return 3;
-}
-private final int jjMoveStringLiteralDfa3_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return 3;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 3;
- }
- switch(curChar)
- {
- case 72:
- case 104:
- return jjMoveStringLiteralDfa4_0(active0, 0x4L);
- case 79:
- case 111:
- if ((active0 & 0x800000L) != 0L)
- return jjStopAtPos(3, 23);
- break;
- default :
- return 4;
- }
- return 4;
-}
-private final int jjMoveStringLiteralDfa4_0(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return 4;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 4;
- }
- switch(curChar)
- {
- case 80:
- case 112:
- if ((active0 & 0x4L) != 0L)
- return jjStopAtPos(4, 2);
- break;
- default :
- return 5;
- }
- return 5;
-}
-private final int jjMoveStringLiteralDfa0_4()
-{
- switch(curChar)
- {
- case 42:
- return jjMoveStringLiteralDfa1_4(0x1000000L);
- case 84:
- case 116:
- return jjMoveStringLiteralDfa1_4(0x400000L);
- default :
- return 1;
- }
-}
-private final int jjMoveStringLiteralDfa1_4(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 1;
- }
- switch(curChar)
- {
- case 47:
- if ((active0 & 0x1000000L) != 0L)
- return jjStopAtPos(1, 24);
- break;
- case 79:
- case 111:
- return jjMoveStringLiteralDfa2_4(active0, 0x400000L);
- default :
- return 2;
- }
- return 2;
-}
-private final int jjMoveStringLiteralDfa2_4(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return 2;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 2;
- }
- switch(curChar)
- {
- case 68:
- case 100:
- return jjMoveStringLiteralDfa3_4(active0, 0x400000L);
- default :
- return 3;
- }
-}
-private final int jjMoveStringLiteralDfa3_4(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return 3;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- return 3;
- }
- switch(curChar)
- {
- case 79:
- case 111:
- if ((active0 & 0x400000L) != 0L)
- return jjStopAtPos(3, 22);
- break;
- default :
- return 4;
- }
- return 4;
-}
-private final int jjStopStringLiteralDfa_3(int pos, long active0, long active1, long active2)
-{
- switch (pos)
- {
- case 0:
- if ((active1 & 0x3000000000L) != 0L)
- {
- jjmatchedKind = 124;
- return 1;
- }
- return -1;
- case 1:
- if ((active1 & 0x1000000000L) != 0L)
- return 1;
- if ((active1 & 0x2000000000L) != 0L)
- {
- if (jjmatchedPos != 1)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 1;
- }
- return 1;
- }
- return -1;
- default :
- return -1;
- }
-}
-private final int jjStartNfa_3(int pos, long active0, long active1, long active2)
-{
- return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0, active1, active2), pos + 1);
-}
-private final int jjStartNfaWithStates_3(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_3(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_3()
-{
- switch(curChar)
- {
- case 9:
- return jjStopAtPos(0, 12);
- case 10:
- return jjStopAtPos(0, 13);
- case 12:
- return jjStopAtPos(0, 15);
- case 13:
- return jjStopAtPos(0, 14);
- case 32:
- return jjStopAtPos(0, 11);
- case 33:
- jjmatchedKind = 81;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x0L, 0x28000L);
- case 36:
- return jjStopAtPos(0, 123);
- case 37:
- jjmatchedKind = 96;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x0L, 0x10000000L);
- case 38:
- jjmatchedKind = 93;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x400000L, 0x1000000L);
- case 40:
- return jjStopAtPos(0, 129);
- case 41:
- return jjStopAtPos(0, 130);
- case 42:
- jjmatchedKind = 91;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x0L, 0x400000L);
- case 43:
- jjmatchedKind = 89;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x800000L, 0x100000L);
- case 44:
- return jjStopAtPos(0, 136);
- case 45:
- jjmatchedKind = 90;
- return jjMoveStringLiteralDfa1_3(0x200000000000L, 0x1000000L, 0x200000L);
- case 46:
- jjmatchedKind = 137;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x0L, 0x8000000L);
- case 47:
- jjmatchedKind = 92;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x0L, 0x800000L);
- case 58:
- jjmatchedKind = 84;
- return jjMoveStringLiteralDfa1_3(0x400000000000L, 0x0L, 0x0L);
- case 59:
- return jjStopAtPos(0, 135);
- case 60:
- jjmatchedKind = 139;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x200000000L, 0x40012000L);
- case 61:
- jjmatchedKind = 147;
- return jjMoveStringLiteralDfa1_3(0x800000000000L, 0x0L, 0x41000L);
- case 62:
- jjmatchedKind = 138;
- return jjMoveStringLiteralDfa1_3(0x0L, 0xc00000000L, 0x80004000L);
- case 63:
- jjmatchedKind = 83;
- return jjMoveStringLiteralDfa1_3(0x10L, 0x0L, 0x0L);
- case 64:
- return jjStopAtPos(0, 80);
- case 91:
- return jjStopAtPos(0, 133);
- case 93:
- return jjStopAtPos(0, 134);
- case 94:
- jjmatchedKind = 95;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x0L, 0x4000000L);
- case 65:
- case 97:
- return jjMoveStringLiteralDfa1_3(0x0L, 0x2000000000L, 0x0L);
- case 79:
- case 111:
- return jjMoveStringLiteralDfa1_3(0x0L, 0x1000000000L, 0x0L);
- case 123:
- return jjStopAtPos(0, 131);
- case 124:
- jjmatchedKind = 94;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x200000L, 0x2000000L);
- case 125:
- return jjStopAtPos(0, 132);
- case 126:
- jjmatchedKind = 82;
- return jjMoveStringLiteralDfa1_3(0x0L, 0x0L, 0x20000000L);
- default :
- return jjMoveNfa_3(0, 0);
- }
-}
-private final int jjMoveStringLiteralDfa1_3(long active0, long active1, long active2)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_3(0, active0, active1, active2);
- return 1;
- }
- switch(curChar)
- {
- case 38:
- if ((active1 & 0x400000L) != 0L)
- return jjStopAtPos(1, 86);
- break;
- case 43:
- if ((active1 & 0x800000L) != 0L)
- return jjStopAtPos(1, 87);
- break;
- case 45:
- if ((active1 & 0x1000000L) != 0L)
- return jjStopAtPos(1, 88);
- break;
- case 58:
- if ((active0 & 0x400000000000L) != 0L)
- return jjStopAtPos(1, 46);
- break;
- case 60:
- if ((active1 & 0x200000000L) != 0L)
- {
- jjmatchedKind = 97;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_3(active0, 0L, active1, 0L, active2, 0x40000000L);
- case 61:
- if ((active2 & 0x1000L) != 0L)
- {
- jjmatchedKind = 140;
- jjmatchedPos = 1;
- }
- else if ((active2 & 0x2000L) != 0L)
- return jjStopAtPos(1, 141);
- else if ((active2 & 0x4000L) != 0L)
- return jjStopAtPos(1, 142);
- else if ((active2 & 0x8000L) != 0L)
- {
- jjmatchedKind = 143;
- jjmatchedPos = 1;
- }
- else if ((active2 & 0x100000L) != 0L)
- return jjStopAtPos(1, 148);
- else if ((active2 & 0x200000L) != 0L)
- return jjStopAtPos(1, 149);
- else if ((active2 & 0x400000L) != 0L)
- return jjStopAtPos(1, 150);
- else if ((active2 & 0x800000L) != 0L)
- return jjStopAtPos(1, 151);
- else if ((active2 & 0x1000000L) != 0L)
- return jjStopAtPos(1, 152);
- else if ((active2 & 0x2000000L) != 0L)
- return jjStopAtPos(1, 153);
- else if ((active2 & 0x4000000L) != 0L)
- return jjStopAtPos(1, 154);
- else if ((active2 & 0x8000000L) != 0L)
- return jjStopAtPos(1, 155);
- else if ((active2 & 0x10000000L) != 0L)
- return jjStopAtPos(1, 156);
- else if ((active2 & 0x20000000L) != 0L)
- return jjStopAtPos(1, 157);
- return jjMoveStringLiteralDfa2_3(active0, 0L, active1, 0L, active2, 0x60000L);
- case 62:
- if ((active0 & 0x10L) != 0L)
- return jjStopAtPos(1, 4);
- else if ((active0 & 0x200000000000L) != 0L)
- return jjStopAtPos(1, 45);
- else if ((active0 & 0x800000000000L) != 0L)
- return jjStopAtPos(1, 47);
- else if ((active1 & 0x400000000L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 1;
- }
- else if ((active2 & 0x10000L) != 0L)
- return jjStopAtPos(1, 144);
- return jjMoveStringLiteralDfa2_3(active0, 0L, active1, 0x800000000L, active2, 0x80000000L);
- case 78:
- case 110:
- return jjMoveStringLiteralDfa2_3(active0, 0L, active1, 0x2000000000L, active2, 0L);
- case 82:
- case 114:
- if ((active1 & 0x1000000000L) != 0L)
- return jjStartNfaWithStates_3(1, 100, 1);
- break;
- case 124:
- if ((active1 & 0x200000L) != 0L)
- return jjStopAtPos(1, 85);
- break;
- default :
- break;
- }
- return jjStartNfa_3(0, active0, active1, active2);
-}
-private final int jjMoveStringLiteralDfa2_3(long old0, long active0, long old1, long active1, long old2, long active2)
-{
- if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L)
- return jjStartNfa_3(0, old0, old1, old2);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_3(1, 0L, active1, active2);
- return 2;
- }
- switch(curChar)
- {
- case 61:
- if ((active2 & 0x20000L) != 0L)
- return jjStopAtPos(2, 145);
- else if ((active2 & 0x40000L) != 0L)
- return jjStopAtPos(2, 146);
- else if ((active2 & 0x40000000L) != 0L)
- return jjStopAtPos(2, 158);
- else if ((active2 & 0x80000000L) != 0L)
- return jjStopAtPos(2, 159);
- break;
- case 62:
- if ((active1 & 0x800000000L) != 0L)
- return jjStopAtPos(2, 99);
- break;
- case 68:
- case 100:
- if ((active1 & 0x2000000000L) != 0L)
- return jjStartNfaWithStates_3(2, 101, 1);
- break;
- default :
- break;
- }
- return jjStartNfa_3(1, 0L, active1, active2);
-}
-private final int jjMoveNfa_3(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 2;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 1:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- kind = 124;
- jjstateSet[jjnewStateCnt++] = 1;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- case 1:
- if ((0x87fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 124)
- kind = 124;
- jjCheckNAdd(1);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- case 1:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 124)
- kind = 124;
- jjCheckNAdd(1);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 2 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-private final int jjStopStringLiteralDfa_6(int pos, long active0, long active1)
-{
- switch (pos)
- {
- default :
- return -1;
- }
-}
-private final int jjStartNfa_6(int pos, long active0, long active1)
-{
- return jjMoveNfa_6(jjStopStringLiteralDfa_6(pos, active0, active1), pos + 1);
-}
-private final int jjStartNfaWithStates_6(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_6(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_6()
-{
- switch(curChar)
- {
- case 34:
- return jjStopAtPos(0, 114);
- case 36:
- return jjStopAtPos(0, 113);
- case 123:
- return jjStopAtPos(0, 116);
- default :
- return jjMoveNfa_6(0, 0);
- }
-}
-private final int jjMoveNfa_6(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 2;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 1:
- kind = 111;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 1;
- break;
- case 1:
- if (kind > 111)
- kind = 111;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 1:
- if ((jjbitVec0[i2] & l2) != 0L && kind > 111)
- kind = 111;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 2 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-private final int jjStopStringLiteralDfa_2(int pos, long active0)
-{
- switch (pos)
- {
- default :
- return -1;
- }
-}
-private final int jjStartNfa_2(int pos, long active0)
-{
- return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1);
-}
-private final int jjStartNfaWithStates_2(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_2(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_2()
-{
- switch(curChar)
- {
- case 63:
- return jjMoveStringLiteralDfa1_2(0x10L);
- case 84:
- case 116:
- return jjMoveStringLiteralDfa1_2(0x400000L);
- default :
- return jjMoveNfa_2(0, 0);
- }
-}
-private final int jjMoveStringLiteralDfa1_2(long active0)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_2(0, active0);
- return 1;
- }
- switch(curChar)
- {
- case 62:
- if ((active0 & 0x10L) != 0L)
- return jjStopAtPos(1, 4);
- break;
- case 79:
- case 111:
- return jjMoveStringLiteralDfa2_2(active0, 0x400000L);
- default :
- break;
- }
- return jjStartNfa_2(0, active0);
-}
-private final int jjMoveStringLiteralDfa2_2(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_2(0, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_2(1, active0);
- return 2;
- }
- switch(curChar)
- {
- case 68:
- case 100:
- return jjMoveStringLiteralDfa3_2(active0, 0x400000L);
- default :
- break;
- }
- return jjStartNfa_2(1, active0);
-}
-private final int jjMoveStringLiteralDfa3_2(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_2(1, old0);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_2(2, active0);
- return 3;
- }
- switch(curChar)
- {
- case 79:
- case 111:
- if ((active0 & 0x400000L) != 0L)
- return jjStopAtPos(3, 22);
- break;
- default :
- break;
- }
- return jjStartNfa_2(2, active0);
-}
-private final int jjMoveNfa_2(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 3;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if ((0x2400L & l) != 0L)
- {
- if (kind > 20)
- kind = 20;
- }
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 1;
- break;
- case 1:
- if (curChar == 10 && kind > 20)
- kind = 20;
- break;
- case 2:
- if (curChar == 13)
- jjstateSet[jjnewStateCnt++] = 1;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-private final int jjStopStringLiteralDfa_1(int pos, long active0, long active1, long active2)
-{
- switch (pos)
- {
- case 0:
- if ((active0 & 0xffff1ffff8000000L) != 0L || (active1 & 0x300000ffffL) != 0L)
- {
- jjmatchedKind = 124;
- return 14;
- }
- if ((active0 & 0x90000L) != 0L || (active1 & 0x10000000L) != 0L || (active2 & 0x800000L) != 0L)
- return 2;
- if ((active2 & 0x8000200L) != 0L)
- return 8;
- return -1;
- case 1:
- if ((active0 & 0x80000L) != 0L)
- return 0;
- if ((active0 & 0x10000040000000L) != 0L || (active1 & 0x1000001040L) != 0L)
- return 14;
- if ((active0 & 0xffef1fffb8000000L) != 0L || (active1 & 0x200000efbfL) != 0L)
- {
- if (jjmatchedPos != 1)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 1;
- }
- return 14;
- }
- return -1;
- case 2:
- if ((active0 & 0x140000020000000L) != 0L || (active1 & 0x200000c020L) != 0L)
- return 14;
- if ((active0 & 0xfeaf1fff98000000L) != 0L || (active1 & 0x3f9fL) != 0L)
- {
- if (jjmatchedPos != 2)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 2;
- }
- return 14;
- }
- return -1;
- case 3:
- if ((active0 & 0x9c2e1fd618000000L) != 0L || (active1 & 0xb1bfL) != 0L)
- {
- if (jjmatchedPos != 3)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 3;
- }
- return 14;
- }
- if ((active0 & 0x6281002980000000L) != 0L || (active1 & 0xe00L) != 0L)
- return 14;
- return -1;
- case 4:
- if ((active0 & 0x8802001608000000L) != 0L || (active1 & 0x2009L) != 0L)
- return 14;
- if ((active0 & 0x142c1fc090000000L) != 0L || (active1 & 0x95b6L) != 0L)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 4;
- return 14;
- }
- return -1;
- case 5:
- if ((active0 & 0x14001c0080000000L) != 0L || (active1 & 0x1190L) != 0L)
- return 14;
- if ((active0 & 0x2c03c010000000L) != 0L || (active1 & 0x8426L) != 0L)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 5;
- return 14;
- }
- return -1;
- case 6:
- if ((active0 & 0x2803c000000000L) != 0L || (active1 & 0x8420L) != 0L)
- return 14;
- if ((active0 & 0x4000010000000L) != 0L || (active1 & 0x6L) != 0L)
- {
- if (jjmatchedPos != 6)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 6;
- }
- return 14;
- }
- return -1;
- case 7:
- if ((active0 & 0x30000000000L) != 0L || (active1 & 0x4L) != 0L)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 7;
- return 14;
- }
- if ((active0 & 0x4000010000000L) != 0L || (active1 & 0x2L) != 0L)
- return 14;
- return -1;
- case 8:
- if ((active1 & 0x4L) != 0L)
- return 14;
- if ((active0 & 0x30000000000L) != 0L)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 8;
- return 14;
- }
- return -1;
- case 9:
- if ((active0 & 0x30000000000L) != 0L)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 9;
- return 14;
- }
- return -1;
- case 10:
- if ((active0 & 0x30000000000L) != 0L)
- {
- jjmatchedKind = 124;
- jjmatchedPos = 10;
- return 14;
- }
- return -1;
- default :
- return -1;
- }
-}
-private final int jjStartNfa_1(int pos, long active0, long active1, long active2)
-{
- return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0, active1, active2), pos + 1);
-}
-private final int jjStartNfaWithStates_1(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_1(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_1()
-{
- switch(curChar)
- {
- case 33:
- jjmatchedKind = 81;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x0L, 0x28000L);
- case 34:
- return jjStopAtPos(0, 112);
- case 35:
- return jjStopAtPos(0, 17);
- case 36:
- return jjStopAtPos(0, 123);
- case 37:
- jjmatchedKind = 96;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x0L, 0x10000000L);
- case 38:
- jjmatchedKind = 93;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x400000L, 0x1000000L);
- case 40:
- return jjStopAtPos(0, 129);
- case 41:
- return jjStopAtPos(0, 130);
- case 42:
- jjmatchedKind = 91;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x0L, 0x400000L);
- case 43:
- jjmatchedKind = 89;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x800000L, 0x100000L);
- case 44:
- return jjStopAtPos(0, 136);
- case 45:
- jjmatchedKind = 90;
- return jjMoveStringLiteralDfa1_1(0x200000000000L, 0x1000000L, 0x200000L);
- case 46:
- jjmatchedKind = 137;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x0L, 0x8000000L);
- case 47:
- jjmatchedKind = 92;
- return jjMoveStringLiteralDfa1_1(0x90000L, 0x0L, 0x800000L);
- case 58:
- jjmatchedKind = 84;
- return jjMoveStringLiteralDfa1_1(0x400000000000L, 0x0L, 0x0L);
- case 59:
- return jjStopAtPos(0, 135);
- case 60:
- jjmatchedKind = 139;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x200000000L, 0x40012000L);
- case 61:
- jjmatchedKind = 147;
- return jjMoveStringLiteralDfa1_1(0x800000000000L, 0x0L, 0x41000L);
- case 62:
- jjmatchedKind = 138;
- return jjMoveStringLiteralDfa1_1(0x0L, 0xc00000000L, 0x80004000L);
- case 63:
- jjmatchedKind = 83;
- return jjMoveStringLiteralDfa1_1(0x10L, 0x0L, 0x0L);
- case 64:
- return jjStopAtPos(0, 80);
- case 91:
- return jjStopAtPos(0, 133);
- case 93:
- return jjStopAtPos(0, 134);
- case 94:
- jjmatchedKind = 95;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x0L, 0x4000000L);
- case 65:
- case 97:
- return jjMoveStringLiteralDfa1_1(0x200000000L, 0x2000000040L, 0x0L);
- case 66:
- case 98:
- return jjMoveStringLiteralDfa1_1(0x400000000L, 0x600L, 0x0L);
- case 67:
- case 99:
- return jjMoveStringLiteralDfa1_1(0x7000008000000L, 0x0L, 0x0L);
- case 68:
- case 100:
- return jjMoveStringLiteralDfa1_1(0x18080000000000L, 0x1000L, 0x0L);
- case 69:
- case 101:
- return jjMoveStringLiteralDfa1_1(0x20002180000000L, 0x1eL, 0x0L);
- case 70:
- case 102:
- return jjMoveStringLiteralDfa1_1(0x8040000010000000L, 0x2020L, 0x0L);
- case 71:
- case 103:
- return jjMoveStringLiteralDfa1_1(0x80040000000000L, 0x0L, 0x0L);
- case 73:
- case 105:
- return jjMoveStringLiteralDfa1_1(0x14040000000L, 0xc000L, 0x0L);
- case 76:
- case 108:
- return jjMoveStringLiteralDfa1_1(0x800000000L, 0x0L, 0x0L);
- case 78:
- case 110:
- return jjMoveStringLiteralDfa1_1(0x300000000000000L, 0x0L, 0x0L);
- case 79:
- case 111:
- return jjMoveStringLiteralDfa1_1(0x0L, 0x1000000100L, 0x0L);
- case 80:
- case 112:
- return jjMoveStringLiteralDfa1_1(0x1000000000L, 0x0L, 0x0L);
- case 82:
- case 114:
- return jjMoveStringLiteralDfa1_1(0x400028000000000L, 0x800L, 0x0L);
- case 83:
- case 115:
- return jjMoveStringLiteralDfa1_1(0x1800100000000000L, 0x80L, 0x0L);
- case 84:
- case 116:
- return jjMoveStringLiteralDfa1_1(0x6000000000000000L, 0x0L, 0x0L);
- case 86:
- case 118:
- return jjMoveStringLiteralDfa1_1(0x20000000L, 0x0L, 0x0L);
- case 87:
- case 119:
- return jjMoveStringLiteralDfa1_1(0x0L, 0x1L, 0x0L);
- case 123:
- return jjStopAtPos(0, 131);
- case 124:
- jjmatchedKind = 94;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x200000L, 0x2000000L);
- case 125:
- return jjStopAtPos(0, 132);
- case 126:
- jjmatchedKind = 82;
- return jjMoveStringLiteralDfa1_1(0x0L, 0x0L, 0x20000000L);
- default :
- return jjMoveNfa_1(3, 0);
- }
-}
-private final int jjMoveStringLiteralDfa1_1(long active0, long active1, long active2)
-{
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(0, active0, active1, active2);
- return 1;
- }
- switch(curChar)
- {
- case 38:
- if ((active1 & 0x400000L) != 0L)
- return jjStopAtPos(1, 86);
- break;
- case 42:
- if ((active0 & 0x80000L) != 0L)
- return jjStartNfaWithStates_1(1, 19, 0);
- break;
- case 43:
- if ((active1 & 0x800000L) != 0L)
- return jjStopAtPos(1, 87);
- break;
- case 45:
- if ((active1 & 0x1000000L) != 0L)
- return jjStopAtPos(1, 88);
- break;
- case 47:
- if ((active0 & 0x10000L) != 0L)
- return jjStopAtPos(1, 16);
- break;
- case 58:
- if ((active0 & 0x400000000000L) != 0L)
- return jjStopAtPos(1, 46);
- break;
- case 60:
- if ((active1 & 0x200000000L) != 0L)
- {
- jjmatchedKind = 97;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0L, active2, 0x40000000L);
- case 61:
- if ((active2 & 0x1000L) != 0L)
- {
- jjmatchedKind = 140;
- jjmatchedPos = 1;
- }
- else if ((active2 & 0x2000L) != 0L)
- return jjStopAtPos(1, 141);
- else if ((active2 & 0x4000L) != 0L)
- return jjStopAtPos(1, 142);
- else if ((active2 & 0x8000L) != 0L)
- {
- jjmatchedKind = 143;
- jjmatchedPos = 1;
- }
- else if ((active2 & 0x100000L) != 0L)
- return jjStopAtPos(1, 148);
- else if ((active2 & 0x200000L) != 0L)
- return jjStopAtPos(1, 149);
- else if ((active2 & 0x400000L) != 0L)
- return jjStopAtPos(1, 150);
- else if ((active2 & 0x800000L) != 0L)
- return jjStopAtPos(1, 151);
- else if ((active2 & 0x1000000L) != 0L)
- return jjStopAtPos(1, 152);
- else if ((active2 & 0x2000000L) != 0L)
- return jjStopAtPos(1, 153);
- else if ((active2 & 0x4000000L) != 0L)
- return jjStopAtPos(1, 154);
- else if ((active2 & 0x8000000L) != 0L)
- return jjStopAtPos(1, 155);
- else if ((active2 & 0x10000000L) != 0L)
- return jjStopAtPos(1, 156);
- else if ((active2 & 0x20000000L) != 0L)
- return jjStopAtPos(1, 157);
- return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0L, active2, 0x60000L);
- case 62:
- if ((active0 & 0x10L) != 0L)
- return jjStopAtPos(1, 4);
- else if ((active0 & 0x200000000000L) != 0L)
- return jjStopAtPos(1, 45);
- else if ((active0 & 0x800000000000L) != 0L)
- return jjStopAtPos(1, 47);
- else if ((active1 & 0x400000000L) != 0L)
- {
- jjmatchedKind = 98;
- jjmatchedPos = 1;
- }
- else if ((active2 & 0x10000L) != 0L)
- return jjStopAtPos(1, 144);
- return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0x800000000L, active2, 0x80000000L);
- case 65:
- case 97:
- return jjMoveStringLiteralDfa2_1(active0, 0x8001000020000000L, active1, 0L, active2, 0L);
- case 66:
- case 98:
- return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0x100L, active2, 0L);
- case 67:
- case 99:
- return jjMoveStringLiteralDfa2_1(active0, 0x2000000000L, active1, 0L, active2, 0L);
- case 69:
- case 101:
- return jjMoveStringLiteralDfa2_1(active0, 0x5080a8000000000L, active1, 0x800L, active2, 0L);
- case 70:
- case 102:
- if ((active0 & 0x40000000L) != 0L)
- return jjStartNfaWithStates_1(1, 30, 14);
- break;
- case 72:
- case 104:
- return jjMoveStringLiteralDfa2_1(active0, 0x2000000000000000L, active1, 0x1L, active2, 0L);
- case 73:
- case 105:
- return jjMoveStringLiteralDfa2_1(active0, 0x800000000L, active1, 0L, active2, 0L);
- case 76:
- case 108:
- return jjMoveStringLiteralDfa2_1(active0, 0x40188000000L, active1, 0x2000L, active2, 0L);
- case 78:
- case 110:
- return jjMoveStringLiteralDfa2_1(active0, 0x14000000000L, active1, 0x200000c01eL, active2, 0L);
- case 79:
- case 111:
- if ((active0 & 0x10000000000000L) != 0L)
- {
- jjmatchedKind = 52;
- jjmatchedPos = 1;
- }
- return jjMoveStringLiteralDfa2_1(active0, 0xc6000000000000L, active1, 0x1620L, active2, 0L);
- case 82:
- case 114:
- if ((active1 & 0x1000000000L) != 0L)
- return jjStartNfaWithStates_1(1, 100, 14);
- return jjMoveStringLiteralDfa2_1(active0, 0x4000001600000000L, active1, 0L, active2, 0L);
- case 83:
- case 115:
- if ((active1 & 0x40L) != 0L)
- return jjStartNfaWithStates_1(1, 70, 14);
- break;
- case 84:
- case 116:
- return jjMoveStringLiteralDfa2_1(active0, 0x100000000000L, active1, 0x80L, active2, 0L);
- case 85:
- case 117:
- return jjMoveStringLiteralDfa2_1(active0, 0xa00000010000000L, active1, 0L, active2, 0L);
- case 87:
- case 119:
- return jjMoveStringLiteralDfa2_1(active0, 0x1000000000000000L, active1, 0L, active2, 0L);
- case 88:
- case 120:
- return jjMoveStringLiteralDfa2_1(active0, 0x20000000000000L, active1, 0L, active2, 0L);
- case 124:
- if ((active1 & 0x200000L) != 0L)
- return jjStopAtPos(1, 85);
- break;
- default :
- break;
- }
- return jjStartNfa_1(0, active0, active1, active2);
-}
-private final int jjMoveStringLiteralDfa2_1(long old0, long active0, long old1, long active1, long old2, long active2)
-{
- if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L)
- return jjStartNfa_1(0, old0, old1, old2);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(1, active0, active1, active2);
- return 2;
- }
- switch(curChar)
- {
- case 61:
- if ((active2 & 0x20000L) != 0L)
- return jjStopAtPos(2, 145);
- else if ((active2 & 0x40000L) != 0L)
- return jjStopAtPos(2, 146);
- else if ((active2 & 0x40000000L) != 0L)
- return jjStopAtPos(2, 158);
- else if ((active2 & 0x80000000L) != 0L)
- return jjStopAtPos(2, 159);
- break;
- case 62:
- if ((active1 & 0x800000000L) != 0L)
- return jjStopAtPos(2, 99);
- break;
- case 65:
- case 97:
- return jjMoveStringLiteralDfa3_1(active0, 0x100008000000L, active1, 0x800L, active2, 0L);
- case 67:
- case 99:
- return jjMoveStringLiteralDfa3_1(active0, 0x14000000000L, active1, 0L, active2, 0L);
- case 68:
- case 100:
- if ((active1 & 0x2000000000L) != 0L)
- return jjStartNfaWithStates_1(2, 101, 14);
- return jjMoveStringLiteralDfa3_1(active0, 0L, active1, 0x1eL, active2, 0L);
- case 69:
- case 101:
- return jjMoveStringLiteralDfa3_1(active0, 0x400000000L, active1, 0L, active2, 0L);
- case 70:
- case 102:
- return jjMoveStringLiteralDfa3_1(active0, 0x8080000000000L, active1, 0L, active2, 0L);
- case 72:
- case 104:
- return jjMoveStringLiteralDfa3_1(active0, 0x2000000000L, active1, 0L, active2, 0L);
- case 73:
- case 105:
- return jjMoveStringLiteralDfa3_1(active0, 0x3000001000000000L, active1, 0x1L, active2, 0L);
- case 74:
- case 106:
- return jjMoveStringLiteralDfa3_1(active0, 0L, active1, 0x100L, active2, 0L);
- case 76:
- case 108:
- return jjMoveStringLiteralDfa3_1(active0, 0x8200000000000000L, active1, 0L, active2, 0L);
- case 78:
- case 110:
- return jjMoveStringLiteralDfa3_1(active0, 0x6000010000000L, active1, 0L, active2, 0L);
- case 79:
- case 111:
- return jjMoveStringLiteralDfa3_1(active0, 0x40000000000L, active1, 0x2600L, active2, 0L);
- case 80:
- case 112:
- return jjMoveStringLiteralDfa3_1(active0, 0x800000000000000L, active1, 0L, active2, 0L);
- case 81:
- case 113:
- return jjMoveStringLiteralDfa3_1(active0, 0x28000000000L, active1, 0L, active2, 0L);
- case 82:
- case 114:
- if ((active0 & 0x20000000L) != 0L)
- return jjStartNfaWithStates_1(2, 29, 14);
- else if ((active0 & 0x40000000000000L) != 0L)
- {
- jjmatchedKind = 54;
- jjmatchedPos = 2;
- }
- return jjMoveStringLiteralDfa3_1(active0, 0x200000000L, active1, 0xa0L, active2, 0L);
- case 83:
- case 115:
- return jjMoveStringLiteralDfa3_1(active0, 0x1000980000000L, active1, 0L, active2, 0L);
- case 84:
- case 116:
- if ((active1 & 0x4000L) != 0L)
- {
- jjmatchedKind = 78;
- jjmatchedPos = 2;
- }
- return jjMoveStringLiteralDfa3_1(active0, 0x4a0000000000000L, active1, 0x8000L, active2, 0L);
- case 85:
- case 117:
- return jjMoveStringLiteralDfa3_1(active0, 0x4000000000000000L, active1, 0x1000L, active2, 0L);
- case 87:
- case 119:
- if ((active0 & 0x100000000000000L) != 0L)
- return jjStartNfaWithStates_1(2, 56, 14);
- break;
- default :
- break;
- }
- return jjStartNfa_1(1, active0, active1, active2);
-}
-private final int jjMoveStringLiteralDfa3_1(long old0, long active0, long old1, long active1, long old2, long active2)
-{
- if (((active0 &= old0) | (active1 &= old1) | (active2 &= old2)) == 0L)
- return jjStartNfa_1(1, old0, old1, old2);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(2, active0, active1, 0L);
- return 3;
- }
- switch(curChar)
- {
- case 65:
- case 97:
- return jjMoveStringLiteralDfa4_1(active0, 0x8000600000000L, active1, 0x2000L);
- case 66:
- case 98:
- return jjMoveStringLiteralDfa4_1(active0, 0x40000000000L, active1, 0x1000L);
- case 67:
- case 99:
- return jjMoveStringLiteralDfa4_1(active0, 0x10000000L, active1, 0L);
- case 69:
- case 101:
- if ((active0 & 0x100000000L) != 0L)
- {
- jjmatchedKind = 32;
- jjmatchedPos = 3;
- }
- else if ((active0 & 0x1000000000000L) != 0L)
- return jjStartNfaWithStates_1(3, 48, 14);
- else if ((active0 & 0x4000000000000000L) != 0L)
- return jjStartNfaWithStates_1(3, 62, 14);
- return jjMoveStringLiteralDfa4_1(active0, 0x820000080000000L, active1, 0x8120L);
- case 70:
- case 102:
- return jjMoveStringLiteralDfa4_1(active0, 0L, active1, 0x10L);
- case 73:
- case 105:
- return jjMoveStringLiteralDfa4_1(active0, 0x80000000000L, active1, 0x88L);
- case 76:
- case 108:
- if ((active0 & 0x200000000000000L) != 0L)
- return jjStartNfaWithStates_1(3, 57, 14);
- else if ((active1 & 0x200L) != 0L)
- {
- jjmatchedKind = 73;
- jjmatchedPos = 3;
- }
- else if ((active1 & 0x800L) != 0L)
- return jjStartNfaWithStates_1(3, 75, 14);
- return jjMoveStringLiteralDfa4_1(active0, 0x14000000000L, active1, 0x401L);
- case 78:
- case 110:
- return jjMoveStringLiteralDfa4_1(active0, 0x1000000000L, active1, 0L);
- case 79:
- case 111:
- if ((active0 & 0x2000000000L) != 0L)
- return jjStartNfaWithStates_1(3, 37, 14);
- else if ((active0 & 0x80000000000000L) != 0L)
- return jjStartNfaWithStates_1(3, 55, 14);
- break;
- case 83:
- case 115:
- if ((active0 & 0x2000000000000000L) != 0L)
- return jjStartNfaWithStates_1(3, 61, 14);
- return jjMoveStringLiteralDfa4_1(active0, 0x8002000008000000L, active1, 0x4L);
- case 84:
- case 116:
- if ((active0 & 0x800000000L) != 0L)
- return jjStartNfaWithStates_1(3, 35, 14);
- return jjMoveStringLiteralDfa4_1(active0, 0x1004100000000000L, active1, 0L);
- case 85:
- case 117:
- return jjMoveStringLiteralDfa4_1(active0, 0x400028000000000L, active1, 0L);
- case 87:
- case 119:
- return jjMoveStringLiteralDfa4_1(active0, 0L, active1, 0x2L);
- default :
- break;
- }
- return jjStartNfa_1(2, active0, active1, 0L);
-}
-private final int jjMoveStringLiteralDfa4_1(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_1(2, old0, old1, 0L);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(3, active0, active1, 0L);
- return 4;
- }
- switch(curChar)
- {
- case 65:
- case 97:
- return jjMoveStringLiteralDfa5_1(active0, 0x40000000000L, active1, 0x20L);
- case 67:
- case 99:
- return jjMoveStringLiteralDfa5_1(active0, 0x1000000000000000L, active1, 0x100L);
- case 69:
- case 101:
- if ((active0 & 0x8000000000000000L) != 0L)
- return jjStartNfaWithStates_1(4, 63, 14);
- else if ((active1 & 0x1L) != 0L)
- return jjStartNfaWithStates_1(4, 64, 14);
- return jjMoveStringLiteralDfa5_1(active0, 0L, active1, 0x400L);
- case 70:
- case 102:
- if ((active1 & 0x8L) != 0L)
- return jjStartNfaWithStates_1(4, 67, 14);
- break;
- case 71:
- case 103:
- return jjMoveStringLiteralDfa5_1(active0, 0L, active1, 0x8000L);
- case 72:
- case 104:
- return jjMoveStringLiteralDfa5_1(active0, 0L, active1, 0x2L);
- case 73:
- case 105:
- return jjMoveStringLiteralDfa5_1(active0, 0x4128080000000L, active1, 0L);
- case 75:
- case 107:
- if ((active0 & 0x400000000L) != 0L)
- return jjStartNfaWithStates_1(4, 34, 14);
- break;
- case 76:
- case 108:
- return jjMoveStringLiteralDfa5_1(active0, 0L, active1, 0x1000L);
- case 78:
- case 110:
- return jjMoveStringLiteralDfa5_1(active0, 0x20080000000000L, active1, 0x80L);
- case 79:
- case 111:
- return jjMoveStringLiteralDfa5_1(active0, 0L, active1, 0x10L);
- case 82:
- case 114:
- if ((active0 & 0x800000000000000L) != 0L)
- return jjStartNfaWithStates_1(4, 59, 14);
- return jjMoveStringLiteralDfa5_1(active0, 0x400000000000000L, active1, 0L);
- case 83:
- case 115:
- if ((active0 & 0x8000000L) != 0L)
- return jjStartNfaWithStates_1(4, 27, 14);
- break;
- case 84:
- case 116:
- if ((active0 & 0x1000000000L) != 0L)
- return jjStartNfaWithStates_1(4, 36, 14);
- else if ((active0 & 0x2000000000000L) != 0L)
- return jjStartNfaWithStates_1(4, 49, 14);
- else if ((active1 & 0x2000L) != 0L)
- return jjStartNfaWithStates_1(4, 77, 14);
- return jjMoveStringLiteralDfa5_1(active0, 0x10000000L, active1, 0L);
- case 85:
- case 117:
- return jjMoveStringLiteralDfa5_1(active0, 0x8014000000000L, active1, 0L);
- case 87:
- case 119:
- return jjMoveStringLiteralDfa5_1(active0, 0L, active1, 0x4L);
- case 89:
- case 121:
- if ((active0 & 0x200000000L) != 0L)
- return jjStartNfaWithStates_1(4, 33, 14);
- break;
- default :
- break;
- }
- return jjStartNfa_1(3, active0, active1, 0L);
-}
-private final int jjMoveStringLiteralDfa5_1(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_1(3, old0, old1, 0L);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(4, active0, active1, 0L);
- return 5;
- }
- switch(curChar)
- {
- case 65:
- case 97:
- return jjMoveStringLiteralDfa6_1(active0, 0L, active1, 0x400L);
- case 67:
- case 99:
- if ((active0 & 0x100000000000L) != 0L)
- return jjStartNfaWithStates_1(5, 44, 14);
- return jjMoveStringLiteralDfa6_1(active0, 0L, active1, 0x20L);
- case 68:
- case 100:
- return jjMoveStringLiteralDfa6_1(active0, 0x20014000000000L, active1, 0L);
- case 69:
- case 101:
- if ((active0 & 0x80000000000L) != 0L)
- return jjStartNfaWithStates_1(5, 43, 14);
- else if ((active1 & 0x1000L) != 0L)
- return jjStartNfaWithStates_1(5, 76, 14);
- return jjMoveStringLiteralDfa6_1(active0, 0L, active1, 0x8000L);
- case 70:
- case 102:
- if ((active0 & 0x80000000L) != 0L)
- return jjStartNfaWithStates_1(5, 31, 14);
- break;
- case 71:
- case 103:
- if ((active1 & 0x80L) != 0L)
- return jjStartNfaWithStates_1(5, 71, 14);
- break;
- case 72:
- case 104:
- if ((active0 & 0x1000000000000000L) != 0L)
- return jjStartNfaWithStates_1(5, 60, 14);
- break;
- case 73:
- case 105:
- return jjMoveStringLiteralDfa6_1(active0, 0x10000000L, active1, 0x6L);
- case 76:
- case 108:
- if ((active0 & 0x40000000000L) != 0L)
- return jjStartNfaWithStates_1(5, 42, 14);
- return jjMoveStringLiteralDfa6_1(active0, 0x8000000000000L, active1, 0L);
- case 78:
- case 110:
- if ((active0 & 0x400000000000000L) != 0L)
- return jjStartNfaWithStates_1(5, 58, 14);
- return jjMoveStringLiteralDfa6_1(active0, 0x4000000000000L, active1, 0L);
- case 82:
- case 114:
- if ((active1 & 0x10L) != 0L)
- return jjStartNfaWithStates_1(5, 68, 14);
- return jjMoveStringLiteralDfa6_1(active0, 0x28000000000L, active1, 0L);
- case 84:
- case 116:
- if ((active1 & 0x100L) != 0L)
- return jjStartNfaWithStates_1(5, 72, 14);
- break;
- default :
- break;
- }
- return jjStartNfa_1(4, active0, active1, 0L);
-}
-private final int jjMoveStringLiteralDfa6_1(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_1(4, old0, old1, 0L);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(5, active0, active1, 0L);
- return 6;
- }
- switch(curChar)
- {
- case 69:
- case 101:
- if ((active0 & 0x4000000000L) != 0L)
- {
- jjmatchedKind = 38;
- jjmatchedPos = 6;
- }
- else if ((active0 & 0x8000000000L) != 0L)
- {
- jjmatchedKind = 39;
- jjmatchedPos = 6;
- }
- return jjMoveStringLiteralDfa7_1(active0, 0x30000000000L, active1, 0L);
- case 72:
- case 104:
- if ((active1 & 0x20L) != 0L)
- return jjStartNfaWithStates_1(6, 69, 14);
- break;
- case 76:
- case 108:
- return jjMoveStringLiteralDfa7_1(active0, 0L, active1, 0x2L);
- case 78:
- case 110:
- if ((active1 & 0x400L) != 0L)
- return jjStartNfaWithStates_1(6, 74, 14);
- break;
- case 79:
- case 111:
- return jjMoveStringLiteralDfa7_1(active0, 0x10000000L, active1, 0L);
- case 82:
- case 114:
- if ((active1 & 0x8000L) != 0L)
- return jjStartNfaWithStates_1(6, 79, 14);
- break;
- case 83:
- case 115:
- if ((active0 & 0x20000000000000L) != 0L)
- return jjStartNfaWithStates_1(6, 53, 14);
- break;
- case 84:
- case 116:
- if ((active0 & 0x8000000000000L) != 0L)
- return jjStartNfaWithStates_1(6, 51, 14);
- return jjMoveStringLiteralDfa7_1(active0, 0L, active1, 0x4L);
- case 85:
- case 117:
- return jjMoveStringLiteralDfa7_1(active0, 0x4000000000000L, active1, 0L);
- default :
- break;
- }
- return jjStartNfa_1(5, active0, active1, 0L);
-}
-private final int jjMoveStringLiteralDfa7_1(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_1(5, old0, old1, 0L);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(6, active0, active1, 0L);
- return 7;
- }
- switch(curChar)
- {
- case 95:
- return jjMoveStringLiteralDfa8_1(active0, 0x30000000000L, active1, 0L);
- case 67:
- case 99:
- return jjMoveStringLiteralDfa8_1(active0, 0L, active1, 0x4L);
- case 69:
- case 101:
- if ((active0 & 0x4000000000000L) != 0L)
- return jjStartNfaWithStates_1(7, 50, 14);
- else if ((active1 & 0x2L) != 0L)
- return jjStartNfaWithStates_1(7, 65, 14);
- break;
- case 78:
- case 110:
- if ((active0 & 0x10000000L) != 0L)
- return jjStartNfaWithStates_1(7, 28, 14);
- break;
- default :
- break;
- }
- return jjStartNfa_1(6, active0, active1, 0L);
-}
-private final int jjMoveStringLiteralDfa8_1(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_1(6, old0, old1, 0L);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(7, active0, active1, 0L);
- return 8;
- }
- switch(curChar)
- {
- case 72:
- case 104:
- if ((active1 & 0x4L) != 0L)
- return jjStartNfaWithStates_1(8, 66, 14);
- break;
- case 79:
- case 111:
- return jjMoveStringLiteralDfa9_1(active0, 0x30000000000L, active1, 0L);
- default :
- break;
- }
- return jjStartNfa_1(7, active0, active1, 0L);
-}
-private final int jjMoveStringLiteralDfa9_1(long old0, long active0, long old1, long active1)
-{
- if (((active0 &= old0) | (active1 &= old1)) == 0L)
- return jjStartNfa_1(7, old0, old1, 0L);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(8, active0, 0L, 0L);
- return 9;
- }
- switch(curChar)
- {
- case 78:
- case 110:
- return jjMoveStringLiteralDfa10_1(active0, 0x30000000000L);
- default :
- break;
- }
- return jjStartNfa_1(8, active0, 0L, 0L);
-}
-private final int jjMoveStringLiteralDfa10_1(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_1(8, old0, 0L, 0L);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(9, active0, 0L, 0L);
- return 10;
- }
- switch(curChar)
- {
- case 67:
- case 99:
- return jjMoveStringLiteralDfa11_1(active0, 0x30000000000L);
- default :
- break;
- }
- return jjStartNfa_1(9, active0, 0L, 0L);
-}
-private final int jjMoveStringLiteralDfa11_1(long old0, long active0)
-{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_1(9, old0, 0L, 0L);
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) {
- jjStopStringLiteralDfa_1(10, active0, 0L, 0L);
- return 11;
- }
- switch(curChar)
- {
- case 69:
- case 101:
- if ((active0 & 0x10000000000L) != 0L)
- return jjStartNfaWithStates_1(11, 40, 14);
- else if ((active0 & 0x20000000000L) != 0L)
- return jjStartNfaWithStates_1(11, 41, 14);
- break;
- default :
- break;
- }
- return jjStartNfa_1(10, active0, 0L, 0L);
-}
-private final int jjMoveNfa_1(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 52;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 3:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(0, 6);
- else if (curChar == 39)
- jjCheckNAddStates(7, 12);
- else if (curChar == 46)
- jjCheckNAdd(8);
- else if (curChar == 47)
- jjstateSet[jjnewStateCnt++] = 2;
- if ((0x3fe000000000000L & l) != 0L)
- {
- if (kind > 102)
- kind = 102;
- jjCheckNAddTwoStates(5, 6);
- }
- else if (curChar == 48)
- {
- if (kind > 102)
- kind = 102;
- jjCheckNAddStates(13, 15);
- }
- break;
- case 0:
- if (curChar == 42)
- jjstateSet[jjnewStateCnt++] = 1;
- break;
- case 1:
- if ((0xffff7fffffffffffL & l) != 0L && kind > 18)
- kind = 18;
- break;
- case 2:
- if (curChar == 42)
- jjstateSet[jjnewStateCnt++] = 0;
- break;
- case 4:
- if ((0x3fe000000000000L & l) == 0L)
- break;
- if (kind > 102)
- kind = 102;
- jjCheckNAddTwoStates(5, 6);
- break;
- case 5:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 102)
- kind = 102;
- jjCheckNAddTwoStates(5, 6);
- break;
- case 7:
- if (curChar == 46)
- jjCheckNAdd(8);
- break;
- case 8:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 106)
- kind = 106;
- jjCheckNAddStates(16, 18);
- break;
- case 10:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(11);
- break;
- case 11:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 106)
- kind = 106;
- jjCheckNAddTwoStates(11, 12);
- break;
- case 14:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 124)
- kind = 124;
- jjstateSet[jjnewStateCnt++] = 14;
- break;
- case 15:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(0, 6);
- break;
- case 16:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(16, 17);
- break;
- case 17:
- if (curChar != 46)
- break;
- if (kind > 106)
- kind = 106;
- jjCheckNAddStates(19, 21);
- break;
- case 18:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 106)
- kind = 106;
- jjCheckNAddStates(19, 21);
- break;
- case 20:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(21);
- break;
- case 21:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 106)
- kind = 106;
- jjCheckNAddTwoStates(21, 12);
- break;
- case 22:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(22, 23);
- break;
- case 24:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(25);
- break;
- case 25:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 106)
- kind = 106;
- jjCheckNAddTwoStates(25, 12);
- break;
- case 26:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddStates(22, 24);
- break;
- case 28:
- if ((0x280000000000L & l) != 0L)
- jjCheckNAdd(29);
- break;
- case 29:
- if ((0x3ff000000000000L & l) != 0L)
- jjCheckNAddTwoStates(29, 12);
- break;
- case 30:
- if (curChar != 48)
- break;
- if (kind > 102)
- kind = 102;
- jjCheckNAddStates(13, 15);
- break;
- case 32:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 102)
- kind = 102;
- jjCheckNAddTwoStates(32, 6);
- break;
- case 33:
- if ((0xff000000000000L & l) == 0L)
- break;
- if (kind > 102)
- kind = 102;
- jjCheckNAddTwoStates(33, 6);
- break;
- case 34:
- if (curChar == 39)
- jjCheckNAddStates(7, 12);
- break;
- case 35:
- if ((0xffffff7fffffffffL & l) != 0L)
- jjCheckNAddStates(25, 27);
- break;
- case 37:
- jjCheckNAddStates(25, 27);
- break;
- case 38:
- if (curChar == 39 && kind > 108)
- kind = 108;
- break;
- case 39:
- if ((0xffffff7fffffffffL & l) != 0L)
- jjCheckNAddStates(28, 30);
- break;
- case 41:
- jjCheckNAddStates(28, 30);
- break;
- case 42:
- if (curChar == 39 && kind > 109)
- kind = 109;
- break;
- case 44:
- case 46:
- jjCheckNAddStates(31, 33);
- break;
- case 48:
- case 50:
- jjCheckNAddStates(34, 36);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 3:
- if ((0x87fffffe87fffffeL & l) != 0L)
- {
- if (kind > 124)
- kind = 124;
- jjCheckNAdd(14);
- }
- else if (curChar == 96)
- jjCheckNAddStates(37, 42);
- break;
- case 1:
- if (kind > 18)
- kind = 18;
- break;
- case 6:
- if ((0x100000001000L & l) != 0L && kind > 102)
- kind = 102;
- break;
- case 9:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(43, 44);
- break;
- case 12:
- if ((0x5000000050L & l) != 0L && kind > 106)
- kind = 106;
- break;
- case 13:
- case 14:
- if ((0x87fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 124)
- kind = 124;
- jjCheckNAdd(14);
- break;
- case 19:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(45, 46);
- break;
- case 23:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(47, 48);
- break;
- case 27:
- if ((0x2000000020L & l) != 0L)
- jjAddStates(49, 50);
- break;
- case 31:
- if ((0x100000001000000L & l) != 0L)
- jjCheckNAdd(32);
- break;
- case 32:
- if ((0x7e0000007eL & l) == 0L)
- break;
- if (kind > 102)
- kind = 102;
- jjCheckNAddTwoStates(32, 6);
- break;
- case 35:
- if ((0xffffffffefffffffL & l) != 0L)
- jjCheckNAddStates(25, 27);
- break;
- case 36:
- if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 37;
- break;
- case 37:
- jjCheckNAddStates(25, 27);
- break;
- case 39:
- if ((0xffffffffefffffffL & l) != 0L)
- jjCheckNAddStates(28, 30);
- break;
- case 40:
- if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 41;
- break;
- case 41:
- jjCheckNAddStates(28, 30);
- break;
- case 43:
- if (curChar == 96)
- jjCheckNAddStates(37, 42);
- break;
- case 44:
- if ((0xfffffffeefffffffL & l) != 0L)
- jjCheckNAddStates(31, 33);
- break;
- case 45:
- if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 46;
- break;
- case 46:
- jjCheckNAddStates(31, 33);
- break;
- case 47:
- if (curChar == 96 && kind > 108)
- kind = 108;
- break;
- case 48:
- if ((0xfffffffeefffffffL & l) != 0L)
- jjCheckNAddStates(34, 36);
- break;
- case 49:
- if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 50;
- break;
- case 50:
- jjCheckNAddStates(34, 36);
- break;
- case 51:
- if (curChar == 96 && kind > 110)
- kind = 110;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 3:
- case 14:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 124)
- kind = 124;
- jjCheckNAdd(14);
- break;
- case 1:
- if ((jjbitVec0[i2] & l2) != 0L && kind > 18)
- kind = 18;
- break;
- case 35:
- case 37:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(25, 27);
- break;
- case 39:
- case 41:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(28, 30);
- break;
- case 44:
- case 46:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(31, 33);
- break;
- case 48:
- case 50:
- if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(34, 36);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 52 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-private final int jjStopStringLiteralDfa_7(int pos, long active0, long active1)
-{
- switch (pos)
- {
- default :
- return -1;
- }
-}
-private final int jjStartNfa_7(int pos, long active0, long active1)
-{
- return jjMoveNfa_7(jjStopStringLiteralDfa_7(pos, active0, active1), pos + 1);
-}
-private final int jjStartNfaWithStates_7(int pos, int kind, int state)
-{
- jjmatchedKind = kind;
- jjmatchedPos = pos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return pos + 1; }
- return jjMoveNfa_7(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_7()
-{
- switch(curChar)
- {
- case 34:
- return jjStopAtPos(0, 114);
- case 123:
- return jjStopAtPos(0, 115);
- default :
- return jjMoveNfa_7(0, 0);
- }
-}
-private final int jjMoveNfa_7(int startState, int curPos)
-{
- int[] nextStates;
- int startsAt = 0;
- jjnewStateCnt = 4;
- int i = 1;
- jjstateSet[0] = startState;
- int j, kind = 0x7fffffff;
- for (;;)
- {
- if (++jjround == 0x7fffffff)
- ReInitRounds();
- if (curChar < 64)
- {
- long l = 1L << curChar;
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 1:
- if (kind > 111)
- kind = 111;
- break;
- case 3:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 124)
- kind = 124;
- jjstateSet[jjnewStateCnt++] = 3;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else if (curChar < 128)
- {
- long l = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- if ((0x87fffffe87fffffeL & l) != 0L)
- {
- if (kind > 124)
- kind = 124;
- jjCheckNAdd(3);
- }
- else if (curChar == 92)
- jjstateSet[jjnewStateCnt++] = 1;
- break;
- case 1:
- if (kind > 111)
- kind = 111;
- break;
- case 2:
- case 3:
- if ((0x87fffffe87fffffeL & l) == 0L)
- break;
- if (kind > 124)
- kind = 124;
- jjCheckNAdd(3);
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- else
- {
- int i2 = (curChar & 0xff) >> 6;
- long l2 = 1L << (curChar & 077);
- MatchLoop: do
- {
- switch(jjstateSet[--i])
- {
- case 0:
- case 3:
- if ((jjbitVec0[i2] & l2) == 0L)
- break;
- if (kind > 124)
- kind = 124;
- jjCheckNAdd(3);
- break;
- case 1:
- if ((jjbitVec0[i2] & l2) != 0L && kind > 111)
- kind = 111;
- break;
- default : break;
- }
- } while(i != startsAt);
- }
- if (kind != 0x7fffffff)
- {
- jjmatchedKind = kind;
- jjmatchedPos = curPos;
- kind = 0x7fffffff;
- }
- ++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 4 - (jjnewStateCnt = startsAt)))
- return curPos;
- try { curChar = input_stream.readChar(); }
- catch(java.io.IOException e) { return curPos; }
- }
-}
-static final int[] jjnextStates = {
- 16, 17, 22, 23, 26, 27, 12, 35, 36, 38, 39, 40, 42, 31, 33, 6,
- 8, 9, 12, 18, 19, 12, 26, 27, 12, 35, 36, 38, 39, 40, 42, 44,
- 45, 47, 48, 49, 51, 44, 45, 47, 48, 49, 51, 10, 11, 20, 21, 24,
- 25, 28, 29,
-};
-public static final String[] jjstrLiteralImages = {
-"", "\74\77", null, "\74\77\75", "\77\76", null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, "\55\76", "\72\72", "\75\76", null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, null, null,
-null, "\100", "\41", "\176", "\77", "\72", "\174\174", "\46\46", "\53\53", "\55\55",
-"\53", "\55", "\52", "\57", "\46", "\174", "\136", "\45", "\74\74", "\76\76",
-"\76\76\76", null, null, null, null, null, null, null, null, null, null, null, null, "\42",
-"\44", "\42", "\173", null, null, null, "\175", null, null, null, "\44", null, null,
-null, null, null, "\50", "\51", "\173", "\175", "\133", "\135", "\73", "\54", "\56",
-"\76", "\74", "\75\75", "\74\75", "\76\75", "\41\75", "\74\76", "\41\75\75",
-"\75\75\75", "\75", "\53\75", "\55\75", "\52\75", "\57\75", "\46\75", "\174\75", "\136\75",
-"\56\75", "\45\75", "\176\75", "\74\74\75", "\76\76\75", };
-public static final String[] lexStateNames = {
- "DEFAULT",
- "PHPPARSING",
- "IN_SINGLE_LINE_COMMENT",
- "IN_VARIABLE",
- "IN_FORMAL_COMMENT",
- "IN_MULTI_LINE_COMMENT",
- "IN_STRING",
- "DOLLAR_IN_STRING",
- "SKIPSTRING",
- "DOLLAR_IN_STRING_EXPR",
-};
-public static final int[] jjnewLexState = {
- -1, 1, 1, 1, 0, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 2, 2, 4, 5, 1, -1, -1, -1, 1,
- 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, 6, 7, 1, 9, 8, 6, -1, 7, -1, -1, -1, 3, -1,
- -1, -1, -1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-static final long[] jjtoToken = {
- 0xfffffffff880001fL, 0x198f747fffffffffL, 0xfffffffeL,
-};
-static final long[] jjtoSkip = {
- 0x37fffe0L, 0x670800000000000L, 0x1L,
-};
-static final long[] jjtoSpecial = {
- 0x37ff800L, 0x30000000000000L, 0x1L,
-};
-static final long[] jjtoMore = {
- 0x4000000L, 0x0L, 0x0L,
-};
-protected SimpleCharStream input_stream;
-private final int[] jjrounds = new int[52];
-private final int[] jjstateSet = new int[104];
-StringBuffer image;
-int jjimageLen;
-int lengthOfMatch;
-protected char curChar;
-public PHPParserTokenManager(SimpleCharStream stream)
-{
- if (SimpleCharStream.staticFlag)
- throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
- input_stream = stream;
-}
-public PHPParserTokenManager(SimpleCharStream stream, int lexState)
-{
- this(stream);
- SwitchTo(lexState);
-}
-public void ReInit(SimpleCharStream stream)
-{
- jjmatchedPos = jjnewStateCnt = 0;
- curLexState = defaultLexState;
- input_stream = stream;
- ReInitRounds();
-}
-private final void ReInitRounds()
-{
- int i;
- jjround = 0x80000001;
- for (i = 52; i-- > 0;)
- jjrounds[i] = 0x80000000;
-}
-public void ReInit(SimpleCharStream stream, int lexState)
-{
- ReInit(stream);
- SwitchTo(lexState);
-}
-public void SwitchTo(int lexState)
-{
- if (lexState >= 10 || lexState < 0)
- throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
- else
- curLexState = lexState;
-}
-
-protected Token jjFillToken()
-{
- Token t = Token.newToken(jjmatchedKind);
- t.kind = jjmatchedKind;
- if (jjmatchedPos < 0)
- {
- t.image = "";
- t.beginLine = t.endLine = input_stream.getBeginLine();
- t.beginColumn = t.endColumn = input_stream.getBeginColumn();
- }
- else
- {
- String im = jjstrLiteralImages[jjmatchedKind];
- t.image = (im == null) ? input_stream.GetImage() : im;
- t.beginLine = input_stream.getBeginLine();
- t.beginColumn = input_stream.getBeginColumn();
- t.endLine = input_stream.getEndLine();
- t.endColumn = input_stream.getEndColumn();
- }
- return t;
-}
-
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
-
-public Token getNextToken()
-{
- int kind;
- Token specialToken = null;
- Token matchedToken;
- int curPos = 0;
-
- EOFLoop :
- for (;;)
- {
- try
- {
- curChar = input_stream.BeginToken();
- }
- catch(java.io.IOException e)
- {
- jjmatchedKind = 0;
- matchedToken = jjFillToken();
- matchedToken.specialToken = specialToken;
- CommonTokenAction(matchedToken);
- return matchedToken;
- }
- image = null;
- jjimageLen = 0;
-
- for (;;)
- {
- switch(curLexState)
- {
- case 0:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_0();
- if (jjmatchedPos == 0 && jjmatchedKind > 5)
- {
- jjmatchedKind = 5;
- }
- break;
- case 1:
- try { input_stream.backup(0);
- while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L)
- curChar = input_stream.BeginToken();
- }
- catch (java.io.IOException e1) { continue EOFLoop; }
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_1();
- break;
- case 2:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_2();
- if (jjmatchedPos == 0 && jjmatchedKind > 21)
- {
- jjmatchedKind = 21;
- }
- break;
- case 3:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_3();
- break;
- case 4:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_4();
- if (jjmatchedPos == 0 && jjmatchedKind > 26)
- {
- jjmatchedKind = 26;
- }
- break;
- case 5:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_5();
- if (jjmatchedPos == 0 && jjmatchedKind > 26)
- {
- jjmatchedKind = 26;
- }
- break;
- case 6:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_6();
- if (jjmatchedPos == 0 && jjmatchedKind > 121)
- {
- jjmatchedKind = 121;
- }
- break;
- case 7:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_7();
- if (jjmatchedPos == 0 && jjmatchedKind > 128)
- {
- jjmatchedKind = 128;
- }
- break;
- case 8:
- jjmatchedKind = 0x7fffffff;
- jjmatchedPos = 0;
- curPos = jjMoveStringLiteralDfa0_8();
- if (jjmatchedPos == 0 && jjmatchedKind > 118)
- {
- jjmatchedKind = 118;
- }
- break;
- case 9:
- jjmatchedKind = 120;
- jjmatchedPos = -1;
- curPos = 0;
- curPos = jjMoveStringLiteralDfa0_9();
- if (jjmatchedPos < 0 || (jjmatchedPos == 0 && jjmatchedKind > 122))
- {
- jjmatchedKind = 122;
- jjmatchedPos = 0;
- }
- break;
- }
- if (jjmatchedKind != 0x7fffffff)
- {
- if (jjmatchedPos + 1 < curPos)
- input_stream.backup(curPos - jjmatchedPos - 1);
- if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- matchedToken.specialToken = specialToken;
- TokenLexicalActions(matchedToken);
- if (jjnewLexState[jjmatchedKind] != -1)
- curLexState = jjnewLexState[jjmatchedKind];
- CommonTokenAction(matchedToken);
- return matchedToken;
- }
- else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
- {
- matchedToken = jjFillToken();
- if (specialToken == null)
- specialToken = matchedToken;
- else
- {
- matchedToken.specialToken = specialToken;
- specialToken = (specialToken.next = matchedToken);
- }
- SkipLexicalActions(matchedToken);
- }
- else
- SkipLexicalActions(null);
- if (jjnewLexState[jjmatchedKind] != -1)
- curLexState = jjnewLexState[jjmatchedKind];
- continue EOFLoop;
- }
- jjimageLen += jjmatchedPos + 1;
- if (jjnewLexState[jjmatchedKind] != -1)
- curLexState = jjnewLexState[jjmatchedKind];
- curPos = 0;
- jjmatchedKind = 0x7fffffff;
- try {
- curChar = input_stream.readChar();
- continue;
- }
- catch (java.io.IOException e1) { }
- }
- int error_line = input_stream.getEndLine();
- int error_column = input_stream.getEndColumn();
- String error_after = null;
- boolean EOFSeen = false;
- try { input_stream.readChar(); input_stream.backup(1); }
- catch (java.io.IOException e1) {
- EOFSeen = true;
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- if (curChar == '\n' || curChar == '\r') {
- error_line++;
- error_column = 0;
- }
- else
- error_column++;
- }
- if (!EOFSeen) {
- input_stream.backup(1);
- error_after = curPos <= 1 ? "" : input_stream.GetImage();
- }
- throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
- }
- }
-}
-
-void SkipLexicalActions(Token matchedToken)
-{
- switch(jjmatchedKind)
- {
- case 18 :
- if (image == null)
- image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
- else
- image.append(new String(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))));
- input_stream.backup(1);
- break;
- default :
- break;
- }
-}
-void TokenLexicalActions(Token matchedToken)
-{
- switch(jjmatchedKind)
- {
- default :
- break;
- }
-}
-}
+++ /dev/null
-package test;
-
-
-/**
- * A Variable usage. It could be a first use, an in code use of an already declared var.
- * In fact I'm not sure for the moment I will keep this
- * @author Matthieu Casanova
- */
-public class PHPVar {
-
- /** The name of the variable. It couldn't be changed. */
- private final String name;
-
- /** The value. It could change. */
- private String value;
-
- /**
- * Tell if the variable is a reference or not (given in function by &$varname,
- * or comming from a 'global' keyword.
- */
- private boolean reference;
-
- /**
- * Does the variable have a value or not.
- * If we don't know if it was initialized it should be set on true.
- * (when we have a global keyword for example)
- */
- private boolean initialized;
-
- /** This variable indicate if it is used or not in the code. */
- private boolean used;
-
- /**
- * We initialize the name and the value of the variable.
- * @param name the name of the variable
- * @param value the value of the variable
- */
- public PHPVar(String name, String value) {
- this.name = name;
- this.value = value;
- initialized = value != null;
- }
-
- /**
- * We initialize the name of the variable. The value will be null
- * @param name the name of the variable
- */
- public PHPVar(String name) {
- this.name = name;
- }
-
- /**
- * Initialize the variable name and set the initialization status.
- * @param name the name of the variable
- * @param initialized the initialization status (it should be true or it's unuseful)
- */
- public PHPVar(String name, boolean initialized) {
- this(name);
- this.initialized = initialized;
- }
-
- /**
- * Give a reference to the variable.
- * @param reference a reference
- */
- public void setReference(boolean reference) {
- this.reference = reference;
- if (reference) {// a reference variable status is unknown so is initialized for me
- //example : global
- initialized = true;
- }
- }
-
- /**
- * Tell if the variable is reference.
- * @return a boolean
- */
- public boolean isReference() {
- return reference;
- }
-
- public void setUsed(boolean used) {
- this.used = used;
- }
-
- public void setInitialized(boolean initialized) {
- this.initialized = initialized;
- }
-
- /**
- * Get the name of the variable.
- * @return a string containing the name of the variable
- */
- public String getName() {
- return name;
- }
-
- /**
- * Tell if the variable was used.
- * @return a boolean telling if the variable is used
- */
- public boolean isUsed() {
- return used;
- }
-
- /**
- * Return a human readable variable (:
- * @return a string representation of the object.
- */
- public String toString() {
- if (value == null) {
- if (reference) {
- return "&$" + name;
- }
- return "$" + name;
- }
- if (reference) {
- return "&$" + name + "=" + value;
- }
- return "$" + name + "=" + value;
- }
-}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */
-package test;
-
-/**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
- */
-public class ParseException extends Exception {
-
- /**
- * This constructor is used by the method "generateParseException"
- * in the generated parser. Calling this constructor generates
- * a new object of this type with the fields "currentToken",
- * "expectedTokenSequences", and "tokenImage" set. The boolean
- * flag "specialConstructor" is also set to true to indicate that
- * this constructor was used to create this object.
- * This constructor calls its super class with the empty string
- * to force the "toString" method of parent class "Throwable" to
- * print the error message in the form:
- * ParseException: <result of getMessage>
- */
- public ParseException(Token currentTokenVal,
- int[][] expectedTokenSequencesVal,
- String[] tokenImageVal
- )
- {
- super("");
- specialConstructor = true;
- currentToken = currentTokenVal;
- expectedTokenSequences = expectedTokenSequencesVal;
- tokenImage = tokenImageVal;
- }
-
- /**
- * The following constructors are for use by you for whatever
- * purpose you can think of. Constructing the exception in this
- * manner makes the exception behave in the normal way - i.e., as
- * documented in the class "Throwable". The fields "errorToken",
- * "expectedTokenSequences", and "tokenImage" do not contain
- * relevant information. The JavaCC generated code does not use
- * these constructors.
- */
-
- public ParseException() {
- super();
- specialConstructor = false;
- }
-
- public ParseException(String message) {
- super(message);
- specialConstructor = false;
- }
-
- /**
- * This variable determines which constructor was used to create
- * this object and thereby affects the semantics of the
- * "getMessage" method (see below).
- */
- protected boolean specialConstructor;
-
- /**
- * This is the last token that has been consumed successfully. If
- * this object has been created due to a parse error, the token
- * followng this token will (therefore) be the first error token.
- */
- public Token currentToken;
-
- /**
- * Each entry in this array is an array of integers. Each array
- * of integers represents a sequence of tokens (by their ordinal
- * values) that is expected at this point of the parse.
- */
- public int[][] expectedTokenSequences;
-
- /**
- * This is a reference to the "tokenImage" array of the generated
- * parser within which the parse error occurred. This array is
- * defined in the generated ...Constants interface.
- */
- public String[] tokenImage;
-
- /**
- * This method has the standard behavior when this object has been
- * created using the standard constructors. Otherwise, it uses
- * "currentToken" and "expectedTokenSequences" to generate a parse
- * error message and returns it. If this object has been created
- * due to a parse error, and you do not catch it (it gets thrown
- * from the parser), then this method is called during the printing
- * of the final stack trace, and hence the correct error message
- * gets displayed.
- */
- public String getMessage() {
- if (!specialConstructor) {
- return super.getMessage();
- }
- String expected = "";
- int maxSize = 0;
- for (int i = 0; i < expectedTokenSequences.length; i++) {
- if (maxSize < expectedTokenSequences[i].length) {
- maxSize = expectedTokenSequences[i].length;
- }
- for (int j = 0; j < expectedTokenSequences[i].length; j++) {
- expected += tokenImage[expectedTokenSequences[i][j]] + " ";
- }
- if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
- expected += "...";
- }
- expected += eol + " ";
- }
- String retval = "Encountered \"";
- Token tok = currentToken.next;
- for (int i = 0; i < maxSize; i++) {
- if (i != 0) retval += " ";
- if (tok.kind == 0) {
- retval += tokenImage[0];
- break;
- }
- retval += add_escapes(tok.image);
- tok = tok.next;
- }
- retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
- retval += "." + eol;
- if (expectedTokenSequences.length == 1) {
- retval += "Was expecting:" + eol + " ";
- } else {
- retval += "Was expecting one of:" + eol + " ";
- }
- retval += expected;
- return retval;
- }
-
- /**
- * The end of line string for this machine.
- */
- protected String eol = System.getProperty("line.separator", "\n");
-
- /**
- * Used to convert raw characters to their escaped version
- * when these raw version cannot be used as part of an ASCII
- * string literal.
- */
- protected String add_escapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
-}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 3.0 */
-package test;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (without unicode processing).
- */
-
-public class SimpleCharStream
-{
- public static final boolean staticFlag = false;
- int bufsize;
- int available;
- int tokenBegin;
- public int bufpos = -1;
-
- protected int beginOffset, endOffset;
-
- protected int bufline[];
- protected int bufcolumn[];
-
- protected int column = 0;
- protected int line = 1;
-
- protected boolean prevCharIsCR = false;
- protected boolean prevCharIsLF = false;
-
- protected java.io.Reader inputStream;
-
- protected char[] buffer;
- protected int maxNextCharInd = 0;
- protected int inBuf = 0;
- protected StringBuffer currentBuffer = new StringBuffer();
-
- protected void ExpandBuff(boolean wrapAround)
- {
- char[] newbuffer = new char[bufsize + 2048];
- int newbufline[] = new int[bufsize + 2048];
- int newbufcolumn[] = new int[bufsize + 2048];
-
- try
- {
- if (wrapAround)
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- System.arraycopy(buffer, 0, newbuffer,
- bufsize - tokenBegin, bufpos);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos += (bufsize - tokenBegin));
- }
- else
- {
- System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
- buffer = newbuffer;
-
- System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
- bufline = newbufline;
-
- System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
- bufcolumn = newbufcolumn;
-
- maxNextCharInd = (bufpos -= tokenBegin);
- }
- }
- catch (Throwable t)
- {
- throw new Error(t.getMessage());
- }
-
-
- bufsize += 2048;
- available = bufsize;
- tokenBegin = 0;
- }
-
- protected void FillBuff() throws java.io.IOException
- {
- if (maxNextCharInd == available)
- {
- if (available == bufsize)
- {
- if (tokenBegin > 2048)
- {
- position += bufpos;
- bufpos = maxNextCharInd = 0;
- available = tokenBegin;
- }
- else if (tokenBegin < 0) {
- position += bufpos;
- bufpos = maxNextCharInd = 0;
- } else
- ExpandBuff(false);
- }
- else if (available > tokenBegin)
- available = bufsize;
- else if ((tokenBegin - available) < 2048)
- ExpandBuff(true);
- else
- available = tokenBegin;
- }
-
- int i;
- try {
- if ((i = inputStream.read(buffer, maxNextCharInd,
- available - maxNextCharInd)) == -1)
- {
- inputStream.close();
- throw new java.io.IOException();
- }
- else {
- maxNextCharInd += i;
- }
- currentBuffer.append(buffer);
- return;
- }
- catch(java.io.IOException e) {
- --bufpos;
- backup(0);
- if (tokenBegin == -1)
- tokenBegin = bufpos;
- throw e;
- }
- }
-
- public char BeginToken() throws java.io.IOException
- {
- beginOffset = endOffset;
- tokenBegin = -1;
- char c = readChar();
- tokenBegin = bufpos;
-
- return c;
- }
-
- protected void UpdateLineColumn(char c)
- {
- column++;
-
- if (prevCharIsLF)
- {
- prevCharIsLF = false;
- line += (column = 1);
- }
- else if (prevCharIsCR)
- {
- prevCharIsCR = false;
- if (c == '\n')
- {
- prevCharIsLF = true;
- }
- else
- line += (column = 1);
- }
-
- switch (c)
- {
- case '\r' :
- prevCharIsCR = true;
- break;
- case '\n' :
- prevCharIsLF = true;
- break;
- case '\t' :
- column--;
- column += (8 - (column & 07));
- break;
- default :
- break;
- }
-
- bufline[bufpos] = line;
- bufcolumn[bufpos] = column;
- }
-
- public char readChar() throws java.io.IOException
- {
- endOffset++;
- if (inBuf > 0)
- {
- --inBuf;
-
- if (++bufpos == bufsize) {
- position += bufpos;
- bufpos = 0;
- }
-
- return buffer[bufpos];
- }
-
- if (++bufpos >= maxNextCharInd)
- FillBuff();
-
- char c = buffer[bufpos];
-
- UpdateLineColumn(c);
- return (c);
- }
-
- /**
- * @deprecated
- * @see #getEndColumn
- */
-
- public int getColumn() {
- return bufcolumn[bufpos];
- }
-
- /**
- * @deprecated
- * @see #getEndLine
- */
-
- public int getLine() {
- return bufline[bufpos];
- }
-
- public int getEndColumn() {
- return bufcolumn[bufpos];
- }
-
- public int getEndLine() {
- return bufline[bufpos];
- }
-
- public int getBeginColumn() {
- return bufcolumn[tokenBegin];
- }
-
- public int getBeginLine() {
- return bufline[tokenBegin];
- }
-
- public void backup(int amount) {
-
- endOffset -= amount;
- inBuf += amount;
- if ((bufpos -= amount) < 0)
- bufpos += bufsize;
- }
-
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- currentBuffer = new StringBuffer();
- line = startline;
- column = startcolumn - 1;
-
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- beginOffset = 0;
- endOffset = 0;
- }
-
- public SimpleCharStream(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public SimpleCharStream(java.io.Reader dstream)
- {
- this(dstream, 1, 1, 4096);
- }
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn, int buffersize)
- {
- inputStream = dstream;
- currentBuffer = new StringBuffer();
- line = startline;
- column = startcolumn - 1;
-
- if (buffer == null || buffersize != buffer.length)
- {
- available = bufsize = buffersize;
- buffer = new char[buffersize];
- bufline = new int[buffersize];
- bufcolumn = new int[buffersize];
- }
- prevCharIsLF = prevCharIsCR = false;
- tokenBegin = inBuf = maxNextCharInd = 0;
- bufpos = -1;
- position = 0;
- beginOffset = 0;
- endOffset = 0;
- }
-
- public void ReInit(java.io.Reader dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
-
- public void ReInit(java.io.Reader dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
-
- public SimpleCharStream(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- this(dstream, startline, startcolumn, 4096);
- }
-
- public SimpleCharStream(java.io.InputStream dstream)
- {
- this(dstream, 1, 1, 4096);
- }
-
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn, int buffersize)
- {
- ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
- }
-
- public void ReInit(java.io.InputStream dstream)
- {
- ReInit(dstream, 1, 1, 4096);
- }
- public void ReInit(java.io.InputStream dstream, int startline,
- int startcolumn)
- {
- ReInit(dstream, startline, startcolumn, 4096);
- }
- public String GetImage()
- {
- if (bufpos >= tokenBegin)
- return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
- return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
- }
-
- public char[] GetSuffix(int len)
- {
- char[] ret = new char[len];
-
- if ((bufpos + 1) >= len)
- System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
- {
- System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
- len - bufpos - 1);
- System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
- }
-
- return ret;
- }
-
- public void Done()
- {
- buffer = null;
- bufline = null;
- bufcolumn = null;
- }
-
- /**
- * Method to adjust line and column numbers for the start of a token.<BR>
- */
- public void adjustBeginLineColumn(int newLine, int newCol)
- {
- int start = tokenBegin;
- int len;
-
- if (bufpos >= tokenBegin)
- {
- len = bufpos - tokenBegin + inBuf + 1;
- }
- else
- {
- len = bufsize - tokenBegin + bufpos + 1 + inBuf;
- }
-
- int i = 0, j = 0, k = 0;
- int nextColDiff = 0, columnDiff = 0;
-
- while (i < len &&
- bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
- {
- bufline[j] = newLine;
- nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
- bufcolumn[j] = newCol + columnDiff;
- columnDiff = nextColDiff;
- i++;
- }
-
- if (i < len)
- {
- bufline[j] = newLine++;
- bufcolumn[j] = newCol + columnDiff;
-
- while (i++ < len)
- {
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
- bufline[j] = newLine++;
- else
- bufline[j] = newLine;
- }
- }
-
- line = bufline[j];
- column = bufcolumn[j];
- }
-
- public StringBuffer getCurrentBuffer() {
- return currentBuffer;
- }
-
- //Added by Matthieu Casanova
- public int position = 0;
- /**
- * @deprecated
- * @return
- */
- public int getPosition() {
- return position + bufpos;
- }
-
- public int getBeginOffset() {
- return beginOffset;
- }
-
- public int getEndOffset() {
- return endOffset;
- }
-}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
-package test;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token {
-
- /**
- * An integer that describes the kind of this token. This numbering
- * system is determined by JavaCCParser, and a table of these numbers is
- * stored in the file ...Constants.java.
- */
- public int kind;
-
- /**
- * beginLine and beginColumn describe the position of the first character
- * of this token; endLine and endColumn describe the position of the
- * last character of this token.
- */
- public int beginLine, beginColumn, endLine, endColumn;
-
- //Matthieu Casanova addition
- public int sourceStart, sourceEnd;
- /**
- * The string image of the token.
- */
- public String image;
-
- /**
- * A reference to the next regular (non-special) token from the input
- * stream. If this is the last token from the input stream, or if the
- * token manager has not read tokens beyond this one, this field is
- * set to null. This is true only if this token is also a regular
- * token. Otherwise, see below for a description of the contents of
- * this field.
- */
- public Token next;
-
- /**
- * This field is used to access special tokens that occur prior to this
- * token, but after the immediately preceding regular (non-special) token.
- * If there are no such special tokens, this field is set to null.
- * When there are more than one such special token, this field refers
- * to the last of these special tokens, which in turn refers to the next
- * previous special token through its specialToken field, and so on
- * until the first special token (whose specialToken field is null).
- * The next fields of special tokens refer to other special tokens that
- * immediately follow it (without an intervening regular token). If there
- * is no such token, this field is null.
- */
- public Token specialToken;
-
- /**
- * Returns the image.
- */
- public String toString()
- {
- return image;
- }
-
- /**
- * Returns a new Token object, by default. However, if you want, you
- * can create and return subclass objects based on the value of ofKind.
- * Simply add the cases to the switch for all those special cases.
- * For example, if you have a subclass of Token called IDToken that
- * you want to create if ofKind is ID, simlpy add something like :
- *
- * case MyParserConstants.ID : return new IDToken();
- *
- * to the following switch statement. Then you can cast matchedToken
- * variable to the appropriate type and use it in your lexical actions.
- */
- public static final Token newToken(int ofKind)
- {
- switch(ofKind)
- {
- default : return new Token();
- }
- }
-
-}
+++ /dev/null
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
-package test;
-
-public class TokenMgrError extends Error
-{
- /*
- * Ordinals for various reasons why an Error of this type can be thrown.
- */
-
- /**
- * Lexical error occured.
- */
- static final int LEXICAL_ERROR = 0;
-
- /**
- * An attempt wass made to create a second instance of a static token manager.
- */
- static final int STATIC_LEXER_ERROR = 1;
-
- /**
- * Tried to change to an invalid lexical state.
- */
- static final int INVALID_LEXICAL_STATE = 2;
-
- /**
- * Detected (and bailed out of) an infinite loop in the token manager.
- */
- static final int LOOP_DETECTED = 3;
-
- /**
- * Indicates the reason why the exception is thrown. It will have
- * one of the above 4 values.
- */
- int errorCode;
-
- /**
- * Replaces unprintable characters by their espaced (or unicode escaped)
- * equivalents in the given string
- */
- protected static final String addEscapes(String str) {
- StringBuffer retval = new StringBuffer();
- char ch;
- for (int i = 0; i < str.length(); i++) {
- switch (str.charAt(i))
- {
- case 0 :
- continue;
- case '\b':
- retval.append("\\b");
- continue;
- case '\t':
- retval.append("\\t");
- continue;
- case '\n':
- retval.append("\\n");
- continue;
- case '\f':
- retval.append("\\f");
- continue;
- case '\r':
- retval.append("\\r");
- continue;
- case '\"':
- retval.append("\\\"");
- continue;
- case '\'':
- retval.append("\\\'");
- continue;
- case '\\':
- retval.append("\\\\");
- continue;
- default:
- if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
- String s = "0000" + Integer.toString(ch, 16);
- retval.append("\\u" + s.substring(s.length() - 4, s.length()));
- } else {
- retval.append(ch);
- }
- continue;
- }
- }
- return retval.toString();
- }
-
- /**
- * Returns a detailed message for the Error when it is thrown by the
- * token manager to indicate a lexical error.
- * Parameters :
- * EOFSeen : indicates if EOF caused the lexicl error
- * curLexState : lexical state in which this error occured
- * errorLine : line number when the error occured
- * errorColumn : column number when the error occured
- * errorAfter : prefix that was seen before this error occured
- * curchar : the offending character
- * Note: You can customize the lexical error message by modifying this method.
- */
- protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
- return("Lexical error at line " +
- errorLine + ", column " +
- errorColumn + ". Encountered: " +
- (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
- "after : \"" + addEscapes(errorAfter) + "\"");
- }
-
- /**
- * You can also modify the body of this method to customize your error messages.
- * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
- * of end-users concern, so you can return something like :
- *
- * "Internal Error : Please file a bug report .... "
- *
- * from this method for such cases in the release version of your parser.
- */
- public String getMessage() {
- return super.getMessage();
- }
-
- /*
- * Constructors of various flavors follow.
- */
-
- public TokenMgrError() {
- }
-
- public TokenMgrError(String message, int reason) {
- super(message);
- errorCode = reason;
- }
-
- public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
- this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
- }
-}