Added failing test. This throws a Class cats exception. This is a bug
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / sql / SQLParser.java
index fc31429..67545f4 100644 (file)
@@ -2,45 +2,42 @@ package net.sourceforge.phpdt.sql.sql;
 
 import java.util.Vector;
 
-import net.sourceforge.phpdt.sql.IConstants;
-import net.sourceforge.phpdt.sql.parser.SQLLexx;
-import net.sourceforge.phpdt.sql.parser.Token;
+import net.sourceforge.phpdt.sql.sql.parser.SQLLexx;
+import net.sourceforge.phpdt.sql.sql.parser.Token;
 
-public class SQLParser implements IConstants {
-  public static final String COMMENT = "--";
-  public static final String ENDLINE = ";";
-  public static Vector parse(String query) {
-    Vector commands = new Vector();
-    try {
-      //System.out.println("-------------------1");
-      Vector tokens = SQLLexx.parse(query);
-      //System.out.println("-------------------2");
-      StringBuffer buffer = new StringBuffer();
-      for (int i = 0; i < tokens.size(); i++) {
-        //System.out.println("-------------------3");
-        Token t = (Token) tokens.elementAt(i);
-        if (t.getType() == t.COMMENT) {
-          // ignore comments
-        } else if (t.getType() == t.SEPARATOR) {
-          String newCommand = buffer.toString().trim();
-          if (!newCommand.equals("")) {
-            commands.addElement(newCommand);
-          }
-          buffer = new StringBuffer();
-        } else {
-          buffer.append(t.getValue());
-        }
-      }
-      String newCommand = buffer.toString().trim();
-      if (!newCommand.equals("")) {
-        commands.addElement(newCommand);
-      }
-    } catch (Throwable e) {
-      e.printStackTrace();
-    }
-    if (DEBUG) {
-      System.out.println("Returning");
-    }
-    return commands;
-  }
+public class SQLParser {
+       public static final String COMMENT = "--"; //$NON-NLS-1$
+       public static final String ENDLINE = ";"; //$NON-NLS-1$
+       public static Vector parse(String query) {
+                       Vector commands = new Vector();
+               try {
+               //System.out.println("-------------------1");
+                       Vector tokens = SQLLexx.parse(query);
+               //System.out.println("-------------------2");
+                       StringBuffer buffer = new StringBuffer();
+                       for (int i = 0; i < tokens.size(); i++) {
+               //System.out.println("-------------------3");
+                               Token t = (Token) tokens.elementAt(i);
+                               if (t.getType() == Token.COMMENT) {
+                                       // ignore comments
+                               } else if (t.getType() == Token.SEPARATOR) {
+                                       String newCommand = buffer.toString().trim();
+                                       if (!newCommand.equals("")) { //$NON-NLS-1$
+                                               commands.addElement(newCommand);
+                                       }
+                                       buffer = new StringBuffer();
+                               } else {
+                                       buffer.append(t.getValue());
+                               }
+                       }
+                       String newCommand = buffer.toString().trim();
+                       if (!newCommand.equals("")) { //$NON-NLS-1$
+                               commands.addElement(newCommand);
+                       }
+               } catch (Throwable e) {
+                       e.printStackTrace();
+               }
+               System.out.println("Returning"); //$NON-NLS-1$
+                       return commands;
+       }
 }
\ No newline at end of file