コード例 #1
0
 /** Generate ParseException. */
 public ParseException generateParseException() {
   jj_expentries.clear();
   boolean[] la1tokens = new boolean[11];
   if (jj_kind >= 0) {
     la1tokens[jj_kind] = true;
     jj_kind = -1;
   }
   for (int i = 0; i < 3; i++) {
     if (jj_la1[i] == jj_gen) {
       for (int j = 0; j < 32; j++) {
         if ((jj_la1_0[i] & (1 << j)) != 0) {
           la1tokens[j] = true;
         }
       }
     }
   }
   for (int i = 0; i < 11; i++) {
     if (la1tokens[i]) {
       jj_expentry = new int[1];
       jj_expentry[0] = i;
       jj_expentries.add(jj_expentry);
     }
   }
   jj_endpos = 0;
   jj_rescan_token();
   jj_add_error_token(0, 0);
   int[][] exptokseq = new int[jj_expentries.size()][];
   for (int i = 0; i < jj_expentries.size(); i++) {
     exptokseq[i] = jj_expentries.get(i);
   }
   return new ParseException(token, exptokseq, tokenImage);
 }
コード例 #2
0
 private void jj_add_error_token(int kind, int pos) {
   if (pos >= 100) return;
   if (pos == jj_endpos + 1) {
     jj_lasttokens[jj_endpos++] = kind;
   } else if (jj_endpos != 0) {
     jj_expentry = new int[jj_endpos];
     for (int i = 0; i < jj_endpos; i++) {
       jj_expentry[i] = jj_lasttokens[i];
     }
     jj_entries_loop:
     for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext(); ) {
       int[] oldentry = (int[]) (it.next());
       if (oldentry.length == jj_expentry.length) {
         for (int i = 0; i < jj_expentry.length; i++) {
           if (oldentry[i] != jj_expentry[i]) {
             continue jj_entries_loop;
           }
         }
         jj_expentries.add(jj_expentry);
         break jj_entries_loop;
       }
     }
     if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
   }
 }