コード例 #1
0
ファイル: JJTDotParser.java プロジェクト: rssh/javachecker2
 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;
   }
 }
コード例 #2
0
ファイル: JJTDotParser.java プロジェクト: rssh/javachecker2
 public ParseException generateParseException() {
   jj_expentries.removeAllElements();
   boolean[] la1tokens = new boolean[47];
   for (int i = 0; i < 47; i++) {
     la1tokens[i] = false;
   }
   if (jj_kind >= 0) {
     la1tokens[jj_kind] = true;
     jj_kind = -1;
   }
   for (int i = 0; i < 26; 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;
         }
         if ((jj_la1_1[i] & (1 << j)) != 0) {
           la1tokens[32 + j] = true;
         }
       }
     }
   }
   for (int i = 0; i < 47; i++) {
     if (la1tokens[i]) {
       jj_expentry = new int[1];
       jj_expentry[0] = i;
       jj_expentries.addElement(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] = (int[]) jj_expentries.elementAt(i);
   }
   return new ParseException(token, exptokseq, tokenImage);
 }