Example #1
0
 public final Token getNextToken() {
   if (token.next != null) token = token.next;
   else token = token.next = token_source.getNextToken();
   jj_ntk = -1;
   jj_gen++;
   return token;
 }
Example #2
0
 public final Token getToken(int index) {
   Token t = lookingAhead ? jj_scanpos : token;
   for (int i = 0; i < index; i++) {
     if (t.next != null) t = t.next;
     else t = t.next = token_source.getNextToken();
   }
   return t;
 }
Example #3
0
 private final Token jj_consume_token(int kind) throws ParseException {
   Token oldToken;
   if ((oldToken = token).next != null) token = token.next;
   else token = token.next = token_source.getNextToken();
   jj_ntk = -1;
   if (token.kind == kind) {
     jj_gen++;
     if (++jj_gc > 100) {
       jj_gc = 0;
       for (int i = 0; i < jj_2_rtns.length; i++) {
         JJCalls c = jj_2_rtns[i];
         while (c != null) {
           if (c.gen < jj_gen) c.first = null;
           c = c.next;
         }
       }
     }
     return token;
   }
   token = oldToken;
   jj_kind = kind;
   throw generateParseException();
 }
Example #4
0
 private final boolean jj_scan_token(int kind) {
   if (jj_scanpos == jj_lastpos) {
     jj_la--;
     if (jj_scanpos.next == null) {
       jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
     } else {
       jj_lastpos = jj_scanpos = jj_scanpos.next;
     }
   } else {
     jj_scanpos = jj_scanpos.next;
   }
   if (jj_rescan) {
     int i = 0;
     Token tok = token;
     while (tok != null && tok != jj_scanpos) {
       i++;
       tok = tok.next;
     }
     if (tok != null) jj_add_error_token(kind, i);
   }
   if (jj_scanpos.kind != kind) return true;
   if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
   return false;
 }
Example #5
0
 private final int jj_ntk() {
   if ((jj_nt = token.next) == null)
     return (jj_ntk = (token.next = token_source.getNextToken()).kind);
   else return (jj_ntk = jj_nt.kind);
 }