|
1 | | -(** Parsing error messages handler. |
2 | | - The .ml file corresponding to this mli is generated automatically generated |
3 | | - by menhir (check the dune file) from the [mparser.messages] file. This file |
4 | | - is the core of parsing message handling: this is where all error messages |
5 | | - must be added. |
| 1 | +(** Parsing error messages handler. The .ml file corresponding to this mli is |
| 2 | + generated automatically generated by menhir from the [syntax.messages] file. |
| 3 | + This file is the core of parsing message handling: this is where all error |
| 4 | + messages must be added. |
6 | 5 |
|
7 | | - The structure of the [mparser.messages] strongly depends on the parser's. If |
| 6 | + The structure of the [syntax.messages] strongly depends on the parser's. If |
8 | 7 | the parser changes, it may be necessary to rework on it to update the error |
9 | 8 | messages. Hopefully, [menhir] comes with a way to automatically update |
10 | 9 | messages when the parser changes. This can be automatically done by running |
11 | 10 | [dune runtest --auto-promote]. Check the [src/mlang/m_frontend/dune] file |
12 | 11 | for more information. |
13 | 12 |
|
14 | 13 | Each possible error is mapped to a state (an integer) and a custom message |
15 | | - in the [mparser.messages] file. When the parser raises an exception, it also |
16 | | - raises the state where it failed. This module allows to get the |
| 14 | + in the [syntax.messages] file. When the parser raises an exception, it also |
| 15 | + raises the state in which it failed. This module allows to get the |
17 | 16 | corresponding error message. |
18 | 17 |
|
19 | | - There is then three possibilities: |
20 | | - * the state has a custom error message, which can be printed; |
21 | | - * the state has the default error message (<"YOUR SYNTAX ERROR MESSAGE HERE>"), |
22 | | - which has not been written yet; |
23 | | - * the state has no error message, which should not happen unless the |
24 | | - [mparser.messages] is not sync with [mparser.mly]. |
25 | | - *) |
| 18 | + There is then three possibilities: * the state has a custom error message, |
| 19 | + which can be printed; * the state has the default error message (<"YOUR |
| 20 | + SYNTAX ERROR MESSAGE HERE>"), which has not been customized yet; * the state |
| 21 | + has no error message, which should happen only if the [syntax.messages] is |
| 22 | + not sync with [mparser.mly]. *) |
26 | 23 |
|
27 | 24 | val message : int -> string |
28 | | -(** Returns the error message corresponding to a parser error state. |
29 | | - Raises [Not_found] if the state has no error message. *) |
| 25 | +(** Returns the error message corresponding to a parser error state. Raises |
| 26 | + [Not_found] if the state has no error message. *) |
0 commit comments