module Grammar: sig end
-
Extensible grammars.
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
-
The type for grammars, holding entries.
val gcreate : Token.t Token.glexer -> g
-
Create a new grammar, without keywords, using the lexer given
as parameter.
val tokens : g -> string -> (string * int) list
-
Given a grammar and a token pattern constructor, returns the list of
the corresponding values currently used in all entries of this grammar.
The integer is the number of times this pattern value is used.
Examples:
- If the associated lexer uses ("", xxx) to represent a keyword
(what is represented by then simple string xxx in an
EXTEND
statement rule), the call Grammar.token g ""
returns the keywords
list.
- The call
Grammar.token g "IDENT"
returns the list of all usages
of the pattern "IDENT" in the EXTEND
statements.
module Entry: sig end
Module to handle entries.
val of_entry : 'a Entry.e -> g
-
Return the grammar associated with an entry.
Clearing grammars and entries
|
|
module Unsafe: sig end
Module for clearing grammars and entries.
Alternative for grammars use. Grammars are no more Ocaml values:
there is no type for them. Modules generated preserve the
rule "an entry cannot call an entry of another grammar" by
normal OCaml typing.
module type GLexerType = sig end
The input signature for the functor Grammar.GMake
: te
is the
type of the tokens.
module type S = sig end
Signature type of the functor Grammar.GMake
.
module GMake: functor (L : GLexerType) -> sig end
val error_verbose : bool ref
-
Flag for displaying more information in case of parsing error;
default =
False
val warning_verbose : bool ref
-
Flag for displaying warnings while extension; default =
True
val strict_parsing : bool ref
-
Flag to apply strict parsing, without trying to recover errors;
default =
False
val print_entry : Format.formatter -> 'a Gramext.g_entry -> unit
-
General printer for all kinds of entries (obj entries)