public String skipParentheses ( final SQLStatement sqlStatement ) { StringBuilder result = new StringBuilder ( "" ) ; int count = 0 ; if ( Symbol . LEFT_PAREN == lexer . getCurrentToken ( ) . getType ( ) ) { final int beginPosition = lexer . getCurrentToken ( ) . getEndPosition ( ) ; result . append ( Symbol . LEFT_PAREN . getLiterals ( ) ) ; lexer . nextToken ( ) ; while ( true ) { if ( equalAny ( Symbol . QUESTION ) ) { sqlStatement . setParametersIndex ( sqlStatement . getParametersIndex ( ) + 1 ) ; } if ( Assist . END == lexer . getCurrentToken ( ) . getType ( ) || ( Symbol . RIGHT_PAREN == lexer . getCurrentToken ( ) . getType ( ) && 0 == count ) ) { break ; } if ( Symbol . LEFT_PAREN == lexer . getCurrentToken ( ) . getType ( ) ) { count ++ ; } else if ( Symbol . RIGHT_PAREN == lexer . getCurrentToken ( ) . getType ( ) ) { count -- ; } lexer . nextToken ( ) ; } result . append ( lexer . getInput ( ) . substring ( beginPosition , lexer . getCurrentToken ( ) . getEndPosition ( ) ) ) ; lexer . nextToken ( ) ; } return result . toString ( ) ; }
skip all tokens that inside parentheses .