-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgrammar.pest
More file actions
22 lines (18 loc) · 577 Bytes
/
grammar.pest
File metadata and controls
22 lines (18 loc) · 577 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
file = { SOI ~ (delimiter | request)* ~ EOI}
request = {
request_line ~
headers? ~
NEWLINE ~
body?
}
request_line = _{ method ~ " "+ ~ uri ~ " "+ ~ "HTTP/" ~ version ~ NEWLINE }
uri = { (!whitespace ~ ANY)+ }
method = { ("GET" | "DELETE" | "POST" | "PUT") }
version = { (ASCII_DIGIT | ".")+ }
whitespace = _{ " " | "\t" }
headers = { header+ }
header = { header_name ~ ":" ~ whitespace ~ header_value ~ NEWLINE }
header_name = { (!(NEWLINE | ":") ~ ANY)+ }
header_value = { (!NEWLINE ~ ANY)+ }
body = { (!delimiter ~ ANY)+ }
delimiter = { "#"{3} ~ NEWLINE+ }