lexer

package
v0.0.0-...-9b02bcc Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 1 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
}

Lexer converts an input string into its constituent tokens.

func New

func New(input string) *Lexer

New creates a lexer from the given input.

func (*Lexer) Index

func (l *Lexer) Index() int

Index returns the current position of the lexer.

func (*Lexer) Next

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

Next returns the next token from the input and moves the current position of the lexer ahead.

If encountering the end of the input, token.EOF is returned.

func (*Lexer) Reposition

func (l *Lexer) Reposition(idx int)

Reposition positions the lexer to the given index.

Jump to

Keyboard shortcuts

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