|
16 | 16 | import dev.vepo.jsonata.functions.ArrayIndexJSONataFunction; |
17 | 17 | import dev.vepo.jsonata.functions.ArrayQueryJSONataFunction; |
18 | 18 | import dev.vepo.jsonata.functions.ArrayRangeJSONataFunction; |
19 | | -import dev.vepo.jsonata.functions.BooleanCompareJSONataFunction; |
20 | | -import dev.vepo.jsonata.functions.BooleanOperator; |
21 | 19 | import dev.vepo.jsonata.functions.CompareOperator; |
22 | 20 | import dev.vepo.jsonata.functions.CompareValuesJSONataFunction; |
| 21 | +import dev.vepo.jsonata.functions.ContextValueJSONataFunction; |
23 | 22 | import dev.vepo.jsonata.functions.DeepFindByFieldNameJSONataFunction; |
24 | 23 | import dev.vepo.jsonata.functions.FieldPathJSONataFunction; |
25 | | -import dev.vepo.jsonata.functions.ContextValueJSONataFunction; |
26 | 24 | import dev.vepo.jsonata.functions.JSONataFunction; |
27 | 25 | import dev.vepo.jsonata.functions.JoinJSONataFunction; |
| 26 | +import dev.vepo.jsonata.functions.StringConcatJSONataFunction; |
28 | 27 | import dev.vepo.jsonata.functions.WildcardJSONataFunction; |
29 | 28 | import dev.vepo.jsonata.functions.generated.JSONataGrammarBaseListener; |
30 | 29 | import dev.vepo.jsonata.functions.generated.JSONataGrammarParser.AllDescendantSearchContext; |
31 | 30 | import dev.vepo.jsonata.functions.generated.JSONataGrammarParser.ArrayIndexQueryContext; |
32 | 31 | import dev.vepo.jsonata.functions.generated.JSONataGrammarParser.ArrayQueryContext; |
33 | 32 | import dev.vepo.jsonata.functions.generated.JSONataGrammarParser.BooleanCompareContext; |
| 33 | +import dev.vepo.jsonata.functions.generated.JSONataGrammarParser.ConcatValuesContext; |
34 | 34 | import dev.vepo.jsonata.functions.generated.JSONataGrammarParser.ContextRefereceContext; |
35 | 35 | import dev.vepo.jsonata.functions.generated.JSONataGrammarParser.ContextValueContext; |
36 | 36 | import dev.vepo.jsonata.functions.generated.JSONataGrammarParser.ExpNumberValueContext; |
@@ -206,7 +206,12 @@ public void exitToArray(ToArrayContext ctx) { |
206 | 206 |
|
207 | 207 | @Override |
208 | 208 | public void exitArrayIndexQuery(ArrayIndexQueryContext ctx) { |
| 209 | + if (expressions.isEmpty()) { |
209 | 210 | expressions.offer(new ArrayIndexJSONataFunction(Integer.valueOf(ctx.NUMBER().getText()))); |
| 211 | + } else { |
| 212 | + var previousFunction = expressions.removeLast(); |
| 213 | + expressions.offer(new JoinJSONataFunction(previousFunction, new ArrayIndexJSONataFunction(Integer.valueOf(ctx.NUMBER().getText())))); |
| 214 | + } |
210 | 215 | } |
211 | 216 |
|
212 | 217 | @Override |
@@ -269,6 +274,13 @@ public void exitContextReferece(ContextRefereceContext ctx) { |
269 | 274 | this.expressions.offer((original, value) -> original); |
270 | 275 | } |
271 | 276 |
|
| 277 | + @Override |
| 278 | + public void exitConcatValues(ConcatValuesContext ctx) { |
| 279 | + var currentFunction = expressions.removeLast(); |
| 280 | + var previousFunction = expressions.removeLast(); |
| 281 | + expressions.offer(new StringConcatJSONataFunction(previousFunction, currentFunction)); |
| 282 | + } |
| 283 | + |
272 | 284 | // @Override |
273 | 285 | // public void exitTransformerStringConcat(TransformerStringConcatContext ctx) { |
274 | 286 | // this.expressions.peekFirst() |
|
0 commit comments