示例#1
0
 public boolean optimizeString(Psequence seq) {
   for (int i = 0; i < seq.size(); i++) {
     Expression e = seq.get(i);
     if (e instanceof Cbyte) {
       charList.add((byte) ((Cbyte) e).byteChar);
     } else if (e instanceof Psequence) {
       if (!this.optimizeString((Psequence) e)) {
         return false;
       }
     } else {
       return false;
     }
   }
   return true;
 }
示例#2
0
 @Override
 public Instruction encodePsequence(Psequence p, Instruction next, Instruction failjump) {
   this.charList.clear();
   boolean opt = this.optimizeString(p);
   if (opt) {
     byte[] utf8 = new byte[this.charList.size()];
     for (int i = 0; i < utf8.length; i++) {
       utf8[i] = this.charList.get(i);
     }
     this.builder.createIstr(p, this.builder.jumpFailureJump(), utf8);
     return null;
   }
   for (int i = 0; i < p.size(); i++) {
     p.get(i).encode(this, next, failjump);
   }
   return null;
 }