module Op: sig .. end
Open this module to bring the operator functions for woven parsers into
the current scope.
include Cf_lex.Expr_Op_T
Include the expression operators common among lexical analyzers.
val ($=) : Cf_lex.x -> 'a -> (char #Cf_parser.cursor, 'a) Cf_lex.X.r
Literal token rule. Use e $= obj to compose a rule that outputs
the literal object obj when the expression e is recognized.
val ($>) : Cf_lex.x -> (string -> 'a) -> (char #Cf_parser.cursor, 'a) Cf_lex.X.r
String token rule. Use e $> f to compose a rule that applies the
string recognized by the expression e to the tokenizer function
f to produce its result.
val ($@) : Cf_lex.x ->
(int -> (char #Cf_parser.cursor as 'b, 'a) Cf_lex.X.t) -> ('b, 'a) Cf_lex.X.r
Advanced token rule. Use e $@ f to compose a rule that applies
the length of the character sequence recognized by the expression
e to the advanced tokenizer function f to obtain a parser that
produces the output of the rule and makes any other manipulations
necessary to continue parsing the input stream. If the parser
returned by f does not recognize the input, then no output is
produced and no other rules are matched.
val (!@) : (char #Cf_parser.cursor as 'b, 'a) Cf_lex.X.r list -> ('b, 'a) Cf_lex.X.r
Rule aggregation. Use this operator to combine a list of rules
into a single rule.
val ?~ : Cf_lex.x -> (char #Cf_parser.cursor, string) Cf_lex.X.t
String parser. Use ?~x to create a simple parser that recognizes
any string that matches the expression x. Note: Care should
be taken when composing parsers with this operator to keep the lazy
DFA from being recreated in every pass.
val ?$ : string -> (char #Cf_parser.cursor, string) Cf_lex.X.t
String parser. Use
?$s to create a simple parser that recognizes
any string that matches the regular expression specified in the
string
s according to the grammar in the
Cf_regex module.
Raises
Cf_regex.Error if the string is not a regular expression.
Note: Care should be taken when composing parsers with this
operator to keep from parsing the argument string in every pass.