Lexical Grammar
-
-
+
+
+
-
sp(used by request, response, capture, assert, header-query, certificate-query, cookie-query, xpath-query, jsonpath-query, regex-query, variable-query, predicate, equal-predicate, not-equal-predicate, greater-predicate, greater-or-equal-predicate, less-predicate, less-or-equal-predicate, start-with-predicate, end-with-predicate, contain-predicate, match-predicate, include-predicate, expr, nth-filter, regex-filter, replace-filter, split-filter, xpath-filter, lt) [ \t]
+
sp(used by request, response, capture, assert, header-query, certificate-query, cookie-query, xpath-query, jsonpath-query, regex-query, variable-query, predicate, equal-predicate, not-equal-predicate, greater-predicate, greater-or-equal-predicate, less-predicate, less-or-equal-predicate, start-with-predicate, end-with-predicate, contain-predicate, match-predicate, include-predicate, expr, jsonpath-filter, nth-filter, regex-filter, replace-filter, split-filter, xpath-filter, lt) [ \t]
lt(used by hurl-file, request, response, header, body, query-string-params-section, form-params-section, multipart-form-data-section, cookies-section, captures-section, asserts-section, basic-auth-section, options-section, file-param, capture, assert, option, ca-certificate-option, follow-redirect-option, insecure-option, max-redirs-option, resolve-option, retry-option, retry-interval-option, variable-option, verbose-option, very-verbose-option, multiline-string)
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)]