fhttp-core 1.4.0

core library for the fhttp tool
Documentation
WHITESPACE = _{ " " }
COMMENT = _{ "#" ~ (!NEWLINE ~ ANY)* ~ NEWLINE }

method = @{ ASCII_ALPHANUMERIC+ }
url = @{ (!NEWLINE ~ ANY)+ }

first_line = { method ~ url }
header_name = { (ASCII_ALPHANUMERIC | "-" | "_" )+ }
header_value = { (LETTER | NUMBER | PUNCTUATION | SYMBOL | " ")+ }
header_line = { header_name ~ ":" ~ header_value }

query = { (!NEWLINE{2,} ~ ANY)+ }
variables = { (!NEWLINE{2,} ~ ANY)+ }

variables_and_response_handler = _{ variables ~ NEWLINE{2,} ~ response_handler }

response_handler_end = _{ "%}" }
response_handler_exp = { (!response_handler_end ~ ANY)+ }
response_handler_json = { "json" ~ response_handler_exp }
response_handler = _{
	">" ~ "{%" ~ NEWLINE* ~
	response_handler_json ~
	response_handler_end
}

file = {
	SOI ~
	first_line ~ NEWLINE? ~
	(header_line ~ NEWLINE?)* ~
	NEWLINE* ~
	query ~
	NEWLINE* ~
	(
		response_handler |
		variables_and_response_handler |
		variables
	)? ~
	NEWLINE* ~
	EOI
}