improved PHP parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / phpeditor / PHPSyntaxRdr.java
index dd1c5a4..fb51811 100644 (file)
@@ -44,17 +44,17 @@ import org.xml.sax.SAXParseException;
  */
 
 public class PHPSyntaxRdr {
-  private static final String PHPDEFAULT_FILE = "default-phpsyntax.xml"; //$NON-NLS-1$
-  private static final String PHPSYNTAX_FILE = "phpsyntax.xml"; //$NON-NLS-1$
-  private static final String USERSYNTAX_FILE = "usersyntax.xml"; //$NON-NLS-1$
-  private static final String USERDEFAULT_FILE = "default-usersyntax.xml"; //$NON-NLS-1$
-  private static final String PHPSYNTAX_TAG = "phpsyntax"; //$NON-NLS-1$
-  private static final String KEYWORD_ATTR = "keyword"; //$NON-NLS-1$
-  private static final String TYPE_ATTR = "type"; //$NON-NLS-1$
-  private static final String CONSTANT_ATTR = "constant"; //$NON-NLS-1$
-  private static final String FN_ATTR = "function"; //$NON-NLS-1$
-  private static final String USAGE_ATTR = "usage"; //$NON-NLS-1$
-  private static final String TOKENVAL_ATTR = "tokenval"; //$NON-NLS-1$
+//  private static final String PHPDEFAULT_FILE = "default-syntax.xml"; //$NON-NLS-1$
+  private static final String PHPSYNTAX_FILE = "syntax.xml"; //$NON-NLS-1$
+//  private static final String USERSYNTAX_FILE = "usersyntax.xml"; //$NON-NLS-1$
+//  private static final String USERDEFAULT_FILE = "default-usersyntax.xml"; //$NON-NLS-1$
+  private static final String PHPSYNTAX_TAG = "s"; //$NON-NLS-1$
+  private static final String KEYWORD_ATTR = "k"; //$NON-NLS-1$
+  private static final String TYPE_ATTR = "t"; //$NON-NLS-1$
+  private static final String CONSTANT_ATTR = "c"; //$NON-NLS-1$
+  private static final String FN_ATTR = "f"; //$NON-NLS-1$
+  private static final String USAGE_ATTR = "u"; //$NON-NLS-1$
+//  private static final String TOKENVAL_ATTR = "tokenval"; //$NON-NLS-1$
   private static IPreferenceStore store;
   private static boolean hasXMLFileBeenRead = true;
 
@@ -144,7 +144,7 @@ public class PHPSyntaxRdr {
         String Function = getAttributeValue(attributes, FN_ATTR);
         String Constant = getAttributeValue(attributes, CONSTANT_ATTR);
         String usage = getAttributeValue(attributes, USAGE_ATTR);
-        String Tokenval = getAttributeValue(attributes, TOKENVAL_ATTR);
+//        String Tokenval = getAttributeValue(attributes, TOKENVAL_ATTR);
       
         StringBuffer buffer = new StringBuffer();
         NodeList children = node.getChildNodes();
@@ -159,7 +159,8 @@ public class PHPSyntaxRdr {
           //ignore as it is not a valid phpsyntax tag
         } else {
           if (Keyword != null) {
-            syntaxdata.add(new PHPKeyword(Keyword, usage, Tokenval));
+//            syntaxdata.add(new PHPKeyword(Keyword, usage, Tokenval));
+            syntaxdata.add(new PHPKeyword(Keyword, usage));
           } else if (Type != null) {
             syntaxdata.add(new PHPType(Type, usage));
           } else if (Function != null) {
@@ -254,11 +255,11 @@ public class PHPSyntaxRdr {
         Attr description = document.createAttribute(USAGE_ATTR);
         description.setValue(((PHPElement) bufferobj).getUsage());
         attributes.setNamedItem(description);
-        if (bufferobj instanceof PHPKeyword) {
-          Attr tokenval = document.createAttribute(TOKENVAL_ATTR);
-          tokenval.setValue((new Integer(((PHPKeyword) bufferobj).gettokenval())).toString());
-          attributes.setNamedItem(tokenval);
-        }
+//        if (bufferobj instanceof PHPKeyword) {
+//          Attr tokenval = document.createAttribute(TOKENVAL_ATTR);
+//          tokenval.setValue((new Integer(((PHPKeyword) bufferobj).gettokenval())).toString());
+//          attributes.setNamedItem(tokenval);
+//        }
         if (bufferobj instanceof PHPFunction) {
           //      Attr usage = document.createAttribute(USAGE_ATTR);
           Text usage = document.createTextNode(((PHPFunction) bufferobj).getDescription());