Cobol_parser
module Options : sig ... end
Options to tune the parser engine
module Outputs : sig ... end
Output types for the engine
module Diagnostics : sig ... end
module Tokens : sig ... end
module Expect : sig ... end
module Printer : sig ... end
module Keywords : sig ... end
module Grammar_interpr : sig ... end
type 'm simple_parsing =
options:Cobol_parser__.Parser_options.parser_options ->
Cobol_preproc.preprocessor ->
(Cobol_ptree.compilation_group option, 'm)
Cobol_parser__.Parser_outputs.output
Cobol_common__Diagnostics_accumulator.MAKE(Cobol_parser__.Parser_diagnostics.ALL).TYPES.with_diags
Simple parsing functions traverse the inputs once to produce a result.
val parse_simple : Cobol_common.Behaviors.amnesic simple_parsing
Simple parsing function that does not return any artifact.
val parse_with_artifacts : Cobol_common.Behaviors.eidetic simple_parsing
Simple parsing function does return some artifacts.
type 'm rewindable_parsing =
options:Cobol_parser__.Parser_options.parser_options ->
Cobol_preproc.preprocessor ->
((Cobol_ptree.compilation_group option, 'm)
Cobol_parser__.Parser_outputs.output as 'x
* 'x rewinder)
Cobol_common__Diagnostics_accumulator.MAKE(Cobol_parser__.Parser_diagnostics.ALL).TYPES.with_diags
Rewindable parsing functions extend the behaviors of simple parsing functions, with the ability to rewind the parser (and pre-processor) before a given lexing position. To this end, their results include a rewinder
that may then be given to rewind_and_parse
.
and preprocessor_rewind =
last_pp:Cobol_preproc.preprocessor as 'r ->
?new_position:Stdlib.Lexing.position ->
'r ->
'r
Functions for rewinding the pre-processor. Such a function should return a preprocessor in the exact same state as the one given in (unlabelled) argument, with the only exception that the input text is now read from new_position
.
last_pp
is the state of the pre-processor at the end of the previous call to rewindable_parse_simple
, rewindable_parse_with_artifacts
, or rewind_and_parse
operation: it may be used to translate positions that follow the last piece of input seen by the unlabelled preprocessor argument.
If new_position
is not given, the text should be read from the very beginning of the input.
val rewindable_parse_simple : Cobol_common.Behaviors.amnesic rewindable_parsing
Rewindable parsing function that does not return any artifact.
val rewindable_parse_with_artifacts :
Cobol_common.Behaviors.eidetic rewindable_parsing
Rewindable parsing function that does return some artifacts.
val rewind_and_parse :
'x rewinder ->
preprocessor_rewind ->
position:position ->
((Cobol_ptree.compilation_group option, 'm)
Cobol_parser__.Parser_outputs.output as 'x
* 'x rewinder)
Cobol_common__Diagnostics_accumulator.MAKE(Cobol_parser__.Parser_diagnostics.ALL).TYPES.with_diags
rewind_and_parse rewinder preprocessor_rewind ~position
uses rewinder
to restart parsing before the given position
. Note that the new_position
argument that is given to preprocessor_rewind
may not correspond to position
, as the parser typically needs to rewind earlier than position
.
Type of parser states that can be inspected using the interpreter that is generated by menhir (cf INSPECT
).
val rewind_for_inspection :
'x rewinder ->
preprocessor_rewind ->
position:position ->
inspect:(inspectable_parser_state -> 'a) ->
'a
Note: given parser state should not escapre inspect
.
val artifacts :
(_, Cobol_common.Behaviors.eidetic) Cobol_parser__.Parser_outputs.output ->
Cobol_parser__.Parser_outputs.artifacts
Signatures of modules below may change unexpectedly.
module INTERNAL : sig ... end