@@ -38,7 +38,8 @@ public static Statement parse(String sql) throws JSQLParserException {
3838 }
3939
4040 /**
41- * Parses an sql statement while allowing via consumer to configure the used parser before.
41+ * Parses an sql statement while allowing via consumer to configure the used
42+ * parser before.
4243 *
4344 * For instance to activate SQLServer bracket quotation on could use:
4445 *
@@ -104,7 +105,15 @@ public static Expression parseExpression(String expression) throws JSQLParserExc
104105 }
105106
106107 public static Expression parseExpression (String expression , boolean allowPartialParse ) throws JSQLParserException {
108+ return parseExpression (expression , allowPartialParse , p -> {
109+ });
110+ }
111+
112+ public static Expression parseExpression (String expression , boolean allowPartialParse , Consumer <CCJSqlParser > consumer ) throws JSQLParserException {
107113 CCJSqlParser parser = newParser (expression );
114+ if (consumer != null ) {
115+ consumer .accept (parser );
116+ }
108117 try {
109118 Expression expr = parser .SimpleExpression ();
110119 if (!allowPartialParse && parser .getNextToken ().kind != CCJSqlParserTokenManager .EOF ) {
@@ -119,8 +128,8 @@ public static Expression parseExpression(String expression, boolean allowPartial
119128 }
120129
121130 /**
122- * Parse an conditional expression. This is the expression after a where clause.
123- * Partial parsing is enabled.
131+ * Parse an conditional expression. This is the expression after a where
132+ * clause. Partial parsing is enabled.
124133 *
125134 * @param condExpr
126135 * @return the expression parsed
@@ -131,15 +140,24 @@ public static Expression parseCondExpression(String condExpr) throws JSQLParserE
131140 }
132141
133142 /**
134- * Parse an conditional expression. This is the expression after a where clause.
143+ * Parse an conditional expression. This is the expression after a where
144+ * clause.
135145 *
136146 * @param condExpr
137147 * @param allowPartialParse false: needs the whole string to be processed.
138148 * @return the expression parsed
139149 * @see #parseCondExpression(String)
140150 */
141151 public static Expression parseCondExpression (String condExpr , boolean allowPartialParse ) throws JSQLParserException {
152+ return parseCondExpression (condExpr , allowPartialParse , p -> {
153+ });
154+ }
155+
156+ public static Expression parseCondExpression (String condExpr , boolean allowPartialParse , Consumer <CCJSqlParser > consumer ) throws JSQLParserException {
142157 CCJSqlParser parser = newParser (condExpr );
158+ if (consumer != null ) {
159+ consumer .accept (parser );
160+ }
143161 try {
144162 Expression expr = parser .Expression ();
145163 if (!allowPartialParse && parser .getNextToken ().kind != CCJSqlParserTokenManager .EOF ) {
0 commit comments