lexer

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 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

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

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 Reader added in v0.1.4

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

func NewReader added in v0.1.4

func NewReader(r io.Reader) *Reader

func (*Reader) PeekByte added in v0.1.4

func (r *Reader) PeekByte() (byte, error)

func (*Reader) PeekRune added in v0.1.4

func (r *Reader) PeekRune() (rune, int, error)

func (*Reader) ReadByte added in v0.1.4

func (r *Reader) ReadByte() (byte, error)

func (*Reader) ReadRune added in v0.1.4

func (r *Reader) ReadRune() (rune, int, 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