fixed bug #1037094 (foreach)
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPSyntaxRdr.java
index b1a1371..dd1c5a4 100644 (file)
@@ -6,7 +6,6 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -29,7 +28,6 @@ import net.sourceforge.phpeclipse.phpeditor.php.PHPType;
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -122,14 +120,13 @@ public class PHPSyntaxRdr {
           }
         } catch (IOException e) {
         }
-      }
+      } 
     }
   }
   public static void readFromStream(InputStream stream) throws CoreException {
     try {
       DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
       DocumentBuilder parser = factory.newDocumentBuilder();
-      org.apache.crimson.parser.Parser2 pp;
       Document document = parser.parse(new InputSource(stream));
       //               Read in the Standard PHPSyntax "stuff"
       NodeList elements = document.getElementsByTagName(PHPSYNTAX_TAG);
@@ -168,7 +165,7 @@ public class PHPSyntaxRdr {
           } else if (Function != null) {
             syntaxdata.add(new PHPFunction(Function, usage, description));
           } else if (Constant != null) {
-            syntaxdata.add(new PHPConstant(Constant, usage));
+            syntaxdata.add(new PHPConstant(Constant, null, description));
           }
         }
       }
@@ -266,9 +263,12 @@ public class PHPSyntaxRdr {
           //      Attr usage = document.createAttribute(USAGE_ATTR);
           Text usage = document.createTextNode(((PHPFunction) bufferobj).getDescription());
           node.appendChild(usage);
-          //          usage.setValue(((PHPFunction) bufferobj).getUsage());
-          //          attributes.setNamedItem(usage);
         }
+        if (bufferobj instanceof PHPConstant) {
+            //      Attr usage = document.createAttribute(USAGE_ATTR);
+            Text usage = document.createTextNode(((PHPConstant) bufferobj).getDescription());
+            node.appendChild(usage);
+          }
       }
       Transformer transformer=TransformerFactory.newInstance().newTransformer();
                transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$