Skip to content

Commit

Permalink
Treat Hurl string as template
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricereix committed Nov 16, 2024
1 parent f64a532 commit dcb5299
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions docs/spec/grammar/hurl.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ very-verbose-option: "very-verbose" ":" boolean-option lt

variable-definition: variable-name "=" variable-value

boolean-option: boolean | template
boolean-option: boolean | value-expr

integer-option: integer | template
integer-option: integer | value-expr

duration-option: (integer duration-unit?) | template
duration-option: (integer duration-unit?) | value-expr

duration-unit: "ms" | "s" | "m"

Expand Down Expand Up @@ -364,7 +364,7 @@ predicate-value:
| oneline-file
| oneline-hex
| quoted-string
| template
| value-expr


# Bytes
Expand All @@ -391,7 +391,7 @@ oneline-hex: "hex," hexdigit* ";"

# Strings

quoted-string: "\"" (quoted-string-content | template)* "\""
quoted-string: "\"" (quoted-string-content | "{{" expr "}}")* "\""

quoted-string-content: (quoted-string-text | quoted-string-escaped-char)*

Expand All @@ -400,7 +400,7 @@ quoted-string-text: ~["\\]+
quoted-string-escaped-char: "\\" ("\"" | "\\" | "\b" | "\f" | "\n" | "\r" | "\t" | "\u" unicode-char)


key-string: (key-string-content | template)+
key-string: (key-string-content | "{{" expr "}}")+

key-string-content: (key-string-text | key-string-escaped-char)*

Expand All @@ -409,7 +409,7 @@ key-string-text: (alphanum | "_" | "-" | "." | "[" | "]" | "@" | "$") +
key-string-escaped-char: "\\" ("#" | ":" | "\\" | "\b" | "\f" | "\n" | "\r" | "\t" | "\u" unicode-char )


value-string: (value-string-content | template)*
value-string: (value-string-content | "{{" expr "}}")*

value-string-content: (value-string-text | value-string-escaped-char)*

Expand All @@ -418,7 +418,7 @@ value-string-text: ~[#\n\\]+
value-string-escaped-char: "\\" ("#" | "\\" | "\b" | "\f" | "\n" | "\r" | "\t" | "\u" unicode-char )


oneline-string: "`" (oneline-string-content | template)* "`"
oneline-string: "`" (oneline-string-content | "{{" expr "}}")* "`"

oneline-string-content: (oneline-string-text | oneline-string-escaped-char)*

Expand All @@ -429,7 +429,7 @@ oneline-string-escaped-char: "\\" ("`" | "#" | "\\" | "b" | "f" | "u" unicode-ch

multiline-string:
"```" multiline-string-type? ("," multiline-string-attribute)* lt
(multiline-string-content | template)* lt
(multiline-string-content | "{{" expr "}}")* lt
"```"

multiline-string-type:
Expand All @@ -449,7 +449,7 @@ multiline-string-text: ~[\\]+ ~"```"

multiline-string-escaped-char: "\\" ( "\\" | "b" | "f" | "n" | "r" | "t" | "`" | "u" unicode-char)

filename: (filename-content | template)*
filename: (filename-content | "{{" expr "}}")*

filename-content: (filename-text | filename-escaped-char)*

Expand All @@ -458,7 +458,7 @@ filename-text: ~[#;{} \n\\]+
filename-escaped-char: "\\" ( "\\" | "b" | "f" | "n" | "r" | "t" | "#" | ";"| " " | "{" | "}" | "u" unicode-char)


filename-password: (filename-password-content | template)*
filename-password: (filename-password-content | "{{" expr "}}")*

filename-password-content: (filename-password-text | filename-password-escaped-char)*

Expand All @@ -473,21 +473,21 @@ unicode-char: "{" hexdigit+ "}"
# JSON

json-value:
template
| json-object
json-object
| json-array
| json-string
| json-number
| boolean
| null
| json-expr

json-object: "{" json-key-value ("," json-key-value)* "}"

json-key-value: json-string ":" json-value

json-array: "[" json-value ("," json-value)* "]"

json-string: "\"" (json-string-content | template)* "\""
json-string: "\"" (json-string-content | "{{" expr "}}")* "\""

json-string-content: json-string-text | json-string-escaped-char

Expand All @@ -498,10 +498,12 @@ json-string-escaped-char:

json-number: integer fraction? exponent?

json-expr: "{{" expr "}}"


# Template / Expression

template: "{{" expr "}}"
value-expr: "{{" expr "}}"

expr: (variable-name | function) (sp filter)*

Expand Down

0 comments on commit dcb5299

Please sign in to comment.