void bracket() throws RESyntaxException {
  if (idx >= len || pattern.charAt(idx++) != '{') {
    internalError();
  }
  if (idx >= len || !Character.isDigit(pattern.charAt(idx))) {
    syntaxError("Expected digit");
  }
  StringBuffer number=new StringBuffer();
  while (idx < len && Character.isDigit(pattern.charAt(idx))) {
    number.append(pattern.charAt(idx++));
  }
  try {
    bracketMin=Integer.parseInt(number.toString());
  }
 catch (  NumberFormatException e) {
    syntaxError("Expected valid number");
  }
  if (idx >= len) {
    syntaxError("Expected comma or right bracket");
  }
  if (pattern.charAt(idx) == '}') {
    idx++;
    bracketOpt=0;
    return;
  }
  if (idx >= len || pattern.charAt(idx++) != ',') {
    syntaxError("Expected comma");
  }
  if (idx >= len) {
    syntaxError("Expected comma or right bracket");
  }
  if (pattern.charAt(idx) == '}') {
    idx++;
    bracketOpt=bracketUnbounded;
    return;
  }
  if (idx >= len || !Character.isDigit(pattern.charAt(idx))) {
    syntaxError("Expected digit");
  }
  number.setLength(0);
  while (idx < len && Character.isDigit(pattern.charAt(idx))) {
    number.append(pattern.charAt(idx++));
  }
  try {
    bracketOpt=Integer.parseInt(number.toString()) - bracketMin;
  }
 catch (  NumberFormatException e) {
    syntaxError("Expected valid number");
  }
  if (bracketOpt < 0) {
    syntaxError("Bad range");
  }
  if (idx >= len || pattern.charAt(idx++) != '}') {
    syntaxError("Missing close brace");
  }
}

void bracket ( ) throws RESyntaxException { if ( idx >= len || pattern . charAt ( idx ++ ) != '{' ) { internalError ( ) ; } if ( idx >= len || ! Character . isDigit ( pattern . charAt ( idx ) ) ) { syntaxError ( "Expected digit" ) ; } StringBuffer number = new StringBuffer ( ) ; while ( idx < len && Character . isDigit ( pattern . charAt ( idx ) ) ) { number . append ( pattern . charAt ( idx ++ ) ) ; } try { bracketMin = Integer . parseInt ( number . toString ( ) ) ; } catch ( NumberFormatException e ) { syntaxError ( "Expected valid number" ) ; } if ( idx >= len ) { syntaxError ( "Expected comma or right bracket" ) ; } if ( pattern . charAt ( idx ) == '}' ) { idx ++ ; bracketOpt = 0 ; return ; } if ( idx >= len || pattern . charAt ( idx ++ ) != ',' ) { syntaxError ( "Expected comma" ) ; } if ( idx >= len ) { syntaxError ( "Expected comma or right bracket" ) ; } if ( pattern . charAt ( idx ) == '}' ) { idx ++ ; bracketOpt = bracketUnbounded ; return ; } if ( idx >= len || ! Character . isDigit ( pattern . charAt ( idx ) ) ) { syntaxError ( "Expected digit" ) ; } number . setLength ( 0 ) ; while ( idx < len && Character . isDigit ( pattern . charAt ( idx ) ) ) { number . append ( pattern . charAt ( idx ++ ) ) ; } try { bracketOpt = Integer . parseInt ( number . toString ( ) ) - bracketMin ; } catch ( NumberFormatException e ) { syntaxError ( "Expected valid number" ) ; } if ( bracketOpt < 0 ) { syntaxError ( "Bad range" ) ; } if ( idx >= len || pattern . charAt ( idx ++ ) != '}' ) { syntaxError ( "Missing close brace" ) ; } }
match bracket { m , n } expression put results in bracket member variables
