module Grammar: sig end
This module implements the Camlp4 extensible grammars system.
Grammars entries can be extended using the EXTEND
statement,
added by loading the Camlp4 pa_extend.cmo
file.
type
g
val gcreate : Token.t Token.glexer -> g
val tokens : g -> string -> (string * int) list
Examples:
EXTEND
statement rule), the call Grammar.token g ""
returns the keywords
list.Grammar.token g "IDENT"
returns the list of all usages
of the pattern "IDENT" in the EXTEND
statements.val glexer : g -> Token.t Token.glexer
module Entry: sig end
val of_entry : 'a Entry.e -> g
Clearing grammars and entries
|
module Unsafe: sig end
Functorial interface
|
module type GLexerType = sig end
Grammar.GMake
: te
is the
type of the tokens.
module type S = sig end
Grammar.GMake
.
module GMake: functor (L : GLexerType) -> sig end
Miscellaneous
|
val error_verbose : bool ref
False
val warning_verbose : bool ref
True
val strict_parsing : bool ref
False
val print_entry : Format.formatter -> 'a Gramext.g_entry -> unit
val iter_entry : ('a Gramext.g_entry -> unit) -> 'a Gramext.g_entry -> unit
Grammar.iter_entry f e
applies f
to the entry e
and
transitively all entries called by e
. The order in which
the entries are passed to f
is the order they appear in
each entry. Each entry is passed only once.val fold_entry : ('a Gramext.g_entry -> 'b -> 'b) -> 'a Gramext.g_entry -> 'b -> 'b
Grammar.fold_entry f e init
computes (f eN .. (f e2 (f e1 init)))
,
where e1 .. eN
are e
and transitively all entries called by e
.
The order in which the entries are passed to f
is the order they
appear in each entry. Each entry is passed only once.