PageRenderTime 193ms CodeModel.GetById 61ms app.highlight 95ms RepoModel.GetById 25ms app.codeStats 1ms

/bundles/plugins-trunk/XML/xml/parser/javacc/XmlParser.java

#
Java | 722 lines | 646 code | 53 blank | 23 comment | 147 complexity | 4eedb48f9c619ce025eee898440f4637 MD5 | raw file
  1/* Generated By:JavaCC: Do not edit this line. XmlParser.java */
  2package xml.parser.javacc;
  3
  4import java.text.MessageFormat;
  5import java.util.*;
  6import java.util.regex.*;
  7import sidekick.util.*;
  8import java.io.Reader;
  9
 10public class XmlParser implements XmlParserConstants {
 11
 12  static String NL = System.getProperty("line.separator");
 13
 14  private List<ParseError> parseErrors = new ArrayList<ParseError>();
 15
 16  public void setLineSeparator(String ls) {
 17    NL = ls;
 18  }
 19
 20  private static String getTokenText(Token first, Token cur) {
 21    Token t;
 22    StringBuffer sb = new StringBuffer();
 23
 24    for (t=first; t != cur.next; t = t.next) {
 25      if (t.specialToken != null) {
 26        Token tt=t.specialToken;
 27        while (tt.specialToken != null)
 28          tt = tt.specialToken;
 29        for (; tt != null; tt = tt.next)
 30          sb.append(tt.image);
 31      };
 32      sb.append(t.image);
 33    };
 34    return sb.toString();
 35  }
 36
 37  /**
 38  * The line offset is used when the XML to be parsed is only part of a file,
 39  * @param lineOffset The line number of the first line of the fragment.
 40  * @param columnOffset The column number of the first character of the fragment.
 41  */
 42  public XmlParser(Reader in, int lineOffset, int columnOffset){
 43        this(in);
 44        jj_input_stream.ReInit(in,lineOffset,columnOffset);
 45  }
 46
 47  public static void main(String[] args) throws ParseException {
 48    XmlParser parser = new XmlParser(System.in);
 49    XmlDocument doc = parser.XmlDocument();
 50    doc.accept(new XmlDebugDumper(System.out));
 51    System.exit(0);
 52  }
 53
 54   public void setTabSize(int size) {
 55        jj_input_stream.setTabSize(size);
 56   }
 57
 58   public int getTabSize() {
 59        return jj_input_stream.getTabSize(0);
 60   }
 61
 62    private void addException(ParseException pe) {
 63        Range range = getExceptionLocation( pe );
 64        parseErrors.add(new ParseError(pe.getMessage(), range));
 65        pe.printStackTrace();
 66    }
 67
 68    public List<ParseError> getParseErrors() {
 69       System.out.println("getParserErrors, there are " + parseErrors.size() + " errors");
 70       return parseErrors;
 71    }
 72
 73    // regex to extract line and colun from a ParseException message
 74    // ParseException message look like: "Parse error at line 116, column 5.  Encountered: }"
 75    private Pattern pePattern = Pattern.compile( "(.*?)(\\d+)(.*?)(\\d+)(.*?)" );
 76
 77    /**
 78     * @return attempts to return a Location indicating the location of a parser
 79     * exception.  If the ParseException contains a Token reference, all is well,
 80     * otherwise, this method attempts to parse the message string for the
 81     * exception.
 82     */
 83    private Range getExceptionLocation( ParseException pe ) {
 84        Token t = pe.currentToken;
 85        if ( t != null ) {
 86            return new Range( new Location( t.next.beginLine - 1, t.next.beginColumn ), new Location( t.next.endLine - 1, t.next.endColumn ) );
 87        }
 88
 89        // ParseException message look like: "Parse error at line 116, column 5.  Encountered: }"
 90        try {
 91            Matcher m = pePattern.matcher( pe.getMessage() );
 92            if ( m.matches() ) {
 93                String ln = m.group( 2 );
 94                String cn = m.group( 4 );
 95                int line_number = -1;
 96                int column_number = 0;
 97                if ( ln != null )
 98                    line_number = Integer.parseInt( ln );
 99                if ( cn != null )
100                    column_number = Integer.parseInt( cn );
101                return line_number > -1 ? new Range( new Location( line_number - 1, column_number - 1 ), new Location( line_number - 1, column_number ) ) : null;
102            }
103            return new Range();
104        }
105        catch ( Exception e ) {
106            //e.printStackTrace();
107            return new Range();
108        }
109    }
110
111    // regex pattern for a valid non-quoted attribute.
112    // Attributes can be single or double quoted, or consist solely of
113    // letters in the range A-Z and a-z, digits (0-9), hyphens ("-"),
114    // and periods (".")
115    private Pattern attributePattern = Pattern.compile( "([a-zA-Z0-9.-])*" );
116    private boolean isProperAttribute(String s) {
117        // could have double quotes
118        if (s.startsWith("\"") && s.endsWith("\"")) {
119            return true;
120        }
121        // or single quotes
122        else if (s.startsWith("'") && s.endsWith("'")) {
123            return true;
124        }
125        // or might be jsp
126        else if (s.startsWith("<%") && (s.endsWith("%>") || s.endsWith("%")) ) {
127            return true;
128        }
129        boolean rtn = attributePattern.matcher(s).matches();
130        if (rtn == false) {
131            System.out.println("bad attribute: " + s);
132        }
133        return rtn;
134    }
135
136  final public XmlDocument XmlDocument() throws ParseException {
137  XmlDocument.ElementSequence s;
138    s = ElementSequence();
139    jj_consume_token(0);
140    {if (true) return new XmlDocument(s);}
141    throw new Error("Missing return statement in function");
142  }
143
144  final public XmlDocument.ElementSequence ElementSequence() throws ParseException {
145  XmlDocument.ElementSequence s = new XmlDocument.ElementSequence();
146  XmlDocument.XmlElement h;
147    label_1:
148    while (true) {
149      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
150      case EOL:
151      case COMMENT_START:
152      case ENDTAG_START:
153      case TAG_START:
154      case DECL_START:
155      case PCDATA:
156        ;
157        break;
158      default:
159        jj_la1[0] = jj_gen;
160        break label_1;
161      }
162      h = Element();
163                  s.addElement(h);
164    }
165    {if (true) return s;}
166    throw new Error("Missing return statement in function");
167  }
168
169  final public XmlDocument.XmlElement Element() throws ParseException {
170  XmlDocument.XmlElement e;
171  Token text;
172    if (jj_2_1(2)) {
173      e = Tag();
174                            {if (true) return e;}
175    } else {
176      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
177      case ENDTAG_START:
178        e = EndTag();
179                            {if (true) return e;}
180        break;
181      case COMMENT_START:
182        e = CommentTag();
183                            {if (true) return e;}
184        break;
185      case DECL_START:
186        e = DeclTag();
187                            {if (true) return e;}
188        break;
189      default:
190        jj_la1[1] = jj_gen;
191        if (jj_2_2(2)) {
192          jj_consume_token(TAG_START);
193          text = jj_consume_token(LST_ERROR);
194                            {if (true) return new XmlDocument.Text("<" + text.image);}
195        } else {
196          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
197          case PCDATA:
198            text = jj_consume_token(PCDATA);
199                            {if (true) return new XmlDocument.Text(text.image);}
200            break;
201          case EOL:
202            jj_consume_token(EOL);
203                            {if (true) return new XmlDocument.Newline();}
204            break;
205          default:
206            jj_la1[2] = jj_gen;
207            jj_consume_token(-1);
208            throw new ParseException();
209          }
210        }
211      }
212    }
213    throw new Error("Missing return statement in function");
214  }
215
216  final public XmlDocument.Attribute Attribute() throws ParseException {
217  XmlDocument.Attribute a;
218  Token t1, t2=null;
219    try {
220      t1 = jj_consume_token(ATTR_NAME);
221      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
222      case ATTR_EQ:
223        jj_consume_token(ATTR_EQ);
224        t2 = jj_consume_token(ATTR_VAL);
225        break;
226      default:
227        jj_la1[3] = jj_gen;
228        ;
229      }
230        if (t2 == null) {
231          a = new XmlDocument.Attribute(t1.image);
232          a.setStartLocation(t1.beginLine, t1.beginColumn);
233          a.setEndLocation(t1.endLine, t1.endColumn + 1);
234      }
235        else {
236          a = new XmlDocument.Attribute(t1.image, t2.image);
237          a.setStartLocation(t1.beginLine, t1.beginColumn);
238          a.setValueStartLocation(t2.beginLine,t2.beginColumn);
239          a.setEndLocation(t2.endLine, t2.endColumn + 1);
240          if (!isProperAttribute(t2.image)) {
241           ParseException e = new ParseException("Parse error at line " + t2.beginLine + ", column " + t2.beginColumn + ".  Attribute is improperly quoted." );
242           addException(e);
243          }
244        }
245
246         {if (true) return a;}
247    } catch (ParseException e) {
248        addException(e);
249        {if (true) return null;}
250    }
251    throw new Error("Missing return statement in function");
252  }
253
254  final public XmlDocument.AttributeList AttributeList() throws ParseException {
255  XmlDocument.AttributeList alist = new XmlDocument.AttributeList();
256  XmlDocument.Attribute a;
257    label_2:
258    while (true) {
259      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
260      case ATTR_NAME:
261        ;
262        break;
263      default:
264        jj_la1[4] = jj_gen;
265        break label_2;
266      }
267      a = Attribute();
268                   alist.addAttribute(a);
269    }
270    {if (true) return alist;}
271    throw new Error("Missing return statement in function");
272  }
273
274  final public XmlDocument.XmlElement Tag() throws ParseException {
275  Token t, et;
276  XmlDocument.AttributeList alist;
277  Token firstToken = getToken(1);
278  Token st = null;
279    try {
280      st = jj_consume_token(TAG_START);
281      t = jj_consume_token(TAG_NAME);
282      alist = AttributeList();
283      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
284      case TAG_END:
285        et = jj_consume_token(TAG_END);
286        break;
287      case TAG_SLASHEND:
288        et = jj_consume_token(TAG_SLASHEND);
289        break;
290      default:
291        jj_la1[5] = jj_gen;
292        jj_consume_token(-1);
293        throw new ParseException();
294      }
295        String tag_start = "<";
296        String tag_name = "";
297        if (st.image.startsWith("<") && st.image.endsWith(":")) {
298            tag_start = "<";
299            tag_name = st.image.substring(1) + t.image;
300        }
301        else {
302            tag_name = t.image;
303        }
304      XmlDocument.Tag rtn_tag = new XmlDocument.Tag(tag_start, tag_name, alist, et.image);
305      if (et.kind == TAG_SLASHEND) {
306          rtn_tag.setEmpty(true);
307      }
308      rtn_tag.setStartLocation(st.beginLine, st.beginColumn);
309      rtn_tag.setEndLocation(et.endLine, et.endColumn + 1);
310      {if (true) return rtn_tag;}
311    } catch (ParseException ex) {
312      addException(ex);
313    token_source.SwitchTo(DEFAULT);
314    String s = getTokenText(firstToken, getNextToken());
315    {if (true) return new XmlDocument.Text(s);}
316    }
317    throw new Error("Missing return statement in function");
318  }
319
320  final public XmlDocument.XmlElement EndTag() throws ParseException {
321  Token t;
322  Token firstToken = getToken(1);
323  Token st, et;
324    try {
325      st = jj_consume_token(ENDTAG_START);
326      t = jj_consume_token(TAG_NAME);
327      et = jj_consume_token(TAG_END);
328        String tag_name = "";
329        if (st.image.startsWith("</") && st.image.endsWith(":")) {
330            tag_name = st.image.substring(2) + t.image;
331        }
332        else
333            tag_name = t.image;
334        XmlDocument.EndTag b = new XmlDocument.EndTag(tag_name);
335        b.setStartLocation(st.beginLine, st.beginColumn);
336        b.setEndLocation(et.endLine, et.endColumn + 1);
337        {if (true) return b;}
338    } catch (ParseException ex) {
339    addException(ex);
340    token_source.SwitchTo(DEFAULT);
341    String s = getTokenText(firstToken, getNextToken());
342    {if (true) return new XmlDocument.Text(s);}
343    }
344    throw new Error("Missing return statement in function");
345  }
346
347  final public XmlDocument.Comment CommentTag() throws ParseException {
348  Token t, comment_start, comment_end = null;
349  StringBuffer s = new StringBuffer();
350    try {
351      comment_start = jj_consume_token(COMMENT_START);
352      label_3:
353      while (true) {
354        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
355        case DASH:
356        case COMMENT_EOL:
357        case COMMENT_WORD:
358          ;
359          break;
360        default:
361          jj_la1[6] = jj_gen;
362          break label_3;
363        }
364        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
365        case DASH:
366          t = jj_consume_token(DASH);
367                       s.append(t.image);
368          break;
369        case COMMENT_EOL:
370          jj_consume_token(COMMENT_EOL);
371                               s.append(NL);
372          break;
373        case COMMENT_WORD:
374          t = jj_consume_token(COMMENT_WORD);
375                                 s.append(t.image);
376          break;
377        default:
378          jj_la1[7] = jj_gen;
379          jj_consume_token(-1);
380          throw new ParseException();
381        }
382      }
383      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
384      case 0:
385        jj_consume_token(0);
386        break;
387      case COMMENT_END:
388        comment_end = jj_consume_token(COMMENT_END);
389        break;
390      default:
391        jj_la1[8] = jj_gen;
392        jj_consume_token(-1);
393        throw new ParseException();
394      }
395            {if (true) return new XmlDocument.Comment(comment_start.image + s.toString() + (comment_end == null ? "" : comment_end.image));}
396    } catch (ParseException e) {
397        addException(e);
398    }
399    throw new Error("Missing return statement in function");
400  }
401
402  final public XmlDocument.Comment DeclTag() throws ParseException {
403  Token t;
404    try {
405      jj_consume_token(DECL_START);
406      t = jj_consume_token(DECL_ANY);
407      jj_consume_token(DECL_END);
408            {if (true) return new XmlDocument.Comment(t.image);}
409    } catch (ParseException e) {
410        addException(e);
411    }
412    throw new Error("Missing return statement in function");
413  }
414
415  final private boolean jj_2_1(int xla) {
416    jj_la = xla; jj_lastpos = jj_scanpos = token;
417    try { return !jj_3_1(); }
418    catch(LookaheadSuccess ls) { return true; }
419    finally { jj_save(0, xla); }
420  }
421
422  final private boolean jj_2_2(int xla) {
423    jj_la = xla; jj_lastpos = jj_scanpos = token;
424    try { return !jj_3_2(); }
425    catch(LookaheadSuccess ls) { return true; }
426    finally { jj_save(1, xla); }
427  }
428
429  final private boolean jj_3_2() {
430    if (jj_scan_token(TAG_START)) return true;
431    if (jj_scan_token(LST_ERROR)) return true;
432    return false;
433  }
434
435  final private boolean jj_3R_4() {
436    if (jj_scan_token(TAG_START)) return true;
437    if (jj_scan_token(TAG_NAME)) return true;
438    return false;
439  }
440
441  final private boolean jj_3_1() {
442    if (jj_3R_4()) return true;
443    return false;
444  }
445
446  public XmlParserTokenManager token_source;
447  SimpleCharStream jj_input_stream;
448  public Token token, jj_nt;
449  private int jj_ntk;
450  private Token jj_scanpos, jj_lastpos;
451  private int jj_la;
452  public boolean lookingAhead = false;
453  private boolean jj_semLA;
454  private int jj_gen;
455  final private int[] jj_la1 = new int[9];
456  static private int[] jj_la1_0;
457  static private int[] jj_la1_1;
458  static {
459      jj_la1_0();
460      jj_la1_1();
461   }
462   private static void jj_la1_0() {
463      jj_la1_0 = new int[] {0x1f800,0xb000,0x10800,0x1000000,0x200000,0xc00000,0x80000000,0x80000000,0x40000001,};
464   }
465   private static void jj_la1_1() {
466      jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x0,};
467   }
468  final private JJCalls[] jj_2_rtns = new JJCalls[2];
469  private boolean jj_rescan = false;
470  private int jj_gc = 0;
471
472  public XmlParser(java.io.InputStream stream) {
473     this(stream, null);
474  }
475  public XmlParser(java.io.InputStream stream, String encoding) {
476    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
477    token_source = new XmlParserTokenManager(jj_input_stream);
478    token = new Token();
479    jj_ntk = -1;
480    jj_gen = 0;
481    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
482    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
483  }
484
485  public void ReInit(java.io.InputStream stream) {
486     ReInit(stream, null);
487  }
488  public void ReInit(java.io.InputStream stream, String encoding) {
489    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
490    token_source.ReInit(jj_input_stream);
491    token = new Token();
492    jj_ntk = -1;
493    jj_gen = 0;
494    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
495    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
496  }
497
498  public XmlParser(java.io.Reader stream) {
499    jj_input_stream = new SimpleCharStream(stream, 1, 1);
500    token_source = new XmlParserTokenManager(jj_input_stream);
501    token = new Token();
502    jj_ntk = -1;
503    jj_gen = 0;
504    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
505    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
506  }
507
508  public void ReInit(java.io.Reader stream) {
509    jj_input_stream.ReInit(stream, 1, 1);
510    token_source.ReInit(jj_input_stream);
511    token = new Token();
512    jj_ntk = -1;
513    jj_gen = 0;
514    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
515    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
516  }
517
518  public XmlParser(XmlParserTokenManager tm) {
519    token_source = tm;
520    token = new Token();
521    jj_ntk = -1;
522    jj_gen = 0;
523    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
524    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
525  }
526
527  public void ReInit(XmlParserTokenManager tm) {
528    token_source = tm;
529    token = new Token();
530    jj_ntk = -1;
531    jj_gen = 0;
532    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
533    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
534  }
535
536  final private Token jj_consume_token(int kind) throws ParseException {
537    Token oldToken;
538    if ((oldToken = token).next != null) token = token.next;
539    else token = token.next = token_source.getNextToken();
540    jj_ntk = -1;
541    if (token.kind == kind) {
542      jj_gen++;
543      if (++jj_gc > 100) {
544        jj_gc = 0;
545        for (int i = 0; i < jj_2_rtns.length; i++) {
546          JJCalls c = jj_2_rtns[i];
547          while (c != null) {
548            if (c.gen < jj_gen) c.first = null;
549            c = c.next;
550          }
551        }
552      }
553      return token;
554    }
555    token = oldToken;
556    jj_kind = kind;
557    throw generateParseException();
558  }
559
560  static private final class LookaheadSuccess extends java.lang.Error { }
561  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
562  final private boolean jj_scan_token(int kind) {
563    if (jj_scanpos == jj_lastpos) {
564      jj_la--;
565      if (jj_scanpos.next == null) {
566        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
567      } else {
568        jj_lastpos = jj_scanpos = jj_scanpos.next;
569      }
570    } else {
571      jj_scanpos = jj_scanpos.next;
572    }
573    if (jj_rescan) {
574      int i = 0; Token tok = token;
575      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
576      if (tok != null) jj_add_error_token(kind, i);
577    }
578    if (jj_scanpos.kind != kind) return true;
579    if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
580    return false;
581  }
582
583  final public Token getNextToken() {
584    if (token.next != null) token = token.next;
585    else token = token.next = token_source.getNextToken();
586    jj_ntk = -1;
587    jj_gen++;
588    return token;
589  }
590
591  final public Token getToken(int index) {
592    Token t = lookingAhead ? jj_scanpos : token;
593    for (int i = 0; i < index; i++) {
594      if (t.next != null) t = t.next;
595      else t = t.next = token_source.getNextToken();
596    }
597    return t;
598  }
599
600  final private int jj_ntk() {
601    if ((jj_nt=token.next) == null)
602      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
603    else
604      return (jj_ntk = jj_nt.kind);
605  }
606
607  private java.util.Vector jj_expentries = new java.util.Vector();
608  private int[] jj_expentry;
609  private int jj_kind = -1;
610  private int[] jj_lasttokens = new int[100];
611  private int jj_endpos;
612
613  private void jj_add_error_token(int kind, int pos) {
614    if (pos >= 100) return;
615    if (pos == jj_endpos + 1) {
616      jj_lasttokens[jj_endpos++] = kind;
617    } else if (jj_endpos != 0) {
618      jj_expentry = new int[jj_endpos];
619      for (int i = 0; i < jj_endpos; i++) {
620        jj_expentry[i] = jj_lasttokens[i];
621      }
622      boolean exists = false;
623      for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
624        int[] oldentry = (int[])(e.nextElement());
625        if (oldentry.length == jj_expentry.length) {
626          exists = true;
627          for (int i = 0; i < jj_expentry.length; i++) {
628            if (oldentry[i] != jj_expentry[i]) {
629              exists = false;
630              break;
631            }
632          }
633          if (exists) break;
634        }
635      }
636      if (!exists) jj_expentries.addElement(jj_expentry);
637      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
638    }
639  }
640
641  public ParseException generateParseException() {
642    jj_expentries.removeAllElements();
643    boolean[] la1tokens = new boolean[36];
644    for (int i = 0; i < 36; i++) {
645      la1tokens[i] = false;
646    }
647    if (jj_kind >= 0) {
648      la1tokens[jj_kind] = true;
649      jj_kind = -1;
650    }
651    for (int i = 0; i < 9; i++) {
652      if (jj_la1[i] == jj_gen) {
653        for (int j = 0; j < 32; j++) {
654          if ((jj_la1_0[i] & (1<<j)) != 0) {
655            la1tokens[j] = true;
656          }
657          if ((jj_la1_1[i] & (1<<j)) != 0) {
658            la1tokens[32+j] = true;
659          }
660        }
661      }
662    }
663    for (int i = 0; i < 36; i++) {
664      if (la1tokens[i]) {
665        jj_expentry = new int[1];
666        jj_expentry[0] = i;
667        jj_expentries.addElement(jj_expentry);
668      }
669    }
670    jj_endpos = 0;
671    jj_rescan_token();
672    jj_add_error_token(0, 0);
673    int[][] exptokseq = new int[jj_expentries.size()][];
674    for (int i = 0; i < jj_expentries.size(); i++) {
675      exptokseq[i] = (int[])jj_expentries.elementAt(i);
676    }
677    return new ParseException(token, exptokseq, tokenImage);
678  }
679
680  final public void enable_tracing() {
681  }
682
683  final public void disable_tracing() {
684  }
685
686  final private void jj_rescan_token() {
687    jj_rescan = true;
688    for (int i = 0; i < 2; i++) {
689    try {
690      JJCalls p = jj_2_rtns[i];
691      do {
692        if (p.gen > jj_gen) {
693          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
694          switch (i) {
695            case 0: jj_3_1(); break;
696            case 1: jj_3_2(); break;
697          }
698        }
699        p = p.next;
700      } while (p != null);
701      } catch(LookaheadSuccess ls) { }
702    }
703    jj_rescan = false;
704  }
705
706  final private void jj_save(int index, int xla) {
707    JJCalls p = jj_2_rtns[index];
708    while (p.gen > jj_gen) {
709      if (p.next == null) { p = p.next = new JJCalls(); break; }
710      p = p.next;
711    }
712    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
713  }
714
715  static final class JJCalls {
716    int gen;
717    Token first;
718    int arg;
719    JJCalls next;
720  }
721
722}