Far better but not finished, it will now get function and class declaration in outline
[phpeclipse.git] / net.sourceforge.phpeclipse / src / test / PHPParser.java
index f23c733..a6b5489 100644 (file)
@@ -7,7 +7,6 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.ui.texteditor.MarkerUtilities;
 import org.eclipse.jface.preference.IPreferenceStore;
 
-import java.io.CharArrayReader;
 import java.util.Hashtable;
 import java.io.StringReader;
 import java.text.MessageFormat;
@@ -84,7 +83,7 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       jj_input_stream = new SimpleCharStream(stream, 1, 1);
     }
     ReInit(stream);
-    phpTest();
+    phpFile();
   }
 
   public PHPOutlineInfo parseInfo(Object parent, String s) {
@@ -253,16 +252,16 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     label_1:
     while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case 1:
+      case PHPSTART:
         ;
         break;
       default:
         jj_la1[0] = jj_gen;
         break label_1;
       }
-      jj_consume_token(1);
+      jj_consume_token(PHPSTART);
       Php();
-      jj_consume_token(128);
+      jj_consume_token(PHPEND);
     }
     jj_consume_token(0);
   }
@@ -1430,8 +1429,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[59] = jj_gen;
@@ -1520,8 +1519,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[61] = jj_gen;
@@ -1536,8 +1535,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[62] = jj_gen;
@@ -1552,8 +1551,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[63] = jj_gen;
@@ -1568,8 +1567,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[64] = jj_gen;
@@ -1610,8 +1609,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[67] = jj_gen;
@@ -1645,8 +1644,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     case SEMICOLON:
       jj_consume_token(SEMICOLON);
       break;
-    case 128:
-      jj_consume_token(128);
+    case 127:
+      jj_consume_token(127);
       break;
     default:
       jj_la1[69] = jj_gen;
@@ -1675,8 +1674,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     case SEMICOLON:
       jj_consume_token(SEMICOLON);
       break;
-    case 128:
-      jj_consume_token(128);
+    case 127:
+      jj_consume_token(127);
       break;
     default:
       jj_la1[71] = jj_gen;
@@ -2088,8 +2087,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[84] = jj_gen;
@@ -2151,8 +2150,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     case SEMICOLON:
       jj_consume_token(SEMICOLON);
       break;
-    case 128:
-      jj_consume_token(128);
+    case 127:
+      jj_consume_token(127);
       break;
     default:
       jj_la1[86] = jj_gen;
@@ -2977,7 +2976,7 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
   }
 
   static final private boolean jj_3R_39() {
-    if (jj_scan_token(128)) return true;
+    if (jj_scan_token(127)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
     return false;
   }
@@ -3771,11 +3770,10 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
   static private boolean jj_semLA;
   static private int jj_gen;
   static final private int[] jj_la1 = new int[95];
-  static final private int[] jj_la1_0 = {0x2,0xff960000,0x0,0xc0000,0xc0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x1800000,0x0,0x0,0xfe900000,0x0,0x0,0x0,0x0,0x3c000000,0x0,0x0,0x0,0x0,0x0,0x0,0xff960000,0xff960000,0x0,0x0,0x0,0x800000,0x0,0xff960000,0x0,0x200000,0x400000,0xff900000,0x0,0xff900000,0x0,0x800000,0x1800000,0x800000,0x800000,0x0,0x0,0x0,0x1800000,};
-  static final private int[] jj_la1_1 = {0x0,0x1aed48,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x86400,0x0,0x0,0x0,0x0,0x0,0x7f400000,0x0,0x86400,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x86400,0x0,0x86400,0x0,0x0,0x1,0x1,0x2000,0x2000,0x0,0x1,0x86400,0x1,0x84400,0x80400,0x86400,0x0,0x0,0x12a948,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1aed48,0x1aed48,0x0,0x0,0x0,0x2000,0x90,0x1aed48,0x90,0x0,0x0,0x1aed48,0x0,0x1aed48,0x0,0x2000,0x86400,0x2000,0x2000,0x0,0x0,0x0,0x86400,};
-  static final private int[] jj_la1_2 = {0x0,0x232288a2,0x0,0x0,0x0,0x400000,0x4000000,0x20000,0x2000000,0x20000,0x2020800,0x0,0x230088a2,0x220000,0x0,0x400000,0x2000000,0x0,0x0,0x4000000,0x230088a2,0x4000000,0x40000000,0x0,0x0,0x1,0x1,0x800000,0x0,0x0,0x0,0x0,0x0,0x18000000,0x18000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x230088a2,0x20000000,0x20088a2,0x0,0x0,0x88000,0x88000,0x2000800,0x2000800,0x2000800,0x88000,0x230088a2,0x80000,0xa2,0x0,0x230088a2,0x400000,0x200000,0x2220800,0x200000,0x200000,0x200000,0x200000,0x0,0x400000,0x200000,0x400000,0x200000,0x400000,0x200000,0x232288a2,0x232288a2,0x400000,0x4000000,0x4000000,0x2000800,0x0,0x232288a2,0x0,0x0,0x0,0x232288a2,0x200000,0xa32288a2,0x200000,0x2000800,0x230088a2,0x2000800,0x2000800,0x400000,0x800,0x800,0x230088a2,};
-  static final private int[] jj_la1_3 = {0x0,0x800003c0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x800003c0,0x0,0x1000,0x0,0x80001000,0x1000,0x0,0x7ff80000,0x800003c0,0x7ff80000,0x0,0x10,0x10,0x20,0x20,0x0,0x2000,0x4000,0x1000,0x9,0x9,0x6,0x6,0x70000,0x70000,0x300,0x300,0x8c00,0x8c00,0x300,0x800003c0,0x0,0x80000000,0xc0,0xc0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x800003c0,0x0,0x0,0x0,0x800003c0,0x0,0x0,0x800000c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800003c0,0x800003c0,0x0,0x7ff800c0,0x7ff800c0,0x800000c0,0x0,0x800003c0,0x0,0x0,0x0,0x800003c0,0x0,0x800003c0,0x0,0x800000c0,0x800003c0,0x800000c0,0x800000c0,0x0,0x0,0x0,0x800003c0,};
-  static final private int[] jj_la1_4 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+  static final private int[] jj_la1_0 = {0x2,0x7fcb0000,0x0,0x60000,0x60000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x400000,0x0,0x0,0x80000000,0x80000000,0x400000,0x0,0x0,0x80000000,0xc00000,0x80000000,0x0,0x0,0xc00000,0x0,0x0,0x7f480000,0x0,0x0,0x0,0x0,0x1e000000,0x0,0x0,0x0,0x0,0x0,0x0,0x7fcb0000,0x7fcb0000,0x0,0x0,0x0,0x400000,0x0,0x7fcb0000,0x0,0x100000,0x200000,0x7fc80000,0x0,0x7fc80000,0x0,0x400000,0xc00000,0x400000,0x400000,0x0,0x0,0x0,0xc00000,};
+  static final private int[] jj_la1_1 = {0x0,0xd76a4,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x43200,0x0,0x0,0x0,0x0,0x0,0x3fa00000,0x0,0x43200,0x0,0x0,0x40000000,0x40000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x43200,0x0,0x43200,0x0,0x0,0x0,0x0,0x1000,0x1000,0x0,0x0,0x43200,0x0,0x42200,0x40200,0x43200,0x0,0x0,0x954a4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd76a4,0xd76a4,0x0,0x0,0x0,0x1000,0x48,0xd76a4,0x48,0x0,0x0,0xd76a4,0x0,0xd76a4,0x0,0x1000,0x43200,0x1000,0x1000,0x0,0x0,0x0,0x43200,};
+  static final private int[] jj_la1_2 = {0x0,0x11914451,0x0,0x0,0x0,0x200000,0x2000000,0x10000,0x1000000,0x10000,0x1010400,0x0,0x11804451,0x110000,0x0,0x200000,0x1000000,0x0,0x0,0x2000000,0x11804451,0x2000000,0x20000000,0x0,0x0,0x0,0x0,0x400000,0x0,0x0,0x0,0x80000000,0x80000000,0xc000000,0xc000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x11804451,0x10000000,0x1004451,0x0,0x0,0x44000,0x44000,0x1000400,0x1000400,0x1000400,0x44000,0x11804451,0x40000,0x51,0x0,0x11804451,0x200000,0x100000,0x1110400,0x100000,0x100000,0x100000,0x100000,0x0,0x200000,0x100000,0x200000,0x100000,0x200000,0x100000,0x11914451,0x11914451,0x200000,0x2000000,0x2000000,0x1000400,0x0,0x11914451,0x0,0x0,0x0,0x11914451,0x100000,0x51914451,0x100000,0x1000400,0x11804451,0x1000400,0x1000400,0x200000,0x400,0x400,0x11804451,};
+  static final private int[] jj_la1_3 = {0x0,0x400001e0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x0,0x400001e0,0x0,0x800,0x0,0x40000800,0x800,0x0,0x3ffc0000,0x400001e0,0x3ffc0000,0x0,0x8,0x8,0x10,0x10,0x0,0x1000,0x2000,0x800,0x4,0x4,0x3,0x3,0x38000,0x38000,0x180,0x180,0x4600,0x4600,0x180,0x400001e0,0x0,0x40000000,0x60,0x60,0x0,0x0,0x40000000,0x40000000,0x40000000,0x0,0x400001e0,0x0,0x0,0x0,0x400001e0,0x0,0x80000000,0x40000060,0x80000000,0x80000000,0x80000000,0x80000000,0x0,0x0,0x80000000,0x0,0x80000000,0x0,0x80000000,0x400001e0,0x400001e0,0x0,0x3ffc0060,0x3ffc0060,0x40000060,0x0,0x400001e0,0x0,0x0,0x0,0x400001e0,0x80000000,0x400001e0,0x80000000,0x40000060,0x400001e0,0x40000060,0x40000060,0x0,0x0,0x0,0x400001e0,};
   static final private JJCalls[] jj_2_rtns = new JJCalls[7];
   static private boolean jj_rescan = false;
   static private int jj_gc = 0;
@@ -3962,8 +3960,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
 
   static final public ParseException generateParseException() {
     jj_expentries.removeAllElements();
-    boolean[] la1tokens = new boolean[129];
-    for (int i = 0; i < 129; i++) {
+    boolean[] la1tokens = new boolean[128];
+    for (int i = 0; i < 128; i++) {
       la1tokens[i] = false;
     }
     if (jj_kind >= 0) {
@@ -3985,13 +3983,10 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
           if ((jj_la1_3[i] & (1<<j)) != 0) {
             la1tokens[96+j] = true;
           }
-          if ((jj_la1_4[i] & (1<<j)) != 0) {
-            la1tokens[128+j] = true;
-          }
         }
       }
     }
-    for (int i = 0; i < 129; i++) {
+    for (int i = 0; i < 128; i++) {
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;