public REProgram compile(String pattern) throws RESyntaxException {
  this.pattern=pattern;
  len=pattern.length();
  idx=0;
  lenInstruction=0;
  parens=1;
  int[] flags={NODE_TOPLEVEL};
  expr(flags);
  if (idx != len) {
    if (pattern.charAt(idx) == ')') {
      syntaxError("Unmatched close paren");
    }
    syntaxError("Unexpected input remains");
  }
  char[] ins=new char[lenInstruction];
  System.arraycopy(instruction,0,ins,0,lenInstruction);
  return new REProgram(parens,ins);
}

public REProgram compile ( String pattern ) throws RESyntaxException { this . pattern = pattern ; len = pattern . length ( ) ; idx = 0 ; lenInstruction = 0 ; parens = 1 ; int [ ] flags = { NODE_TOPLEVEL } ; expr ( flags ) ; if ( idx != len ) { if ( pattern . charAt ( idx ) == ')' ) { syntaxError ( "Unmatched close paren" ) ; } syntaxError ( "Unexpected input remains" ) ; } char [ ] ins = new char [ lenInstruction ] ; System . arraycopy ( instruction , 0 , ins , 0 , lenInstruction ) ; return new REProgram ( parens , ins ) ; }
compiles a regular expression pattern into a program runnable by the pattern matcher class ' re ' .
