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 junit.framework.Assert;
/**
* A new php parser.
private static void processParseException(final ParseException e) {
if (PARSER_DEBUG) {
e.printStackTrace();
- return;
+ Assert.assertTrue(false);
}
if (errorMessage == null) {
PHPeclipsePlugin.log(e);
}
}
- public final void parse(final String s) throws CoreException {
+ 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);
/**
* a strict variable declarator : there cannot be a suffix here.
+ * It will be used by fields and formal parameters
*/
VariableDeclaration VariableDeclaratorNoSuffix() :
{
}
}
+/**
+ * this will be used by static statement
+ */
VariableDeclaration VariableDeclarator() :
{
final String varName;
[
assignOperator = AssignmentOperator()
try {
- initializer = ConditionalExpression()
+ initializer = Expression()
} catch (ParseException e) {
if (errorMessage != null) {
throw e;
Expression ExpressionNoBang() :
{
- Expression expr = null;
- int assignOperator = -1;
- String var;
- final int pos = SimpleCharStream.getPosition();
+ Expression expr;
}
{
expr = PrintExpression() {return expr;}
<BIT_AND> expr = UnaryExpressionNoPrefix()
{return new PrefixedUnaryExpression(expr,OperatorIds.AND,pos);}
|
- expr = AtUnaryExpression() {return expr;}
+ expr = AtNotUnaryExpression() {return expr;}
}
-Expression AtUnaryExpression() :
+/**
+ * An expression prefixed (or not) by one or more @ and !.
+ * @return the expression
+ */
+Expression AtNotUnaryExpression() :
{
final Expression expr;
final int pos = SimpleCharStream.getPosition();
}
{
<AT>
- expr = AtUnaryExpression()
+ expr = AtNotUnaryExpression()
{return new PrefixedUnaryExpression(expr,OperatorIds.AT,pos);}
|
+ <BANG>
+ expr = AtNotUnaryExpression()
+ {return new PrefixedUnaryExpression(expr,OperatorIds.NOT,pos);}
+|
expr = UnaryExpressionNoPrefix()
{return expr;}
}
|
expr = UnaryExpressionNotPlusMinus()
{return expr;}
+/*|
+ LOOKAHEAD(2)
+ expr = PrintExpression() {return expr;}*/
}
return statement;}
}
+/**
+ * used only by ForInit()
+ */
VariableDeclaration[] LocalVariableDeclaration() :
{
final ArrayList list = new ArrayList();
return vars;}
}
+/**
+ * used only by LocalVariableDeclaration().
+ */
VariableDeclaration LocalVariableDeclarator() :
{
final String varName;
return new EmptyStatement(pos-1,pos);}
}
+/**
+ * used only by StatementExpressionList() which is used only by ForInit() and ForStatement()
+ */
Expression StatementExpression() :
{
final Expression expr,expr2;