Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Fmlib_parse.Error_reporter
Convenience module to generate readable error messages.
An error reporter is a parser which reparses the input stream, extracts the failed code snippet and prints the error nicely formatted.
For semantic errors, the module needs support from the user to convert a semantic error into a pretty print document.
The error reporter generates a pretty print document (details about pretty print documents see Fmlib_pretty.Print) of the form
code snippet containing the error with markers at the error
description of the error
The description of the error is in case of a syntax error a description of what might have been expected at the error position and in case of a semantic error whatever the user provides as an error description.
The generated error report has one of the following forms:
Syntax error:
25 | xxxx
26 |
27 | line with error
^
I have encountered something unexpected. I was expecting one of
- xxx
- yyy
- zzz
...
Semantic error on one line:
25 | xxxx
26 |
27 | line with error
^^^^^
User supplied description of the semantic error
Semantic error spanning several lines
25 | xxxx
26 |
v----------
27 | xxx yyy error start
28 | err err err err err
29 | err err err
30 | err error end zzz
-----------------^
User supplied description of the semantic error