Skip to content

Commit

Permalink
feat: functions blocks, parenthesed JSON Expressions
Browse files Browse the repository at this point in the history
- fixes JSQLParser#1792, the very complex example
- fixes JSQLParser#1477
- cosmetics
  • Loading branch information
manticore-projects committed May 18, 2023
1 parent e19dc0e commit 5263b91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -4067,7 +4067,6 @@ JsonExpression JsonExpression() : {
CastExpression castExpr = null;
}
{
{ System.out.println("Complex:" + getAsBoolean(Feature.allowComplexParsing));}
(
LOOKAHEAD(3, {!interrupted}) expr=CaseWhenExpression()
|
Expand All @@ -4092,7 +4091,6 @@ JsonExpression JsonExpression() : {
LOOKAHEAD(ParenthesedExpression(), {getAsBoolean(Feature.allowComplexParsing)} ) expr = ParenthesedExpression()
|
LOOKAHEAD( 3, {getAsBoolean(Feature.allowComplexParsing) && !interrupted}) expr=ParenthesedSelect()

)

(
Expand Down Expand Up @@ -6714,6 +6712,9 @@ List<String> captureFunctionBody() {
tok = getToken(1);
int l = tokens.size();
if( tok.kind == EOF || ( foundEnd && tok.kind == ST_SEMICOLON) ) {
if (tok.kind == ST_SEMICOLON) {
tokens.add(tok.image);
}
break;
} else if ( l>0 && ( tok.image.equals(".") || tokens.get(l-1).endsWith(".")) ) {
tokens.set(l-1, tokens.get(l-1) + tok.image);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;

import static net.sf.jsqlparser.test.TestUtils.assertDeparse;
import static net.sf.jsqlparser.test.TestUtils.assertExpressionCanBeDeparsedAs;
Expand Down

0 comments on commit 5263b91

Please sign in to comment.