lexer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsKeyword

func IsKeyword(s string) bool

Types

type Lexer

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

func New

func New(input string) *Lexer

func (*Lexer) Tokenize

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

type LexerError

type LexerError struct {
	Line    int
	Column  int
	Message string
}

func (*LexerError) Error

func (e *LexerError) Error() string

type LexerErrors

type LexerErrors struct {
	Errors []error
}

func (*LexerErrors) Error

func (e *LexerErrors) Error() string

func (*LexerErrors) Unwrap

func (e *LexerErrors) Unwrap() []error

type Token

type Token struct {
	Type     TokenType
	Value    string
	Line     int
	Column   int
	Position int
}

func (Token) IsEOF

func (t Token) IsEOF() bool

func (Token) IsError

func (t Token) IsError() bool

func (Token) IsKeyword

func (t Token) IsKeyword(name string) bool

func (Token) String

func (t Token) String() string

type TokenType

type TokenType int
const (
	TokenEOF TokenType = iota
	TokenError
	TokenInteger
	TokenFloat
	TokenString
	TokenBoolean
	TokenNull
	TokenIdentifier
	TokenPlus
	TokenStar
	TokenSlash
	TokenPercent
	TokenCaret
	TokenEq
	TokenNeq
	TokenLt
	TokenLe
	TokenGt
	TokenGe
	TokenAnd
	TokenOr
	TokenNot
	TokenXor
	TokenLParen
	TokenRParen
	TokenLBrace
	TokenRBrace
	TokenLBracket
	TokenRBracket
	TokenColon
	TokenComma
	TokenDot
	TokenSemicolon
	TokenPipe
	TokenArrowRight
	TokenArrowLeft
	TokenDash
	TokenPlusEq
	TokenRange
	TokenDollar
)

Jump to

Keyboard shortcuts

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