lexer

package
v0.0.0-...-f3e8c23 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EOF = iota + 1
	BANG
	DOLLAR
	PAREN_L
	PAREN_R
	SPREAD
	COLON
	EQUALS
	AT
	BRACKET_L
	BRACKET_R
	BRACE_L
	PIPE
	BRACE_R
	NAME
	INT
	FLOAT
	STRING
	COMMENT
	AMPERSAND
)

Variables

This section is empty.

Functions

func GetTokenDesc

func GetTokenDesc(token Token) string

func GetTokenKindDesc

func GetTokenKindDesc(kind int) string

Types

type Lexer

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

func New

func New(s *source.Source) *Lexer

func (*Lexer) NextToken

func (l *Lexer) NextToken() (Token, error)

type Token

type Token struct {
	Kind  int
	Start int
	End   int
	Value string
}

Token is a representation of a lexed Token. Value only appears for non-punctuation tokens: NAME, INT, FLOAT, and STRING.

func (*Token) String

func (t *Token) String() string

Jump to

Keyboard shortcuts

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