feat: add http response codes
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -23,6 +23,19 @@
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "request_declaration"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "header_declaration"
|
||||
},
|
||||
{
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "http_response_declaration"
|
||||
},
|
||||
"named": true,
|
||||
"value": "response"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -38,11 +51,53 @@
|
||||
"name": "url",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_url"
|
||||
"name": "url"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"header_declaration": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "header_name",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "header_name"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ":"
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "header_value",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "header_value"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"http_response_declaration": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "scheme_literal"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_space_literal"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "status_code_pattern"
|
||||
}
|
||||
]
|
||||
},
|
||||
"_literal": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
@@ -117,7 +172,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"_url": {
|
||||
"scheme_literal": {
|
||||
"type": "STRING",
|
||||
"value": "HTTP"
|
||||
},
|
||||
"_space_literal": {
|
||||
"type": "STRING",
|
||||
"value": " "
|
||||
},
|
||||
"status_code_pattern": {
|
||||
"type": "PATTERN",
|
||||
"value": "[\\d]{3}"
|
||||
},
|
||||
"header_name": {
|
||||
"type": "PATTERN",
|
||||
"value": "[a-zA-Z-_0-9]+"
|
||||
},
|
||||
"header_value": {
|
||||
"type": "PATTERN",
|
||||
"value": "[a-zA-Z-_0-9\\s:;\\.,\\\\\\/\\\"\\'\\?\\!\\(\\)\\{\\}\\[\\]@<>=\\-\\+\\*\\#\\$\\&`|~^%]+"
|
||||
},
|
||||
"url": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\S+"
|
||||
}
|
||||
|
@@ -1,8 +1,45 @@
|
||||
[
|
||||
{
|
||||
"type": "header_declaration",
|
||||
"named": true,
|
||||
"fields": {
|
||||
"header_name": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "header_name",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"header_value": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "header_value",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "request_declaration",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"fields": {
|
||||
"url": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "url",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
@@ -19,6 +56,25 @@
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "response",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "scheme_literal",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "status_code_pattern",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "source_file",
|
||||
"named": true,
|
||||
@@ -27,13 +83,25 @@
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "header_declaration",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "request_declaration",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "response",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": ":",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "CONNECT",
|
||||
"named": false
|
||||
@@ -93,5 +161,25 @@
|
||||
{
|
||||
"type": "VIEW",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "header_name",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "header_value",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "scheme_literal",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "status_code_pattern",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "url",
|
||||
"named": true
|
||||
}
|
||||
]
|
1271
src/parser.c
1271
src/parser.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user