Skip to content

Commit 2050b61

Browse files
More grammar improvements (#98)
* Fix comparison operators in JSON Path grammar. Removed function names from `comp_op` operators rule("in", "nin", "size", "noneOf", "anyOf", "subsetOf") to align with the intended grammar restrictions. * rustfmt parser.rs
1 parent 25ca480 commit 2050b61

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/parser.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,9 @@ pub fn literal(rule: Pair<Rule>) -> Parsed<Literal> {
310310
if num.contains('.') || num.contains('e') || num.contains('E') {
311311
Ok(Literal::Float(num.parse::<f64>().map_err(|e| (e, num))?))
312312
} else {
313-
Ok(Literal::Int(num.trim().parse::<i64>().map_err(|e| (e, num))?))
313+
Ok(Literal::Int(
314+
num.trim().parse::<i64>().map_err(|e| (e, num))?,
315+
))
314316
}
315317
}
316318

src/parser/grammar/json_path_9535.pest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ abs_singular_query = { root ~ singular_query_segments }
4040
singular_query_segments = { (S ~ (name_segment | index_segment))* }
4141
name_segment = { ("[" ~ name_selector ~ "]") | ("." ~ member_name_shorthand) }
4242
index_segment = { "[" ~ index_selector ~ "]" }
43-
comp_op = { "==" | "!=" | "<=" | ">=" | "<" | ">" | "in" | "nin" | "size" | "noneOf" | "anyOf" | "subsetOf"}
43+
comp_op = { "==" | "!=" | "<=" | ">=" | "<" | ">" }
4444

4545
LCALPHA = { 'a'..'z' }
4646

0 commit comments

Comments
 (0)