diff options
author | François Pottier <fpottier@users.noreply.github.com> | 2020-12-21 19:48:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-21 19:48:36 +0100 |
commit | b71521b84323791a7ad9e82250fe165477fac7f0 (patch) | |
tree | 0a35b314041d200b3ab27abdebb65a9cce89629b /.gitattributes | |
parent | b9172d4aeb75d978a715cee80c4217c71deb0649 (diff) | |
download | ocaml-b71521b84323791a7ad9e82250fe165477fac7f0.tar.gz |
Add one new test file containing 1086 tests of the syntax error messages (plus tooling) (#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.
Diffstat (limited to '.gitattributes')
-rw-r--r-- | .gitattributes | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes index 8bb98e6f3a..bc96223bf1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -111,6 +111,7 @@ testsuite/tests/misc-unsafe/almabench.ml typo.long-line testsuite/tests/tool-toplevel/strings.ml typo.utf8 testsuite/tests/win-unicode/*.ml typo.utf8 testsuite/tests/asmgen/immediates.cmm typo.very-long-line +testsuite/tests/generated-parse-errors/errors.* typo.very-long-line testsuite/tools/*.S typo.missing-header testsuite/tools/*.asm typo.missing-header testsuite/typing typo.missing-header |