Remove all mention of the ERROR rule type

This commit is contained in:
Max Brunsfeld 2016-09-01 16:34:44 -07:00
parent 94807f0eb0
commit 88e8cab7f9
3 changed files with 3 additions and 35 deletions

View file

@ -74,14 +74,7 @@ int main() {
"type": "SEQ",
"members": [
{"type": "STRING", "value": "("},
// Error recovery is controlled by wrapping rule subtrees
// in an 'ERROR' rule.
{
"type": "ERROR",
"content": {"type": "SYMBOL", "name": "expression"}
},
{"type": "SYMBOL", "name": "expression"},
{"type": "STRING", "value": ")"}
]
}
@ -225,6 +218,7 @@ clang \
### References
- [Context Aware Scanning for Parsing Extensible Languages](http://www.umsec.umn.edu/publications/Context-Aware-Scanning-Parsing-Extensible)
- [LR(1) Parser Generation System](http://arxiv.org/pdf/1010.1234.pdf) (Error recovery scheme)
- [Efficient and Flexible Incremental Parsing](http://harmonia.cs.berkeley.edu/papers/twagner-parsing.ps.gz)
- [Incremental Analysis of Real Programming Languages](http://harmonia.cs.berkeley.edu/papers/twagner-glr.pdf)
- [Error Detection and Recovery in LR Parsers](http://what-when-how.com/compiler-writing/bottom-up-parsing-compiler-writing-part-13)
- [Error Recovery for LR Parsers](http://www.dtic.mil/dtic/tr/fulltext/u2/a043470.pdf)

View file

@ -170,20 +170,6 @@
"required": ["type", "content"]
},
"error-rule": {
"type": "object",
"properties": {
"type": {
"type": "string",
"pattern": "^ERROR$"
},
"content": {
"$ref": "#/definitions/rule"
}
},
"required": ["type", "content"]
},
"prec-rule": {
"type": "object",
"properties": {
@ -246,7 +232,6 @@
{ "$ref": "#/definitions/repeat1-rule" },
{ "$ref": "#/definitions/repeat-rule" },
{ "$ref": "#/definitions/token-rule" },
{ "$ref": "#/definitions/error-rule" },
{ "$ref": "#/definitions/prec-rule" },
{ "$ref": "#/definitions/prec-left-rule" },
{ "$ref": "#/definitions/prec-right-rule" }

View file

@ -86,17 +86,6 @@ ParseRuleResult parse_rule(json_value *rule_json) {
return { seq(members), "" };
}
if (type == "ERROR") {
json_value content_json = rule_json->operator[]("content");
ParseRuleResult content = parse_rule(&content_json);
if (content.rule.get()) {
return { content.rule, "" };
} else {
error_message = "Invalid error content: " + content.error_message;
goto error;
}
}
if (type == "REPEAT") {
json_value content_json = rule_json->operator[]("content");
ParseRuleResult content = parse_rule(&content_json);