package catala
Install
Dune Dependency
Authors
Maintainers
Sources
md5=4c6f725ef4d21c5ff91f60d74b454ef7
sha512=98806e03daa6f33740b80a0f78a37320fb70ebea8cb927ea8fed022673459189c32e2389ccba0fa25d93f754b0fa0128a5ee28e1bb9abefa330deb4be8cc7d95
doc/catala.surface/Surface/Parser_driver/index.html
Module Surface.Parser_driver
Source
Wrapping module around parser and lexer that offers the parse_source_file
API
Internal functions
Three-way minimum
Computes the levenshtein distance between two strings, used to provide error messages suggestions
Style with which to display syntax hints in the terminal output
Usage: raise_parser_error error_loc last_good_loc token msg
Raises an error message featuring the error_loc
position where the parser has failed, the token
on which the parser has failed, and the error message msg
. If available, displays last_good_loc
the location of the last token correctly parsed.
val fail :
Sedlexing.lexbuf ->
'semantic_value I.env ->
(string * Parser.token) list ->
'semantic_value I.env option ->
'a
Usage: fail lexbuf env token_list last_input_needed
Raises an error with meaningful hints about what the parsing error was. lexbuf
is the lexing buffer state at the failure point, env
is the Menhir environment and last_input_needed
is the last checkpoint of a valid Menhir state before the parsing error. token_list
is provided by things like Surface.Lexer.token_list_language_agnostic
and is used to provide suggestions of the tokens acceptable at the failure point
val loop :
(unit -> Parser.token * Lexing.position * Lexing.position) ->
(string * Parser.token) list ->
Sedlexing.lexbuf ->
Ast.source_file_or_master I.env option ->
Ast.source_file_or_master I.checkpoint ->
Ast.source_file_or_master
Main parsing loop
val sedlex_with_menhir :
(Sedlexing.lexbuf -> Parser.token) ->
(string * Parser.token) list ->
(Lexing.position -> Ast.source_file_or_master I.checkpoint) ->
Sedlexing.lexbuf ->
Ast.source_file_or_master
Stub that wraps the parsing main loop and handles the Menhir/Sedlex type difference for lexbuf
.
API
Parses a single source file
Expands the include directives in a parsing result, thus parsing new source files