-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implement LambdaArg * Update testdata * Fix to use token.InvalidPos * Replace useless use of parseCommaSeparatedList * Add comment to LambdaArg.Args * Update LambdaArg comments
- Loading branch information
Showing
8 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
testdata/input/expr/array_functions_array_filter_parenless_lambda.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ARRAY_FILTER([1 ,2, 3], e -> e > 1) |
1 change: 1 addition & 0 deletions
1
testdata/input/expr/array_functions_array_filter_two_args_lambda.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ARRAY_FILTER([0, 2, 3], (e, i) -> e > i) |
72 changes: 72 additions & 0 deletions
72
testdata/result/expr/array_functions_array_filter_parenless_lambda.sql.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- array_functions_array_filter_parenless_lambda.sql | ||
ARRAY_FILTER([1 ,2, 3], e -> e > 1) | ||
--- AST | ||
&ast.CallExpr{ | ||
Rparen: 34, | ||
Func: &ast.Ident{ | ||
NamePos: 0, | ||
NameEnd: 12, | ||
Name: "ARRAY_FILTER", | ||
}, | ||
Distinct: false, | ||
Args: []ast.Arg{ | ||
&ast.ExprArg{ | ||
Expr: &ast.ArrayLiteral{ | ||
Array: -1, | ||
Lbrack: 13, | ||
Rbrack: 21, | ||
Type: nil, | ||
Values: []ast.Expr{ | ||
&ast.IntLiteral{ | ||
ValuePos: 14, | ||
ValueEnd: 15, | ||
Base: 10, | ||
Value: "1", | ||
}, | ||
&ast.IntLiteral{ | ||
ValuePos: 17, | ||
ValueEnd: 18, | ||
Base: 10, | ||
Value: "2", | ||
}, | ||
&ast.IntLiteral{ | ||
ValuePos: 20, | ||
ValueEnd: 21, | ||
Base: 10, | ||
Value: "3", | ||
}, | ||
}, | ||
}, | ||
}, | ||
&ast.LambdaArg{ | ||
Lparen: -1, | ||
Args: []*ast.Ident{ | ||
&ast.Ident{ | ||
NamePos: 24, | ||
NameEnd: 25, | ||
Name: "e", | ||
}, | ||
}, | ||
Expr: &ast.BinaryExpr{ | ||
Op: ">", | ||
Left: &ast.Ident{ | ||
NamePos: 29, | ||
NameEnd: 30, | ||
Name: "e", | ||
}, | ||
Right: &ast.IntLiteral{ | ||
ValuePos: 33, | ||
ValueEnd: 34, | ||
Base: 10, | ||
Value: "1", | ||
}, | ||
}, | ||
}, | ||
}, | ||
NamedArgs: []*ast.NamedArg(nil), | ||
NullHandling: nil, | ||
Having: nil, | ||
} | ||
|
||
--- SQL | ||
ARRAY_FILTER([1, 2, 3], e -> e > 1) |
76 changes: 76 additions & 0 deletions
76
testdata/result/expr/array_functions_array_filter_two_args_lambda.sql.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- array_functions_array_filter_two_args_lambda.sql | ||
ARRAY_FILTER([0, 2, 3], (e, i) -> e > i) | ||
--- AST | ||
&ast.CallExpr{ | ||
Rparen: 39, | ||
Func: &ast.Ident{ | ||
NamePos: 0, | ||
NameEnd: 12, | ||
Name: "ARRAY_FILTER", | ||
}, | ||
Distinct: false, | ||
Args: []ast.Arg{ | ||
&ast.ExprArg{ | ||
Expr: &ast.ArrayLiteral{ | ||
Array: -1, | ||
Lbrack: 13, | ||
Rbrack: 21, | ||
Type: nil, | ||
Values: []ast.Expr{ | ||
&ast.IntLiteral{ | ||
ValuePos: 14, | ||
ValueEnd: 15, | ||
Base: 10, | ||
Value: "0", | ||
}, | ||
&ast.IntLiteral{ | ||
ValuePos: 17, | ||
ValueEnd: 18, | ||
Base: 10, | ||
Value: "2", | ||
}, | ||
&ast.IntLiteral{ | ||
ValuePos: 20, | ||
ValueEnd: 21, | ||
Base: 10, | ||
Value: "3", | ||
}, | ||
}, | ||
}, | ||
}, | ||
&ast.LambdaArg{ | ||
Lparen: 24, | ||
Args: []*ast.Ident{ | ||
&ast.Ident{ | ||
NamePos: 25, | ||
NameEnd: 26, | ||
Name: "e", | ||
}, | ||
&ast.Ident{ | ||
NamePos: 28, | ||
NameEnd: 29, | ||
Name: "i", | ||
}, | ||
}, | ||
Expr: &ast.BinaryExpr{ | ||
Op: ">", | ||
Left: &ast.Ident{ | ||
NamePos: 34, | ||
NameEnd: 35, | ||
Name: "e", | ||
}, | ||
Right: &ast.Ident{ | ||
NamePos: 38, | ||
NameEnd: 39, | ||
Name: "i", | ||
}, | ||
}, | ||
}, | ||
}, | ||
NamedArgs: []*ast.NamedArg(nil), | ||
NullHandling: nil, | ||
Having: nil, | ||
} | ||
|
||
--- SQL | ||
ARRAY_FILTER([0, 2, 3], (e, i) -> e > i) |