Module Info.SymbolSource

include INDEXED with type 'g n = 'g symbol
Sourcetype 'g n = 'g symbol
Sourceval cardinal : 'g grammar -> 'g n Fix.Indexing.cardinal
Sourceval of_int : 'g grammar -> int -> 'g n Fix.Indexing.index

Discriminated union of terminal and nonterminal indices

Sourceval desc : 'g grammar -> 'g n Fix.Indexing.index -> 'g desc

Returns the symbol as a discriminated union: T for terminals, N for non-terminals

Sourceval is_terminal : 'g grammar -> 'g n Fix.Indexing.index -> bool

Returns true if the symbol is a terminal

Sourceval is_nonterminal : 'g grammar -> 'g n Fix.Indexing.index -> bool

Returns true if the symbol is a non-terminal

Sourceval to_string : 'g grammar -> ?mangled:bool -> 'g n Fix.Indexing.index -> string

Converts a symbol index to its name string. With mangled:true, returns the mangled name used internally by Menhir.

Sourceval semantic_value : 'g grammar -> 'g n Fix.Indexing.index -> string option

semantic_value s returns the semantic value type of symbol s. Returns Some "unit" for unparameterized terminals.

all g is the set of all symbols (terminals and non-terminals) in grammar g

Inject a terminal index into the symbol index space

Inject a nonterminal index into the symbol index space

Sourceval find : 'g grammar -> ?approx:int -> string -> ('g n Fix.Indexing.index, [ `Mangled of 'g nonterminal Fix.Indexing.index | `Dym of (int * string * 'g n Fix.Indexing.index) list ]) Stdlib.result

Finds a symbol (terminal or nonterminal) by name. Checks both regular and mangled names. Returns disambiguation suggestions when the name is not found and approx > 0.