Grammar.ExtSmodule EState : sig ... endmodule GState : sig ... endinclude S with type keyword_state := keyword_state and type 'a with_gstate := GState.t -> 'a and type 'a with_kwstate := keyword_state -> 'a and type
'a with_estate := EState.t -> 'a and type 'a mod_estate := EState.t -> EState.t * 'atype 'a parser_v = ('a, peek_error) Stdlib.resultRecoverable parsing errors are signaled use Error. To be correctly recovered we must not have consumed any tokens since the last choice point, ie we only peeked at the stream.
Other errors are signaled using the ParseError exception or even arbitrary exceptions.
Type combinators to factor the module type between explicit state passing in Grammar and global state in Procq
module Parsable : sig ... endmodule Entry : sig ... endmodule Symbol : sig ... endmodule Rule : sig ... endmodule Rules : sig ... endmodule Production : sig ... endtype 'a single_extend_statement = string option * Gramext.g_assoc option * 'a Production.t listtype 'a extend_statement = | Reuse of string option * 'a Production.t list | (* Extend an existing level by its optional given name. If None, picks the topmost level. *) |
| Fresh of Gramext.position * 'a single_extend_statement list | (* Create a level at the given position. *) |
val safe_extend : 's add_kw -> EState.t -> 's -> 'a Entry.t -> 'a extend_statement -> EState.t * 'smodule Unsafe : sig ... end