|
4 | 4 | import java.util.Objects; |
5 | 5 |
|
6 | 6 | /// AST representation for JsonPath expressions. |
7 | | -/// Based on the JSONPath specification from https://goessner.net/articles/JsonPath/ |
| 7 | +/// Based on the JSONPath specification from [...](https://goessner.net/articles/JsonPath/) |
8 | 8 | /// |
9 | 9 | /// A JsonPath expression is a sequence of path segments starting from root ($). |
10 | 10 | /// Each segment can be: |
11 | | -/// - PropertyAccess: access a named property (e.g., .store or ['store']) |
12 | | -/// - ArrayIndex: access array element by index (e.g., [0] or [-1]) |
13 | | -/// - ArraySlice: slice array with start:end:step (e.g., [0:2] or [::2]) |
14 | | -/// - Wildcard: match all children (e.g., .* or [*]) |
| 11 | +/// - PropertyAccess: access a named property (e.g., .store or \['store'\]) |
| 12 | +/// - ArrayIndex: access array element by index (e.g., \[0\] or \[-1\]) |
| 13 | +/// - ArraySlice: slice array with start:end:step (e.g., \[0:2\] or \[::2\]) |
| 14 | +/// - Wildcard: match all children (e.g., .* or \[*\]) |
15 | 15 | /// - RecursiveDescent: search all descendants (e.g., ..author) |
16 | | -/// - Filter: filter by predicate (e.g., [?(@.isbn)] or [?(@.price<10)]) |
17 | | -/// - Union: multiple indices or names (e.g., [0,1] or ['a','b']) |
18 | | -/// - ScriptExpression: computed index (e.g., [(@.length-1)]) |
| 16 | +/// - Filter: filter by predicate (e.g., \[?(@.isbn)\] or \[?(@.price<10)\]) |
| 17 | +/// - Union: multiple indices or names (e.g., \[0,1\] or \['a','b'\]) |
| 18 | +/// - ScriptExpression: computed index (e.g., \[(@.length-1)\]) |
19 | 19 | sealed interface JsonPathAst { |
20 | 20 |
|
21 | 21 | /// Root element ($) - the starting point of all JsonPath expressions |
@@ -80,7 +80,7 @@ record Union(List<Segment> selectors) implements Segment { |
80 | 80 | } |
81 | 81 | } |
82 | 82 |
|
83 | | - /// Script expression for computed index: [(@.length-1)] |
| 83 | + /// Script expression for computed index: \[(@.length-1)\] |
84 | 84 | record ScriptExpression(String script) implements Segment { |
85 | 85 | public ScriptExpression { |
86 | 86 | Objects.requireNonNull(script, "script must not be null"); |
@@ -116,7 +116,7 @@ record ComparisonFilter( |
116 | 116 | } |
117 | 117 | } |
118 | 118 |
|
119 | | - /// Logical combination of filters: &&, ||, ! |
| 119 | + /// Logical combination of filters: "&&", "||", "!" |
120 | 120 | record LogicalFilter( |
121 | 121 | FilterExpression left, |
122 | 122 | LogicalOp op, |
|
0 commit comments