lex

package
v0.0.0-...-a54c318 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 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 Kind

type Kind int
const (
	Eof Kind = iota
	Colon
	Assign
	Lparen
	Rparen
	Nl

	// Operators
	Plus
	Minus
	Star
	Slash
	Eq
	Neq
	Lt
	Gt
	Lte
	Gte
	Bang

	// Literal
	StringLit
	NumLit
	Comment
	Ident

	// Keywords
	If
	While
	End
	True
	False
	And
	Or
)

func (Kind) IsComparisonOp

func (k Kind) IsComparisonOp() bool

func (Kind) Repr

func (k Kind) Repr() string

func (Kind) String

func (k Kind) String() string

type Token

type Token struct {
	Kind Kind
	Lit  string
}

func Tokenize

func Tokenize(input string) []Token

func (Token) IsBinaryOp

func (t Token) IsBinaryOp() bool

func (Token) IsUnaryOp

func (t Token) IsUnaryOp() bool

Jump to

Keyboard shortcuts

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