private void parseTillClosed(int openToken) throws IOException {
  int nextToken;
  boolean done=false;
  startBlock(openToken);
  while (!done) {
    nextToken=nextToken((char)0);
switch (nextToken) {
case IDENTIFIER:
      if (unitBuffer.length() > 0 && readWS) {
        unitBuffer.append(' ');
      }
    if (tokenBufferLength > 0) {
      unitBuffer.append(tokenBuffer,0,tokenBufferLength);
    }
  break;
case BRACKET_OPEN:
case BRACE_OPEN:
case PAREN_OPEN:
if (unitBuffer.length() > 0 && readWS) {
  unitBuffer.append(' ');
}
unitBuffer.append(charMapping[nextToken]);
startBlock(nextToken);
break;
case BRACKET_CLOSE:
case BRACE_CLOSE:
case PAREN_CLOSE:
if (unitBuffer.length() > 0 && readWS) {
unitBuffer.append(' ');
}
unitBuffer.append(charMapping[nextToken]);
endBlock(nextToken);
if (!inBlock()) {
done=true;
}
break;
case END:
throw new RuntimeException("Unclosed block");
}
}
}

private void parseTillClosed ( int openToken ) throws IOException { int nextToken ; boolean done = false ; startBlock ( openToken ) ; while ( ! done ) { nextToken = nextToken ( ( char ) 0 ) ; switch ( nextToken ) { case IDENTIFIER : if ( unitBuffer . length ( ) > 0 && readWS ) { unitBuffer . append ( ' ' ) ; } if ( tokenBufferLength > 0 ) { unitBuffer . append ( tokenBuffer , 0 , tokenBufferLength ) ; } break ; case BRACKET_OPEN : case BRACE_OPEN : case PAREN_OPEN : if ( unitBuffer . length ( ) > 0 && readWS ) { unitBuffer . append ( ' ' ) ; } unitBuffer . append ( charMapping [ nextToken ] ) ; startBlock ( nextToken ) ; break ; case BRACKET_CLOSE : case BRACE_CLOSE : case PAREN_CLOSE : if ( unitBuffer . length ( ) > 0 && readWS ) { unitBuffer . append ( ' ' ) ; } unitBuffer . append ( charMapping [ nextToken ] ) ; endBlock ( nextToken ) ; if ( ! inBlock ( ) ) { done = true ; } break ; case END : throw new RuntimeException ( "Unclosed block" ) ; } } }
parses till a matching block close is encountered . this is only appropriate to be called at the top level ( no nesting ) .
