Documentation ¶
Index ¶
- Constants
- func EscapePattern(s string) string
- func FindSpellingInconsistencies(ids []string) [][]string
- func SnakeCaseToUpperCamelCase(snake string) string
- type CompiledLexModeSpec
- type CompiledLexSpec
- type LexEntry
- type LexKindID
- type LexKindName
- type LexModeID
- type LexModeKindID
- type LexModeName
- type LexPattern
- type LexSpec
- type RowDisplacementTable
- type StateID
- type TransitionTable
- type UniqueEntriesTable
Constants ¶
const ( LexKindIDNil = LexKindID(0) LexKindIDMin = LexKindID(1) )
const ( LexModeKindIDNil = LexModeKindID(0) LexModeKindIDMin = LexModeKindID(1) )
const ( LexModeIDNil = LexModeID(0) LexModeIDDefault = LexModeID(1) )
const ( LexModeNameNil = LexModeName("") LexModeNameDefault = LexModeName("default") )
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) )
const LexKindNameNil = LexKindName("")
Variables ¶
This section is empty.
Functions ¶
func EscapePattern ¶ added in v0.2.0
EscapePattern escapes the special characters. For example, EscapePattern(`+`) returns `\+`.
func FindSpellingInconsistencies ¶ added in v0.5.1
FindSpellingInconsistencies finds spelling inconsistencies in identifiers. The identifiers are considered to be the same if they are spelled the same when expressed in UpperCamelCase. For example, `left_paren` and `LeftParen` are spelled the same in UpperCamelCase. Thus they are considere to be spelling inconsistency.
func SnakeCaseToUpperCamelCase ¶ added in v0.5.1
Types ¶
type CompiledLexModeSpec ¶
type CompiledLexModeSpec struct { KindNames []LexKindName `json:"kind_names"` Push []LexModeID `json:"push"` Pop []int `json:"pop"` DFA *TransitionTable `json:"dfa"` }
type CompiledLexSpec ¶
type CompiledLexSpec struct { Name string `json:"name"` 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 LexEntry ¶
type LexEntry struct { Kind LexKindName `json:"kind"` Pattern LexPattern `json:"pattern"` Modes []LexModeName `json:"modes"` Push LexModeName `json:"push"` Pop bool `json:"pop"` Fragment bool `json:"fragment"` }
type LexKindID ¶ added in v0.3.0
type LexKindID int
LexKindID represents an ID of a lexical kind and is unique across all modes.
type LexKindName ¶ added in v0.3.0
type LexKindName string
LexKindName represents a name of a lexical kind.
func (LexKindName) String ¶ added in v0.3.0
func (k LexKindName) String() string
type LexModeKindID ¶ added in v0.3.0
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 ¶ added in v0.3.0
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 LexPattern ¶
type LexPattern string
LexPattern represents a pattern of a lexeme. The pattern is written in regular expression.
type RowDisplacementTable ¶
type StateID ¶ added in v0.3.0
type StateID int
StateID represents an ID of a state of a transition table.
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"` }