From a6f47a61f80eac99d5bb2c5a9bfdea6dfc1b3f6f Mon Sep 17 00:00:00 2001 From: thehiddenwaffle Date: Wed, 14 May 2025 10:42:49 -0400 Subject: [PATCH 1/2] 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. --- src/parser/grammar/json_path_9535.pest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/grammar/json_path_9535.pest b/src/parser/grammar/json_path_9535.pest index a40754e..77dcd0a 100644 --- a/src/parser/grammar/json_path_9535.pest +++ b/src/parser/grammar/json_path_9535.pest @@ -40,7 +40,7 @@ abs_singular_query = { root ~ singular_query_segments } singular_query_segments = { (S ~ (name_segment | index_segment))* } name_segment = { ("[" ~ name_selector ~ "]") | ("." ~ member_name_shorthand) } index_segment = { "[" ~ index_selector ~ "]" } -comp_op = { "==" | "!=" | "<=" | ">=" | "<" | ">" | "in" | "nin" | "size" | "noneOf" | "anyOf" | "subsetOf"} +comp_op = { "==" | "!=" | "<=" | ">=" | "<" | ">" } LCALPHA = { 'a'..'z' } From 4433fb6e79c233923c61d7709b8ca75b626353de Mon Sep 17 00:00:00 2001 From: thehiddenwaffle Date: Wed, 14 May 2025 10:48:10 -0400 Subject: [PATCH 2/2] rustfmt parser.rs --- src/parser.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/parser.rs b/src/parser.rs index 12add67..7f5adbb 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -310,7 +310,9 @@ pub fn literal(rule: Pair) -> Parsed { if num.contains('.') || num.contains('e') || num.contains('E') { Ok(Literal::Float(num.parse::().map_err(|e| (e, num))?)) } else { - Ok(Literal::Int(num.trim().parse::().map_err(|e| (e, num))?)) + Ok(Literal::Int( + num.trim().parse::().map_err(|e| (e, num))?, + )) } }