private void compile(){
  if (has(CANON_EQ) && !has(LITERAL)) {
    normalize();
  }
 else {
    normalizedPattern=pattern;
  }
  patternLength=normalizedPattern.length();
  temp=new int[patternLength + 2];
  hasSupplementary=false;
  int c, count=0;
  for (int x=0; x < patternLength; x+=Character.charCount(c)) {
    c=normalizedPattern.codePointAt(x);
    if (isSupplementary(c)) {
      hasSupplementary=true;
    }
    temp[count++]=c;
  }
  patternLength=count;
  if (!has(LITERAL))   RemoveQEQuoting();
  buffer=new int[32];
  groupNodes=new GroupHead[10];
  namedGroups=null;
  if (has(LITERAL)) {
    matchRoot=newSlice(temp,patternLength,hasSupplementary);
    matchRoot.next=lastAccept;
  }
 else {
    matchRoot=expr(lastAccept);
    if (patternLength != cursor) {
      if (peek() == ')') {
        throw error("Unmatched closing ')'");
      }
 else {
        throw error("Unexpected internal error");
      }
    }
  }
  if (matchRoot instanceof Slice) {
    root=BnM.optimize(matchRoot);
    if (root == matchRoot) {
      root=hasSupplementary ? new StartS(matchRoot) : new Start(matchRoot);
    }
  }
 else   if (matchRoot instanceof Begin || matchRoot instanceof First) {
    root=matchRoot;
  }
 else {
    root=hasSupplementary ? new StartS(matchRoot) : new Start(matchRoot);
  }
  temp=null;
  buffer=null;
  groupNodes=null;
  patternLength=0;
  compiled=true;
}

private void compile ( ) { if ( has ( CANON_EQ ) && ! has ( LITERAL ) ) { normalize ( ) ; } else { normalizedPattern = pattern ; } patternLength = normalizedPattern . length ( ) ; temp = new int [ patternLength + 2 ] ; hasSupplementary = false ; int c , count = 0 ; for ( int x = 0 ; x < patternLength ; x += Character . charCount ( c ) ) { c = normalizedPattern . codePointAt ( x ) ; if ( isSupplementary ( c ) ) { hasSupplementary = true ; } temp [ count ++ ] = c ; } patternLength = count ; if ( ! has ( LITERAL ) ) RemoveQEQuoting ( ) ; buffer = new int [ 32 ] ; groupNodes = new GroupHead [ 10 ] ; namedGroups = null ; if ( has ( LITERAL ) ) { matchRoot = newSlice ( temp , patternLength , hasSupplementary ) ; matchRoot . next = lastAccept ; } else { matchRoot = expr ( lastAccept ) ; if ( patternLength != cursor ) { if ( peek ( ) == ')' ) { throw error ( "Unmatched closing ')'" ) ; } else { throw error ( "Unexpected internal error" ) ; } } } if ( matchRoot instanceof Slice ) { root = BnM . optimize ( matchRoot ) ; if ( root == matchRoot ) { root = hasSupplementary ? new StartS ( matchRoot ) : new Start ( matchRoot ) ; } } else if ( matchRoot instanceof Begin || matchRoot instanceof First ) { root = matchRoot ; } else { root = hasSupplementary ? new StartS ( matchRoot ) : new Start ( matchRoot ) ; } temp = null ; buffer = null ; groupNodes = null ; patternLength = 0 ; compiled = true ; }
copies regular expression to an int array and invokes the parsing of the expression which will create the object tree .
