public String processPattern ( String newPattern ) throws IllegalArgumentException { int idx = 0 ; int offnum = - 1 ; StringBuffer outpat = new StringBuffer ( ) ; offsets = new int [ BUFSIZE ] ; arguments = new String [ BUFSIZE ] ; maxOffset = - 1 ; //skipped = new RangeList(); // What was this for?? //process(newPattern, "\"", "\""); // NOI18N while ( true ) { int ridx = - 1 ; int lidx = newPattern . indexOf ( ldel , idx ) ; /* Range ran = skipped.getRangeContainingOffset(lidx); if (ran != null) { outpat.append(newPattern.substring(idx, ran.getEnd())); idx = ran.getEnd(); continue; } */ if ( lidx >= 0 ) { ridx = newPattern . indexOf ( rdel , lidx + ldel . length ( ) ) ; } else { break ; } if ( ++ offnum >= BUFSIZE ) { throw new IllegalArgumentException ( "TooManyArguments" ) ; } if ( ridx < 0 ) { if ( exactmatch ) { throw new IllegalArgumentException ( "UnmatchedBraces" ) ; } else { break ; } } outpat . append ( newPattern . substring ( idx , lidx ) ) ; offsets [ offnum ] = outpat . length ( ) ; arguments [ offnum ] = newPattern . substring ( lidx + ldel . length ( ) , ridx ) ; idx = ridx + rdel . length ( ) ; maxOffset ++ ; } outpat . append ( newPattern . substring ( idx ) ) ; return outpat . toString ( ) ; }
Scans the pattern and prepares internal variables .