Documentation ¶
Index ¶
- Constants
- func EscapePattern(s string) string
- type ASTAction
- type CompiledGrammar
- type CompiledLexModeSpec
- type Item
- type LexKindID
- type LexKindName
- type LexModeID
- type LexModeKindID
- type LexModeName
- type LexicalSpec
- type NonTerminal
- type Production
- type RRConflict
- type Reduce
- type Report
- type RowDisplacementTable
- type SRConflict
- type State
- type StateID
- type SyntacticSpec
- type Terminal
- type Transition
- type TransitionTable
- type UniqueEntriesTable
Constants ¶
View Source
const ( // StateIDNil represents an empty entry of a transition table. // When the driver reads this value, it raises an error meaning lexical analysis failed. StateIDNil = StateID(0) // StateIDMin is the minimum value of the state ID. All valid state IDs are represented as // sequential numbers starting from this value. StateIDMin = StateID(1) )
View Source
const ( LexModeIDNil = LexModeID(0) LexModeIDDefault = LexModeID(1) )
View Source
const ( LexModeNameNil = LexModeName("") LexModeNameDefault = LexModeName("default") )
View Source
const ( LexKindIDNil = LexKindID(0) LexKindIDMin = LexKindID(1) )
View Source
const ( LexModeKindIDNil = LexModeKindID(0) LexModeKindIDMin = LexModeKindID(1) )
View Source
const LexKindNameNil = LexKindName("")
Variables ¶
This section is empty.
Functions ¶
func EscapePattern ¶
EscapePattern escapes the special characters. For example, EscapePattern(`+`) returns `\+`.
Types ¶
type CompiledGrammar ¶
type CompiledGrammar struct { Name string `json:"name"` Lexical *LexicalSpec `json:"lexical"` Syntactic *SyntacticSpec `json:"syntactic"` ASTAction *ASTAction `json:"ast_action"` }
type CompiledLexModeSpec ¶
type CompiledLexModeSpec struct { KindNames []LexKindName `json:"kind_names"` Push []LexModeID `json:"push"` Pop []int `json:"pop"` DFA *TransitionTable `json:"dfa"` }
type LexKindID ¶
type LexKindID int
LexKindID represents an ID of a lexical kind and is unique across all modes.
type LexKindName ¶
type LexKindName string
LexKindName represents a name of a lexical kind.
func (LexKindName) String ¶
func (k LexKindName) String() string
type LexModeKindID ¶
type LexModeKindID int
LexModeKindID represents an ID of a lexical kind and is unique within a mode. Use LexKindID to identify a kind across all modes uniquely.
func (LexModeKindID) Int ¶
func (id LexModeKindID) Int() int
type LexModeName ¶
type LexModeName string
LexModeName represents a name of a lex mode.
func (LexModeName) String ¶
func (m LexModeName) String() string
type LexicalSpec ¶
type LexicalSpec struct { InitialModeID LexModeID `json:"initial_mode_id"` ModeNames []LexModeName `json:"mode_names"` KindNames []LexKindName `json:"kind_names"` KindIDs [][]LexKindID `json:"kind_ids"` CompressionLevel int `json:"compression_level"` Specs []*CompiledLexModeSpec `json:"specs"` }
type NonTerminal ¶
type Production ¶
type RRConflict ¶
type Report ¶
type Report struct { Terminals []*Terminal `json:"terminals"` NonTerminals []*NonTerminal `json:"non_terminals"` Productions []*Production `json:"productions"` States []*State `json:"states"` }
type RowDisplacementTable ¶
type SRConflict ¶
type State ¶
type State struct { Number int `json:"number"` Kernel []*Item `json:"kernel"` Shift []*Transition `json:"shift"` Reduce []*Reduce `json:"reduce"` GoTo []*Transition `json:"goto"` SRConflict []*SRConflict `json:"sr_conflict"` RRConflict []*RRConflict `json:"rr_conflict"` }
type SyntacticSpec ¶
type SyntacticSpec struct { Action []int `json:"action"` GoTo []int `json:"goto"` StateCount int `json:"state_count"` InitialState int `json:"initial_state"` StartProduction int `json:"start_production"` LHSSymbols []int `json:"lhs_symbols"` AlternativeSymbolCounts []int `json:"alternative_symbol_counts"` Terminals []string `json:"terminals"` TerminalCount int `json:"terminal_count"` TerminalSkip []int `json:"terminal_skip"` KindToTerminal []int `json:"kind_to_terminal"` NonTerminals []string `json:"non_terminals"` NonTerminalCount int `json:"non_terminal_count"` EOFSymbol int `json:"eof_symbol"` ErrorSymbol int `json:"error_symbol"` ErrorTrapperStates []int `json:"error_trapper_states"` RecoverProductions []int `json:"recover_productions"` }
type Transition ¶
type TransitionTable ¶
type TransitionTable struct { InitialStateID StateID `json:"initial_state_id"` AcceptingStates []LexModeKindID `json:"accepting_states"` RowCount int `json:"row_count"` ColCount int `json:"col_count"` Transition *UniqueEntriesTable `json:"transition,omitempty"` UncompressedTransition []StateID `json:"uncompressed_transition,omitempty"` }
type UniqueEntriesTable ¶
type UniqueEntriesTable struct { UniqueEntries *RowDisplacementTable `json:"unique_entries,omitempty"` UncompressedUniqueEntries []StateID `json:"uncompressed_unique_entries,omitempty"` RowNums []int `json:"row_nums"` OriginalRowCount int `json:"original_row_count"` OriginalColCount int `json:"original_col_count"` EmptyValue int `json:"empty_value"` }
Click to show internal directories.
Click to hide internal directories.