lexer

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

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

func New

func New(input string) *Lexer

func (*Lexer) NextToken

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

type Token

type Token struct {
	Type TokenType
	// Lexeme is the semantic spelling. For identifiers it is NFC-normalized.
	Lexeme string
	// RawLexeme preserves the exact source spelling for source ranges and display.
	RawLexeme string
	Line      int
	Column    int
}

func (Token) SourceLength added in v1.0.0

func (token Token) SourceLength() int

func (Token) SourceLexeme added in v1.0.0

func (token Token) SourceLexeme() string

SourceLexeme returns the bytes occupied by this token in the original source.

type TokenType

type TokenType int
const (
	TokenEOF TokenType = iota
	TokenIdentifier
	TokenSelf
	TokenDollar

	TokenFrom
	TokenImport
	TokenBind
	TokenAliasKeyword
	TokenSchema
	TokenGenDoc
	TokenSchemaDoc
	TokenArray
	TokenUnion
	TokenVariant
	TokenChoice
	TokenMatch
	TokenRecord
	TokenStringType
	TokenIntType
	TokenFloatType
	TokenHexIntType
	TokenHexFloatType
	TokenBooleanType
	TokenOutput
	TokenSchemaFile
	TokenParse
	TokenParseFile
	TokenData
	TokenNull

	TokenString
	TokenInt
	TokenFloat
	TokenHexInt
	TokenHexFloat
	TokenBoolean

	TokenAssign
	TokenArrow
	TokenSemicolon
	TokenComma
	TokenColon
	TokenQuestion
	TokenCoalesce
	TokenOptionalDot
	TokenDot

	TokenPlus
	TokenMinus
	TokenStar
	TokenSlash
	TokenPercent
	TokenDoubleStar
	TokenBang
	TokenTilde

	TokenLess
	TokenLessEqual
	TokenGreater
	TokenGreaterEqual
	TokenEqualEqual
	TokenNotEqual

	TokenAmpersand
	TokenCaret
	TokenPipe
	TokenAndAnd
	TokenOrOr

	TokenShiftLeft
	TokenShiftRight
	TokenShiftRightUnsigned

	TokenLParen
	TokenRParen
	TokenLBrace
	TokenRBrace
	TokenLBracket
	TokenRBracket

	TokenScriptDelimiter
	TokenInlineDescription
)

Jump to

Keyboard shortcuts

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