symbols

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Support for the symbols of the language defined by the input grammar, G. This package supports code generation.

Index

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 NewSymbols(grammar *ast.Grammar) *Symbols

func (*Symbols) Add

func (this *Symbols) Add(symbols ...string)

func (*Symbols) Id

func (this *Symbols) Id(typ int) string

func (*Symbols) IsTerminal

func (this *Symbols) IsTerminal(sym string) bool

func (*Symbols) List

func (this *Symbols) List() []string

func (*Symbols) ListStringLitSymbols

func (this *Symbols) ListStringLitSymbols() []string

ListStringLitSymbols will return a slice containing the ids of all symbols declared as string literals in the grammar.

func (*Symbols) ListTerminals

func (this *Symbols) ListTerminals() []string

func (*Symbols) NTId

func (this *Symbols) NTId(idx int) string

NTId will return the id of the NT with index idx, or "" if there is no NT symbol with index, idx.

func (*Symbols) NTList

func (this *Symbols) NTList() []string

NTList returns a slice containing all the non-terminal symbols of the grammar.

func (*Symbols) NTType

func (this *Symbols) NTType(symbol string) int

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

func (this *Symbols) NumNTSymbols() int

NumNTSymbols will return the number of NT symbols in the grammar.

func (*Symbols) NumSymbols

func (this *Symbols) NumSymbols() int

NumSymbols returns the total number of symbols in grammar: the sum of the terminals and non-terminals.

func (*Symbols) String

func (this *Symbols) String() string

func (*Symbols) StringLitType

func (this *Symbols) StringLitType(id string) int

func (*Symbols) Type

func (this *Symbols) Type(id string) int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL