token

package
v0.0.0-...-d977049 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StringToType = map[string]Type{
	"Error": Error,
	"EOF":   EOF,
	"Type0": Type0,
	"Type1": Type1,
	"Type2": Type2,
}
View Source
var TypeToID = []string{
	"Error",
	"EOF",
	"a",
	"b",
	"rule1",
}
View Source
var TypeToString = []string{
	"Error",
	"EOF",
	"Type0",
	"Type1",
	"Type2",
}

Functions

This section is empty.

Types

type Token

type Token struct {
	Type       Type
	Lext, Rext int
	Literal    []rune
}

Token is returned by the lexer for every scanned lexical token

func New

func New(t Type, lext, rext int, lit []rune) *Token

func (*Token) String

func (t *Token) String() string

func (*Token) TypeID

func (t *Token) TypeID() string

type Type

type Type int

Type is the token type

const (
	Error Type = iota // Error
	EOF               // EOF
	Type0             // a
	Type1             // b
	Type2             // rule1
)

func (Type) ID

func (t Type) ID() string

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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