*** empty log message ***
[phpeclipse.git] / net.sourceforge.phpeclipse / src / test / PHPParser.jj
index c348a5e..00cc6c9 100644 (file)
@@ -456,8 +456,8 @@ MORE :
 {
   <OR_OR              : "||">
 | <AND_AND            : "&&">
-| <INCR               : "++">
-| <DECR               : "--">
+| <PLUS_PLUS          : "++">
+| <MINUS_MINUS        : "--">
 | <PLUS               : "+">
 | <MINUS              : "-">
 | <STAR               : "*">
@@ -1480,8 +1480,8 @@ final int operator;
   final int pos = SimpleCharStream.getPosition();
 }
 {
-  (  <INCR> {operator = OperatorIds.PLUS_PLUS;}
-   | <DECR> {operator = OperatorIds.MINUS_MINUS;})
+  (  <PLUS_PLUS> {operator = OperatorIds.PLUS_PLUS;}
+   | <MINUS_MINUS> {operator = OperatorIds.MINUS_MINUS;})
    expr = PrimaryExpression()
   {return new PrefixedUnaryExpression(expr,operator,pos);}
 }
@@ -1532,8 +1532,8 @@ Expression PostfixExpression() :
 }
 {
   expr = PrimaryExpression()
-  [ <INCR> {operator = OperatorIds.PLUS_PLUS;}
-  | <DECR> {operator = OperatorIds.MINUS_MINUS;}]
+  [ <PLUS_PLUS> {operator = OperatorIds.PLUS_PLUS;}
+  | <MINUS_MINUS> {operator = OperatorIds.MINUS_MINUS;}]
   {
     if (operator == -1) {
       return expr;
@@ -1567,6 +1567,11 @@ Expression PrimaryExpression() :
   {return expr;}
 }
 
+/**
+ * An array declarator.
+ * array(vars)
+ * @return an array
+ */
 ArrayInitializer ArrayDeclarator() :
 {
   final ArrayVariableDeclaration[] vars;
@@ -1591,9 +1596,10 @@ Expression PrimaryPrefix() :
 | <NEW> expr = ClassIdentifier() {return new PrefixedUnaryExpression(expr,
                                                                      OperatorIds.NEW,
                                                                      pos);}
-| var = VariableDeclaratorId()  {return new ConstantIdentifier(var.toCharArray(),
-                                                               pos,
-                                                               SimpleCharStream.getPosition());}
+| var = VariableDeclaratorId()  {return new VariableDeclaration(currentSegment,
+                                                                var.toCharArray(),
+                                                                pos,
+                                                                SimpleCharStream.getPosition());}
 }
 
 PrefixedUnaryExpression classInstantiation() :
@@ -2182,7 +2188,7 @@ EmptyStatement EmptyStatement() :
    return new EmptyStatement(pos-1,pos);}
 }
 
-Statement StatementExpression() :
+Expression StatementExpression() :
 {
   Expression expr,expr2;
   int operator;
@@ -2191,10 +2197,10 @@ Statement StatementExpression() :
   expr = PreIncDecExpression() {return expr;}
 |
   expr = PrimaryExpression()
-  [ <INCR> {return new PostfixedUnaryExpression(expr,
+  [ <PLUS_PLUS> {return new PostfixedUnaryExpression(expr,
                                                 OperatorIds.PLUS_PLUS,
                                                 SimpleCharStream.getPosition());}
-  | <DECR> {return new PostfixedUnaryExpression(expr,
+  | <MINUS_MINUS> {return new PostfixedUnaryExpression(expr,
                                                 OperatorIds.MINUS_MINUS,
                                                 SimpleCharStream.getPosition());}
   | operator = AssignmentOperator() expr2 = Expression()
@@ -2743,9 +2749,9 @@ ForStatement ForStatement() :
 {
 final Token token;
 final int pos = SimpleCharStream.getPosition();
-Statement[] initializations = null;
+Expression[] initializations = null;
 Expression condition = null;
-Statement[] increments = null;
+Expression[] increments = null;
 Statement action;
 final ArrayList list = new ArrayList();
 final int startBlock, endBlock;
@@ -2809,31 +2815,31 @@ final int startBlock, endBlock;
     )
 }
 
-Statement[] ForInit() :
+Expression[] ForInit() :
 {
-  Statement[] statements;
+  Expression[] exprs;
 }
 {
   LOOKAHEAD(LocalVariableDeclaration())
-  statements = LocalVariableDeclaration()
-  {return statements;}
+  exprs = LocalVariableDeclaration()
+  {return exprs;}
 |
-  statements = StatementExpressionList()
-  {return statements;}
+  exprs = StatementExpressionList()
+  {return exprs;}
 }
 
-Statement[] StatementExpressionList() :
+Expression[] StatementExpressionList() :
 {
   final ArrayList list = new ArrayList();
-  Statement expr;
+  Expression expr;
 }
 {
   expr = StatementExpression()   {list.add(expr);}
   (<COMMA> StatementExpression() {list.add(expr);})*
   {
-  Statement[] stmtsArray = new Statement[list.size()];
-  list.toArray(stmtsArray);
-  return stmtsArray;}
+  Expression[] exprsArray = new Expression[list.size()];
+  list.toArray(exprsArray);
+  return exprsArray;}
 }
 
 Continue ContinueStatement() :