Help us shape the future of Go! Take the 2026 Go Developer Survey

lexer

package
v0.2.50 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MPL-2.0 Imports: 3 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 {
	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