add some actions to phpconsole
[phpeclipse.git] / net.sourceforge.phpeclipse / src / test / PHPParser.jj
index 823b11e..44e28d2 100644 (file)
@@ -757,12 +757,12 @@ ClassDeclaration ClassDeclaration() :
     if (superclassName == null) {
       classDeclaration = new ClassDeclaration(currentSegment,
                                               className.image.toCharArray(),
-                                              superclassName.image.toCharArray(),
                                               pos,
                                               0);
     } else {
       classDeclaration = new ClassDeclaration(currentSegment,
                                               className.image.toCharArray(),
+                                              superclassName.image.toCharArray(),
                                               pos,
                                               0);
     }
@@ -819,22 +819,21 @@ void ClassBodyDeclaration(ClassDeclaration classDeclaration) :
 FieldDeclaration FieldDeclaration() :
 {
   VariableDeclaration variableDeclaration;
+  final ArrayList list = new ArrayList();
+  final int pos = SimpleCharStream.getPosition();
 }
 {
   <VAR> variableDeclaration = VariableDeclarator()
   {
+    list.add(variableDeclaration);
     outlineInfo.addVariable(new String(variableDeclaration.name));
-    if (currentSegment != null) {
-      currentSegment.add(variableDeclaration);
-    }
+    currentSegment.add(variableDeclaration);
   }
   ( <COMMA>
       variableDeclaration = VariableDeclarator()
-      {
-      if (currentSegment != null) {
-        currentSegment.add(variableDeclaration);
-      }
-      }
+      {list.add(variableDeclaration);
+       outlineInfo.addVariable(new String(variableDeclaration.name));
+       currentSegment.add(variableDeclaration);}
   )*
   try {
     <SEMICOLON>
@@ -845,6 +844,9 @@ FieldDeclaration FieldDeclaration() :
     errorEnd   = jj_input_stream.getPosition() + 1;
     throw e;
   }
+  {return new FieldDeclaration((VariableDeclaration[]) list.toArray(),
+                               pos,
+                               SimpleCharStream.getPosition());}
 }
 
 VariableDeclaration VariableDeclarator() :
@@ -867,10 +869,18 @@ VariableDeclaration VariableDeclarator() :
       throw e;
     }
   ]
-  {return new VariableDeclaration(currentSegment,
+  {
+  if (initializer == null) {
+    return new VariableDeclaration(currentSegment,
                                   varName.toCharArray(),
-                                  initializer,
-                                  pos);}
+                                  pos,
+                                  jj_input_stream.getPosition());
+  }
+    return new VariableDeclaration(currentSegment,
+                                    varName.toCharArray(),
+                                    initializer,
+                                    pos);
+  }
 }
 
 /**
@@ -2139,12 +2149,23 @@ VariableDeclaration[] LocalVariableDeclaration() :
 VariableDeclaration LocalVariableDeclarator() :
 {
   final String varName;
-  Expression init = null;
+  Expression initializer = null;
   final int pos = SimpleCharStream.getPosition();
 }
 {
-  varName = VariableDeclaratorId() [ <ASSIGN> init = Expression() ]
-  {return new VariableDeclaration(varName.toCharArray(),init,pos);}
+  varName = VariableDeclaratorId() [ <ASSIGN> initializer = Expression() ]
+  {
+   if (initializer == null) {
+    return new VariableDeclaration(currentSegment,
+                                  varName.toCharArray(),
+                                  pos,
+                                  jj_input_stream.getPosition());
+   }
+    return new VariableDeclaration(currentSegment,
+                                    varName.toCharArray(),
+                                    initializer,
+                                    pos);
+  }
 }
 
 EmptyStatement EmptyStatement() :