lexer

package
v0.2.64 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MPL-2.0 Imports: 3 Imported by: 1 module, 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

This section is empty.

Functions

This section is empty.

Types

type Lexer

type Lexer struct {
	LastToken token.Token // last token for lookback
	// contains filtered or unexported fields
}

func New

func New(input string) *Lexer

func (*Lexer) Errors

func (l *Lexer) Errors() []string

Errors returns lexical errors accumulated while scanning. Meaningful only after the input has been fully consumed (e.g. the parser drove NextToken to EOF). Used by txcl.Validate; ignored by the runtime.

func (*Lexer) NextToken

func (l *Lexer) NextToken() token.Token

func (*Lexer) Span added in v0.2.31

func (l *Lexer) Span() (start, end int)

Span returns the byte offsets [start, end) of the token NextToken last returned, within the input: the token's own text, with the whitespace and comments before it excluded. A STRING's span covers its quotes (and a `b64` prefix); an AMP_IDENT's covers the `&`. Tools that rewrite txcl source by token (the CLI's &include expansion) splice on these.

Jump to

Keyboard shortcuts

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