lexer

package
v0.0.0-...-84c8e1d Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMixedIndentation = errors.New("mixed spaces and tabs aren't allowed on the same line")

Functions

This section is empty.

Types

type Lexer

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

func New

func New(file []byte, fileName string) *Lexer

func (*Lexer) Collect

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

func (*Lexer) Next

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

type LexerError

type LexerError struct {
	Inner    error
	Location Location
}

func (*LexerError) At

func (e *LexerError) At() Location

func (*LexerError) Error

func (e *LexerError) Error() string

func (*LexerError) Unwrap

func (e *LexerError) Unwrap() error

type Location

type Location struct {
	File string

	// 0-based
	Line, Column int
}

func (*Location) String

func (l *Location) String() string

type Token

type Token struct {
	Type     TokenType
	Start    Location
	Depth    int
	Contents string
}

type TokenType

type TokenType int
const (
	TokenIdentifier TokenType = iota
	TokenNewLine
	TokenInlineText
	TokenImportPath

	TokenParenOpen
	TokenParenClose

	TokenEquals
	TokenDot
	TokenComma
	TokenPlus
	TokenHashtag
	TokenColon
	TokenInterpolationStart
	TokenQuestionMark
	TokenExclamationPoint
	TokenPipe

	TokenCommentStart
	TokenCommentStartBuffered
	TokenCommentText

	TokenClassName
	TokenID

	TokenKeyword
	TokenAttributeName
	TokenQuotedString

	TokenGoExpr
	TokenGoBlock

	TokenEOF
)

func (TokenType) String

func (t TokenType) String() string

type UnexpectedRuneError

type UnexpectedRuneError struct {
	Got      rune
	Expected string
}

func (*UnexpectedRuneError) Error

func (e *UnexpectedRuneError) Error() string

Jump to

Keyboard shortcuts

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