lexer

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidUTF8 = errors.New("Invalid UTF-8 char")

Functions

func IsFirstIdentRune

func IsFirstIdentRune(char rune) bool

func IsIdentRune

func IsIdentRune(char rune) bool

Types

type Lexer

type Lexer struct {
	// contains filtered or unexported fields
}

func New

func New(source []byte) *Lexer

func NewFromReader

func NewFromReader(r io.Reader) (*Lexer, error)

func NewFromString

func NewFromString(source string) *Lexer

func (*Lexer) NextToken

func (l *Lexer) NextToken() (Token, error)

func (*Lexer) Tokens

func (l *Lexer) Tokens() ([]Token, error)

type Token

type Token struct {
	Type     TokenType
	Lexeme   string
	Position diag.Position
}

func (Token) String

func (t Token) String() string

type TokenType

type TokenType int
const (
	T_IDENT TokenType = iota
	T_STRING
	T_LPAREN
	T_RPAREN
	T_EOL
	T_EOF
)

func (TokenType) String

func (t TokenType) String() string

Jump to

Keyboard shortcuts

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