Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

dot child name syntax #5

Merged
merged 1 commit into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/grammar.pest
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ wildcardedDotChild = { ".*" }
namedDotChild = ${ "." ~ childName }
childName = @{ char+ }
char = {
!("\"" | "'" | "\\") ~ ANY // char is still TBD in the draft
"-"
| ASCII_DIGIT
| ASCII_ALPHA
| "_"
| '\u{80}'..'\u{10FFFF}'
}

union = { "[" ~ unionElement ~ ("," ~ unionElement)* ~ "]" }
Expand Down
9 changes: 9 additions & 0 deletions tests/cts.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
"document": {"a" : "A", "b" : "B"},
"result": ["A"]
}, {
"name": "dot child, ☺ name",
"selector": "$.☺",
"document": {"☺" : "A", "b" : "B"},
"result": ["A"]
}, {
"name": "dot child, invalid character",
"selector": "$.&",
"invalid_selector": true
}, {
"name": "dot child absent",
"selector": "$.c",
"document": {"a" : "A", "b" : "B"},
Expand Down