Пример #1
0
 public ParseException generateParseException() {
   jj_expentries.removeAllElements();
   boolean[] la1tokens = new boolean[16];
   for (int i = 0; i < 16; i++) {
     la1tokens[i] = false;
   }
   if (jj_kind >= 0) {
     la1tokens[jj_kind] = true;
     jj_kind = -1;
   }
   for (int i = 0; i < 4; 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 < 16; i++) {
     if (la1tokens[i]) {
       jj_expentry = new int[1];
       jj_expentry[0] = i;
       jj_expentries.addElement(jj_expentry);
     }
   }
   int[][] exptokseq = new int[jj_expentries.size()][];
   for (int i = 0; i < jj_expentries.size(); i++) {
     exptokseq[i] = (int[]) jj_expentries.elementAt(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];
     }
     boolean exists = false;
     for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements(); ) {
       int[] oldentry = (int[]) (e.nextElement());
       if (oldentry.length == jj_expentry.length) {
         exists = true;
         for (int i = 0; i < jj_expentry.length; i++) {
           if (oldentry[i] != jj_expentry[i]) {
             exists = false;
             break;
           }
         }
         if (exists) break;
       }
     }
     if (!exists) jj_expentries.addElement(jj_expentry);
     if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
   }
 }