Make.Parse
val syntax_error_ref : bool State.key
A key to determine whether to print a syntax error identifier/reference in Syntax error messages. Mainly useful when debugging syntax error messages.
The interactive prompt key. This is used to determine whether we are parsing in interactive mode, and if so, what prelude to print before parsing each toplevel phrase.
val interactive_prompt_lang : State.t -> string option
A standard implementation for the interactive prompt key/function. When the logic input is set to `Stdin, it will return a prompt string prelude that contains the currently set input language.
val init :
?syntax_error_ref:bool ->
?interactive_prompt:(State.t -> string option) ->
State.t ->
State.t
Init a state with all the relevant keys for this pipeline.
val parse_logic :
?preludes:Dolmen_loop.Logic.language Dolmen_loop.State.file list ->
Dolmen_loop.Logic.language Dolmen_loop.State.file ->
State.t ->
State.t * Dolmen.Std.Statement.t option
Parsing function. Builds a statement generator from a file.
The prelude files in preludes
must not have a `Stdin
source, and are parsed first. They may have a different language than the main file, and do not influence language detection for the main file.
val parse_response :
Dolmen.Std.Answer.t list ->
State.t ->
Dolmen_loop.Response.language Dolmen_loop.State.file ->
State.t * (State.t -> State.t * Dolmen.Std.Answer.t option)
Parsing function. Reads a list of prelude statements, and the state and returns a tuple of the new state (including the detected input language), together with a statement generator.
val expand :
State.t ->
Dolmen.Std.Statement.t ->
State.t
* [ `Ok
| `Gen of
(State.t ->
State.t ->
State.t)
* (State.t ->
State.t * Dolmen.Std.Statement.t option) ]
Expand statements (such as includes). Returns the new state, and either:
`Ok
, which means the statement can be propagated as is `Gen (flat, g)
, if the statement expands into a generator g
. The bool flat
indicates wether the statements in g
should be treated as a single group of statements (with regards to timeouts, etc...), or as a list of independant statements (each with its own timeout...).