Module Cf_parser.X


module X: sig .. end
A module of parser extensions for working with input sequences that require position information in the parse function.

type ('a #Cf_parser.cursor, 'b, 'c) t = ('b * ('a #Cf_parser.cursor as 'd)) Cf_seq.t ->
('c * ('b * 'd) Cf_seq.t) option
A parser where every token in the input sequence is accompanied by a Cf_parser.cursor class object.
val weave : c:('b #Cf_parser.cursor as 'a) -> 'b Cf_seq.t -> ('b * 'a) Cf_seq.t
Use weave ~c i with an initial cursor c and an input sequence i to create an input sequence with accompanying cursor.
val sat : ('a -> bool) -> ('b #Cf_parser.cursor, 'a, 'a) t
Use sat f to create a parser that recognizes, shifts and reduces input tokens for which the satisfier function f returns true.
val tok : ('a -> 'b option) -> ('c #Cf_parser.cursor, 'a, 'b) t
Use tok f to recognize and shift input tokens for which the tokenizer function f reduces an output value.
val lit : string -> 'a -> ('b #Cf_parser.cursor, char, 'a) t
Use lit s obj to obtain a parser on character input sequences that produces the output obj when it recognizes the literal s in the input.
val unfold : ('b #Cf_parser.cursor as 'a, 'c, 'd) t ->
('c * 'a) Cf_seq.t -> ('d * 'a) Cf_seq.t
Use unfold p i to create a sequence of output values recognized by applying the input token sequence i to the parser p until no more input is recognized. The cursor objects in the output sequence elements correspond to the positions of the input sequence at the start of where the output was recognized.