Versions in this module Expand all Collapse all v0 v0.6.0 Nov 9, 2022 Changes in this version + func GenLexer(lexSpec *spec.LexicalSpec, pkgName string) ([]byte, error) + func NewLexSpec(spec *spec.LexicalSpec) *lexSpec + type KindID int + func (id KindID) Int() int + type LexSpec interface + Accept func(mode ModeID, state StateID) (ModeKindID, bool) + InitialMode func() ModeID + InitialState func(mode ModeID) StateID + KindIDAndName func(mode ModeID, modeKind ModeKindID) (KindID, string) + ModeName func(mode ModeID) string + NextState func(mode ModeID, state StateID, v int) (StateID, bool) + Pop func(mode ModeID, modeKind ModeKindID) bool + Push func(mode ModeID, modeKind ModeKindID) (ModeID, bool) + type Lexer struct + func NewLexer(spec LexSpec, src io.Reader, opts ...LexerOption) (*Lexer, error) + func (l *Lexer) Mode() ModeID + func (l *Lexer) Next() (*Token, error) + func (l *Lexer) PopMode() error + func (l *Lexer) PushMode(mode ModeID) + type LexerOption func(l *Lexer) error + func DisableModeTransition() LexerOption + type ModeID int + func (id ModeID) Int() int + type ModeKindID int + func (id ModeKindID) Int() int + type StateID int + func (id StateID) Int() int + type Token struct + Col int + EOF bool + Invalid bool + KindID KindID + Lexeme []byte + ModeID ModeID + ModeKindID ModeKindID + Row int