forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add one new test file containing 1086 tests of the syntax error messa…
…ges (plus tooling) (ocaml#10086) * Improve [make clean-menhir] to remove parser.{automaton,conflicts}. * Distinguish MENHIRBASICFLAGS and MENHIRFLAGS. The former is a subset of the latter, and suffices when running Menhir to perform an analysis of the grammar. This allows [make interpret-menhir] to be used even if ocamlrun and ocamlc have not been built yet. * Define an alias (i.e., concrete syntax) for every token. Add --require-aliases. The flag --require-aliases makes sure that the property that every token has an alias will be preserved in the future. This requires Menhir 20201214. * Add [make list-parse-errors]. This rule runs Menhir's reachability analysis, which produces a list of all states where a syntax error can be detected (and a corresponding list of of erroneous sentences). This data is stored in parsing/parser.auto.messages. All text between BEGIN AVOID and END AVOID is removed from the grammar before the analysis is run. This can be used to filter out productions and declarations that the analysis should ignore. * Add [make generate-parse-errors]. This rule turns the error sentences stored in parsing/parser.auto.messages into concrete .ml files, which can be used as tests. One file per sentence is created. The file name is derived from the sentence. The test files are placed in the directory testsuite/tests/generated-parse-errors. * Mark the three productions that use [not_expecting] with [AVOID]. * Mark the production that allows puns with [AVOID]. This prevents [make list-parse-errors] from generating sentences that exploit this production. Indeed, there is a risk of generating sentences that cause syntax errors, due to the auxiliary function [addlb], which rejects certain puns. * Mark some of the start symbols with [AVOID]. * Add one new test file in testsuite/tests/generated-parse-errors/errors.ml. This file was produced by [make generate-parse-errors]. This file contains: 1072 sentences whose start symbol is implementation. 5 sentences whose start symbol is use_file. 9 sentences whose start symbol is toplevel_phrase. The parser's output can be described as follows: 1086 syntax errors reported. 721 syntax errors without explanation. 365 syntax errors with an indication of what was expected. 307 syntax errors with an indication of an unmatched delimiter.
- Loading branch information
Showing
7 changed files
with
6,390 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.