Documentation ¶
Overview ¶
Support for the symbols of the language defined by the input grammar, G. This package supports code generation.
Index ¶
- type Symbols
- func (this *Symbols) Add(symbols ...string)
- func (this *Symbols) Id(typ int) string
- func (this *Symbols) IsTerminal(sym string) bool
- func (this *Symbols) List() []string
- func (this *Symbols) ListStringLitSymbols() []string
- func (this *Symbols) ListTerminals() []string
- func (this *Symbols) NTId(idx int) string
- func (this *Symbols) NTList() []string
- func (this *Symbols) NTType(symbol string) int
- func (this *Symbols) NumNTSymbols() int
- func (this *Symbols) NumSymbols() int
- func (this *Symbols) String() string
- func (this *Symbols) StringLitType(id string) int
- func (this *Symbols) Type(id string) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Symbols ¶
type Symbols struct {
// contains filtered or unexported fields
}
func NewSymbols ¶
func (*Symbols) IsTerminal ¶
func (*Symbols) ListStringLitSymbols ¶
ListStringLitSymbols will return a slice containing the ids of all symbols declared as string literals in the grammar.
func (*Symbols) ListTerminals ¶
func (*Symbols) NTId ¶
NTId will return the id of the NT with index idx, or "" if there is no NT symbol with index, idx.
func (*Symbols) NTList ¶
NTList returns a slice containing all the non-terminal symbols of the grammar.
func (*Symbols) NTType ¶
NTType returns the NT index of a symbol (index in 0..|NT|-1) or -1 if the symbol is not in NT.
func (*Symbols) NumNTSymbols ¶
NumNTSymbols will return the number of NT symbols in the grammar.
func (*Symbols) NumSymbols ¶
NumSymbols returns the total number of symbols in grammar: the sum of the terminals and non-terminals.