Parsing: parser support for parsers produced by fsyacc.
Parsers generated by fsyacc provide location information within parser
actions. However that information is not available globally, but
rather is accessed via the functions available on the following local
variable which is available in all parser actions:
parseState : 'a Microsoft.FSharp.Tools.FsYacc.IParseState
However, this is not compatible with the parser specifications used
with ocamlyacc and similar tools, which make a single parser state available
globally. If you wish to use a global parser state (e.g. so your code will
cross-compile with OCaml) then you can use the functions in this file.
You will need to either generate the parser with '--ml-compatibility' option
or add the code
Parsing.set_parse_state parseState;
at the start of each action of your grammar. The functions below
simply report the results of corresponding calls to the latest object
specified by a call to set_parse_state.
Note that there could be unprotected multi-threaded concurrent access for the
parser information, so you should not in general use these
functions if there may be more than one parser active, and
should instead use the functions directly available from the parseState
object.
Exceptions
Exception | Description |
exception Parse_error |
You can initialize error recovery by raising the Parse_error exception.
Note: an abbreviation for = RecoverableParseError |
Values
|