hurl/docs/grammar.md

23 KiB

Grammar

Definitions

Short description:

  • operator | denotes alternative,
  • operator * denotes iteration (zero or more),
  • operator + denotes iteration (one or more),

Syntax Grammar

hurl-file 
entry*
  lt*
entry 
request 
response 
method 
"GET"
| "HEAD"
| "POST"
| "PUT"
| "DELETE"
| "CONNECT"
| "OPTIONS"
| "TRACE"
| "PATCH"
url 
<(alphanum | ":" | "/" | "{" | "}" | "*" | "," | "@" | "]")+>
version 
"HTTP/1.0" | "HTTP/1.1" | "HTTP/2" | "HTTP/*"
status 
<[0-9]+>
header 
lt*
  sp* key-value lt
body 
lt*
  sp* bytes lt
response-section 
query-string-params-section 
lt*
  sp* "[QueryStringParams]" lt
  param*
form-params-section 
lt*
  sp* "[FormParams]" lt
  param*
multipart-form-data-section 
lt*
  sp* "[MultipartFormData]" lt
  multipart-form-data-param*
cookies-section 
lt*
  sp* "[Cookies]" lt
  cookie*
captures-section 
lt*
  sp* "[Captures]" lt
  capture*
asserts-section 
lt*
  sp* "[Asserts]" lt
  assert*
param 
lt*
  sp* key-value lt
multipart-form-data-param 
file-param 
file-value 
"file," sp* filename sp* ";" (sp* file-contenttype)?
file-contenttype 
<(alphanum | "/" | ";" | "=" | " ")+ without leading/trailing space>
<(alphanum | "!" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*" | "+" | "-" | "." | "/" | ":" | "<" | "=" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "`" | "~" )* >
capture 
lt*
  sp* key-string sp* ":" sp* query lt
query 
status-query 
"status"
header-query 
"header" sp sp* quoted-string
"cookie" sp sp* quoted-string
body-query 
"body"
xpath-query 
"xpath" sp sp* quoted-string
jsonpath-query 
"jsonpath" sp sp* quoted-string
regex-query 
"regex" sp sp* quoted-string
variable-query 
"variable" sp sp* quoted-string
duration 
"duration"
sha256-query 
"sha256"
bytes-query 
"bytes"
regex-subquery 
"regex" sp sp* quoted-string
count-subquery 
"count"
assert 
predicate 
= ("not" sp sp*)? predicate-func
equal-predicate 
= ("equals" | "==") sp sp* (null | float | integer | boolean | quoted-string | raw-string | hex | base64 | expr)
not-equal-predicate 
= ("notEquals" | "!=") sp sp* (null | float | integer | boolean | quoted-string | raw-string | hex | base64 | expr)
greater-predicate 
= ("greaterThan" | ">") sp sp* (integer | float)
greater-or-equal-predicate 
= ("greaterThanOrEquals" | ">=") sp sp* (integer | float)
less-predicate 
= ("lessThan" | "<") sp sp* (integer | float)
less-or-equal-predicate 
= ("lessThanOrEquals" | "<=") sp sp* (integer | float)
start-with-predicate 
"startsWith" sp sp* (quoted-string | hex | base64)
end-with-predicate 
"endsWith" sp sp* (quoted-string | hex | base64)
contain-predicate 
"contains" sp sp* quoted-string
match-predicate 
"matches" sp sp* quoted-string
exist-predicate 
"exists"
include-predicate 
"includes" sp sp* (null |float | integer | boolean | quoted-string | expr)
integer-predicate 
"isInteger"
float-predicate 
"isFloat"
boolean-predicate 
"isBoolean"
string-predicate 
"isString"
collection-predicate 
"isCollection"
key-value 
key-string 
<(alphanum | "_" | "-" | "." | escape-char)+ >
value-string 
<(anychar except escaped char and #| escape-char)* without leading/trailing space>
quoted-string 
""" <(anychar except escaped char | escape-char)*> """
expr 
"{{" sp* variable-name sp* "}}"
variable-name 
<(alphanum | "_" )+>
escaped-char 
"\""
| "\\"
| "\b"
| "\f"
| "\n"
| "\r"
| "\t"
| "\u" unicode-char
unicode-char 
"{" hexdigit+ "}"
bytes 
raw-string 
"```" (sp* newline)? (any characters) "```"
base64 
"base64," <base64 encoding with optional whitesp/padding> ";"
file 
"file," sp* filename sp* ";"
hex 
"hex," sp* hexdigit* sp* ";"
lt 
comment 
"#" <any characters except newline - does not end with sp>
newline 
"\n" | "\r\n"
sp 
" " | "\t"
filename 
<(alphanum | ".")+>
integer 
<-?[1-9][0-9]*>