lexer

package
v0.0.0-...-e039b74 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Typ ItemType // Type, such as itemNumber.
	Val string   // Value, such as "23.2".
}

item represents a token returned from the scanner.

func (Item) String

func (i Item) String() string

type ItemType

type ItemType int

itemType identifies the type of lex items.

const (
	ItemError ItemType = iota // error occurred;
	// value is text of error
	ItemEOF
	ItemAccessor // access field
	ItemIndex    // index of list
	ItemSentinel // something like base64 decode
)

type Lexer

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

lexer holds the state of the scanner.

func Lex

func Lex(name, input string) *Lexer

lex creates a new scanner for the input string.

func (*Lexer) NextItem

func (l *Lexer) NextItem() Item

NextItem returns the next item from the input.

Jump to

Keyboard shortcuts

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