lexer

package
v0.0.0-...-90e8e0c Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package lexer implements a lexer for kl source files.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnterminatedString = errors.New("unterminated string")
	ErrUnterminatedChar   = errors.New("unterminated char")
)

Functions

This section is empty.

Types

type Chroma

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

func NewChroma

func NewChroma() *Chroma

func (*Chroma) AnalyseText

func (ch *Chroma) AnalyseText(text string) float32

func (*Chroma) Config

func (ch *Chroma) Config() *chroma.Config

func (*Chroma) SetAnalyser

func (ch *Chroma) SetAnalyser(analyser func(text string) float32) chroma.Lexer

func (*Chroma) SetRegistry

func (ch *Chroma) SetRegistry(registry *chroma.LexerRegistry) chroma.Lexer

func (*Chroma) Tokenise

func (ch *Chroma) Tokenise(options *chroma.TokeniseOptions, text string) (chroma.Iterator, error)

type Lexer

type Lexer struct {
	Error       error
	Location    ast.Location
	String      string // identifier, comment, string literal
	ValueFormat ast.ValueFormat
	Unsigned    uint64
	// contains filtered or unexported fields
}

func (*Lexer) Init

func (lex *Lexer) Init(r *bufio.Reader, emit_whitespace bool)

func (*Lexer) Newline

func (lex *Lexer) Newline() bool

Newline returns whether a newline was encountered in the last Peek() or Next() call. NB. whitespace is always skipped at the start when calling Peek() and Next().

func (*Lexer) Next

func (lex *Lexer) Next() token.Token

func (*Lexer) NextLine

func (lex *Lexer) NextLine() string

func (*Lexer) Peek

func (lex *Lexer) Peek() token.Token

func (*Lexer) Peek2

func (lex *Lexer) Peek2() token.Token

func (*Lexer) Reset

func (lex *Lexer) Reset(src io.Reader)

Jump to

Keyboard shortcuts

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