SIGN IN SIGN UP
reasonml / reason UNCLAIMED

Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems

0 0 0 OCaml
Reerror (#2480) * split reason_toolchain in a few sub-modules * Remove menhir error messages * removed more menhir-related error management * refactor errors in semantic actions * REMOVE ME: some notes * move more error management code to Reason_errors * recovery annotations * add recovery tool * build recovery * WIP lexer -> declarative_lexer, remove state * rewrite lexer to isolate state * factor the deterministic parser out of reason_toolchain * implement support for POSTFIX * introduce reason-multi-parser * Switch on recovery * add TODO plan * oops, better to recover more than one token * fix invalid docstrings merging * fix DOCSTRING parsing * fishy printing * recovery is now optional * update TODO * attach errors for intf and impl * Implement slightly better error messages * Update reason.opam * handle EOF * Use Migrate_parsetree.Ast_404 instead of Ast_404 Modules are being namespaced, direct access is now deprecated and will be removed (at some unknown point in the future). * Reenable previous error messages (through Reason_parser_explain) * detect unclosed parentheses * TEMPORARY: tweak unclosed parenthesis error message Still broken, the analysis can be improved * TEMPORARY: disable JSX error messages on recovery Recovery generates empty closing tag * wip: distinguish recovery errors * insert extension nodes only in recovery mode * build with 4.02 * instrument reason-error message printer * raise fatal errors if not using Reason_config.recoverable * no need for lexer_report_error * fix reporting of errors * refactor version-dependent definitions * move error manipulation to reason_syntax_util * menhir-recover: hide warnings about recover.cost attribute on production * fix error reporting (pre 4.08) * update more tests * Abstract version-dependent compiler-libs definitions to ocaml_util.ml Fix build with all versions of OCaml * update tests * add fix dependency to esy * fix tests
2019-10-28 23:04:56 -07:00
Fix error recovery & error reporting
Step 1: remove existing implementation
OK * Put reason parser in its own file
OK * Remove menhir error management:
OK - remove "error" token
OK - remove error messages infrastructure
OK Now message defaults to "Syntax error"
* Fix reported error location (when recovering or not)
Step 2: reintroduce recovery
* Preprocess grammar:
- check exhaustivity of recovery
- produce a mapping of automaton states to automaton-items suitable for
recovery
* Instrument parser:
- first, always complete the AST and drop user input (":'(")
- second, introduce an heuristic for recovering based on location
Step 3: reintroduce error messages
* Ask the crowd:
What should messages look like?
Which situations are tricky or counter-intuitive?
* Make a testsuite representative of common syntax errors
* ... Design an analysis sufficient to produce the messages automatically
:P