Consider supporting multi-select-list
after a projection.
#82
Replies: 3 comments 12 replies
-
This is aweful and ugly but I believe we need index-expression Line 211 in 83a3aa5 to be
|
Beta Was this translation helpful? Give feedback.
-
This is definitely awful and ugly 😁 I think the first question we need to answer is whether this is an intended behaviour or not? Looking at the Go and Python implementations, this looks likely to be a side effect of introducing the concept of projection into the parsing code itself (whereas this concept is actually not needed just by looking at the grammar – although it is indeed needed at runtime when evaluating the expression and thus, useful as an AST node.) I think we should simplify index = "[" number "]"
index-expression = expression index / index Then, rework – like eliminate – projection = flatten-projection
projection =/ hash-wildcard-projection
projection =/ list-filter-expression
projection =/ list-wildcard-projection
projection =/ slice-projection
flatten-projection = "[]"
list-filter-expression = "[?" expression "]"
list-wildcard-projection = "[" "*" "]"
slice-projection = "[" slice-expression"]"
slice-expression = [number] ":" [number] [ ":" [number] ]
Maybe even rename expression =/ ( projection / projection multi-select-list )
expression =/ ( projection projection ) |
Beta Was this translation helpful? Give feedback.
-
See this Gitter thread. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The grammar does not specify this but the canonical implementation accepts constructs that consist of projections immediately followed by a multi_select_list.
https://github.com/springcomp/JmesPath.Net/blob/d47d83b3dca149a3ffb511be787b93c5b8fabe62/src/jmespath.net.parser/JmesPathParser.cs#L24-L33
Example:
Other examples, considering the following input document:
Will enable the following expressions and their result:
Beta Was this translation helpful? Give feedback.
All reactions