Module Earley_str
Earley support for Str
regular expressions.
val blank_regexp : string -> Earley_core.Input.buffer -> int -> Earley_core.Input.buffer * int
blank_regexp re
produces a blank function from the regexpre
(following theStr
syntax). There is an important limitation rega- rding regular expressions containing the newline character'\n'
, due to the fact that theStr
module only matches on strings (and not on an abstract notion of buffer). Such regular expressions can only be used if they are idempotent.
val regexp : ?name:string -> string -> ((int -> string) -> 'a) -> 'a Earley_core.Earley.grammar
regexp ?name re g
is a grammar that parses the input according to the regular expressionre
, and returns a value built by applying the functiong
to a function of typeint -> string
that returns the substring matched by then
-th match group of the regexpre
(as in theStr
module). The optionalname
argument is used to refer to the regular expression in error messages.