Пример #1
0
 /** Get the specific Token. */
 public final Token getToken(int index) {
   Token t = token;
   for (int i = 0; i < index; i++) {
     if (t.next != null) t = t.next;
     else t = t.next = token_source.getNextToken();
   }
   return t;
 }
Пример #2
0
 /** Reinitialise. */
 public void ReInit(ISEParserTokenManager tm) {
   token_source = tm;
   token = new Token();
   token.next = jj_nt = token_source.getNextToken();
   jj_gen = 0;
   for (int i = 0; i < 3; i++) jj_la1[i] = -1;
   for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
 }
Пример #3
0
 /** Reinitialise. */
 public void ReInit(java.io.Reader stream) {
   jj_input_stream.ReInit(stream, 1, 1);
   token_source.ReInit(jj_input_stream);
   token = new Token();
   token.next = jj_nt = token_source.getNextToken();
   jj_gen = 0;
   for (int i = 0; i < 3; i++) jj_la1[i] = -1;
   for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
 }
Пример #4
0
 /** Constructor. */
 public ISEParser(java.io.Reader stream) {
   jj_input_stream = new JavaCharStream(stream, 1, 1);
   token_source = new ISEParserTokenManager(jj_input_stream);
   token = new Token();
   token.next = jj_nt = token_source.getNextToken();
   jj_gen = 0;
   for (int i = 0; i < 3; i++) jj_la1[i] = -1;
   for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
 }
Пример #5
0
 /** Reinitialise. */
 public void ReInit(java.io.InputStream stream, String encoding) {
   try {
     jj_input_stream.ReInit(stream, encoding, 1, 1);
   } catch (java.io.UnsupportedEncodingException e) {
     throw new RuntimeException(e);
   }
   token_source.ReInit(jj_input_stream);
   token = new Token();
   token.next = jj_nt = token_source.getNextToken();
   jj_gen = 0;
   for (int i = 0; i < 3; i++) jj_la1[i] = -1;
   for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
 }
Пример #6
0
 private Token jj_consume_token(int kind) throws ParseException {
   Token oldToken = token;
   if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
   else jj_nt = jj_nt.next = token_source.getNextToken();
   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;
   }
   jj_nt = token;
   token = oldToken;
   jj_kind = kind;
   throw generateParseException();
 }
Пример #7
0
 private 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;
 }
Пример #8
0
 /** Get the next Token. */
 public final Token getNextToken() {
   if ((token = jj_nt).next != null) jj_nt = jj_nt.next;
   else jj_nt = jj_nt.next = token_source.getNextToken();
   jj_gen++;
   return token;
 }