diff --git a/docs/grammar.md b/docs/grammar.md index eaf616c73a1..ad59b6138d3 100644 --- a/docs/grammar.md +++ b/docs/grammar.md @@ -147,10 +147,10 @@ Short description: |date-predicate
equal-predicate(used by predicate-func)
(equals|==) sp predicate-value
not-equal-predicate(used by predicate-func)
(notEquals|!=) sp predicate-value
-
greater-predicate(used by predicate-func)
(greaterThan|>) sp (integer|float|quoted-string)
-
greater-or-equal-predicate(used by predicate-func)
(greaterThanOrEquals|>=) sp sp* (integer|float|quoted-string)
-
less-predicate(used by predicate-func)
(lessThan|<) sp (integer|float|quoted-string)
-
less-or-equal-predicate(used by predicate-func)
(lessThanOrEquals|<=) sp (integer|float|quoted-string)
+
greater-predicate(used by predicate-func)
(greaterThan|>) sp (number|quoted-string)
+
greater-or-equal-predicate(used by predicate-func)
(greaterThanOrEquals|>=) sp sp* (number|quoted-string)
+
less-predicate(used by predicate-func)
(lessThan|<) sp (number|quoted-string)
+
less-or-equal-predicate(used by predicate-func)
(lessThanOrEquals|<=) sp (number|quoted-string)
start-with-predicate(used by predicate-func)
startsWith sp (quoted-string|oneline-hex|oneline-base64)
end-with-predicate(used by predicate-func)
endsWith sp (quoted-string|oneline-hex|oneline-base64)
contain-predicate(used by predicate-func)
contains sp quoted-string
@@ -164,15 +164,14 @@ Short description:
string-predicate(used by predicate-func)
isString
collection-predicate(used by predicate-func)
isCollection
date-predicate(used by predicate-func)
isDate
-
predicate-value(used by equal-predicatenot-equal-predicateinclude-predicate)
 null
-|boolean
-|integer
-|float
-|quoted-string
-|oneline-hex
+

Bytes

bytes(used by body)
 json-value
|xml
@@ -185,7 +184,7 @@ Short description:
base64, [A-Z0-9+-= \n]+ ;
oneline-file(used by predicate-valuebytes)
file, filename ;
-

Strings

quoted-string-text(used by quoted-string-content)
~["\\]+
quoted-string-escaped-char(used by quoted-string-content)
\ ("|\|\b|\f|\n|\r|\t|\u unicode-char)
@@ -242,6 +241,7 @@ Short description: |format-filter
|html-escape-filter
|html-unescape-filter
+|jsonpath-filter
|nth-filter
|regex-filter
|replace-filter
@@ -258,6 +258,7 @@ Short description:
format-filter(used by filter)
format
html-escape-filter(used by filter)
htmlEscape
html-unescape-filter(used by filter)
htmlUnescape
+
jsonpath-filter(used by filter)
jsonpath sp quoted-string
nth-filter(used by filter)
nth sp integer
regex-filter(used by filter)
replace-filter(used by filter)
@@ -270,13 +271,14 @@ Short description:

Lexical Grammar

true|false
alphanum(used by key-string-text)
[A-Za-z0-9]
- - + + +
digit(used by integerfractionexponent)
[0-9]
[0-9A-Fa-f]
fraction(used by json-numberfloat)
. digit+
exponent(used by json-number)
(e|E) (+|-)? digit+
- +
comment(used by lt)
# ~[\n]*
diff --git a/docs/spec/grammar/hurl.grammar b/docs/spec/grammar/hurl.grammar index 327b926aa9c..bfef5987a88 100644 --- a/docs/spec/grammar/hurl.grammar +++ b/docs/spec/grammar/hurl.grammar @@ -238,13 +238,13 @@ equal-predicate: ("equals" | "==") sp predicate-value not-equal-predicate: ("notEquals" | "!=") sp predicate-value -greater-predicate: ("greaterThan" | ">") sp (integer | float | quoted-string) +greater-predicate: ("greaterThan" | ">") sp (number | quoted-string) -greater-or-equal-predicate: ("greaterThanOrEquals" | ">=") sp sp* (integer | float | quoted-string) +greater-or-equal-predicate: ("greaterThanOrEquals" | ">=") sp sp* (number | quoted-string) -less-predicate: ("lessThan" | "<") sp (integer | float | quoted-string) +less-predicate: ("lessThan" | "<") sp (number | quoted-string) -less-or-equal-predicate: ("lessThanOrEquals" | "<=") sp (integer | float | quoted-string) +less-or-equal-predicate: ("lessThanOrEquals" | "<=") sp (number | quoted-string) start-with-predicate: "startsWith" sp (quoted-string | oneline-hex | oneline-base64) @@ -273,15 +273,14 @@ collection-predicate: "isCollection" date-predicate: "isDate" predicate-value: - null - | boolean - | integer - | float - | quoted-string - | oneline-hex + boolean + | multiline-string + | null + | number | oneline-base64 | oneline-file - | multiline-string + | oneline-hex + | quoted-string | template @@ -424,7 +423,7 @@ filter: | format-filter | html-escape-filter | html-unescape-filter - | json-filter + | jsonpath-filter | nth-filter | regex-filter | replace-filter @@ -449,6 +448,8 @@ html-escape-filter: "htmlEscape" html-unescape-filter: "htmlUnescape" +jsonpath-filter: "jsonpath" sp quoted-string + nth-filter: "nth" sp integer regex-filter: "regex" sp (quoted-string | regex) @@ -480,6 +481,8 @@ integer: digit+ float: integer fraction +number: integer | float + digit: [0-9] hexdigit: [0-9A-Fa-f] diff --git a/packages/hurl_core/src/ast/core.rs b/packages/hurl_core/src/ast/core.rs index ada740d6673..1a5370f9960 100644 --- a/packages/hurl_core/src/ast/core.rs +++ b/packages/hurl_core/src/ast/core.rs @@ -412,15 +412,15 @@ pub struct PredicateFunc { #[derive(Clone, Debug, PartialEq, Eq)] #[allow(clippy::large_enum_variant)] pub enum PredicateValue { - String(Template), - MultilineString(MultilineString), - Number(Number), - Bool(bool), - Null, - Hex(Hex), Base64(Base64), + Bool(bool), Expression(Expr), + Hex(Hex), + MultilineString(MultilineString), + Null, + Number(Number), Regex(Regex), + String(Template), } #[derive(Clone, Debug, PartialEq, Eq)]