lexer

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const EOF = -1

Variables

This section is empty.

Functions

func IsAlphaNumeric

func IsAlphaNumeric(r rune) bool

IsAlphaNumeric reports whether r is an alphabetic, digit, or underscore.

func NextChar

func NextChar(input string) (rune, int)

func TrimLeftSpace

func TrimLeftSpace(input string) string

Types

type BaseToken

type BaseToken struct {
	Typ TokenType
	Val string
}

func (*BaseToken) Type

func (t *BaseToken) Type() TokenType

func (*BaseToken) Value

func (t *BaseToken) Value() string

type Delim

type Delim string

type FSMState

type FSMState interface {
	Init() fsm.State
	EoF() fsm.State
	Mapping() map[fsm.State]StateHandler
}

type Lexer

type Lexer interface {
	Next() Token
	Tokens() Tokens
	Emit(t Token)
}

func New

func New(input string, sms FSMState) (Lexer, error)

type StateHandler

type StateHandler func(lex Lexer) fsm.StateHandler

type Token

type Token interface {
	Type() TokenType
	Value() string
}

type TokenType

type TokenType int
const (
	TokenEOF TokenType = iota
)

type Tokens

type Tokens []Token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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