token

package
v0.0.0-...-bb84b19 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package token is generated by GoGLL. Do not edit

Index

Constants

This section is empty.

Variables

View Source
var IDToType = map[string]Type{
	"Error":                0,
	"$":                    1,
	"apply_snapshot_chunk": 2,
	"commit":               3,
	"finalize_block":       4,
	"init_chain":           5,
	"offer_snapshot":       6,
	"prepare_proposal":     7,
	"process_proposal":     8,
}
View Source
var StringToType = map[string]Type{
	"Error": Error,
	"EOF":   EOF,
	"T_0":   T_0,
	"T_1":   T_1,
	"T_2":   T_2,
	"T_3":   T_3,
	"T_4":   T_4,
	"T_5":   T_5,
	"T_6":   T_6,
}
View Source
var Suppress = []bool{
	false,
	false,
	false,
	false,
	false,
	false,
	false,
	false,
	false,
}
View Source
var TypeToID = []string{
	"Error",
	"$",
	"apply_snapshot_chunk",
	"commit",
	"finalize_block",
	"init_chain",
	"offer_snapshot",
	"prepare_proposal",
	"process_proposal",
}
View Source
var TypeToString = []string{
	"Error",
	"EOF",
	"T_0",
	"T_1",
	"T_2",
	"T_3",
	"T_4",
	"T_5",
	"T_6",
}

Functions

This section is empty.

Types

type Token

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

Token is returned by the lexer for every scanned lexical token

func New

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

New returns a new token. lext is the left extent and rext the right extent of the token in the input. input is the input slice scanned by the lexer.

func (*Token) GetInput

func (t *Token) GetInput() []rune

GetInput returns the input from which t was parsed.

func (*Token) GetLineColumn

func (t *Token) GetLineColumn() (line, col int)

GetLineColumn returns the line and column of the left extent of t

func (*Token) Lext

func (t *Token) Lext() int

Lext returns the left extent of t in the input stream of runes

func (*Token) Literal

func (t *Token) Literal() []rune

Literal returns the literal runes of t scanned by the lexer

func (*Token) LiteralString

func (t *Token) LiteralString() string

LiteralString returns string(t.Literal())

func (*Token) LiteralStringStripEscape

func (t *Token) LiteralStringStripEscape() string

LiteralStringStripEscape returns string(t.LiteralStripEscape())

func (*Token) LiteralStripEscape

func (t *Token) LiteralStripEscape() []rune

LiteralStripEscape returns the literal runes of t scanned by the lexer

func (*Token) Rext

func (t *Token) Rext() int

Rext returns the right extent of t in the input stream of runes

func (*Token) String

func (t *Token) String() string

func (*Token) Suppress

func (t *Token) Suppress() bool

Suppress returns true iff t is suppressed by the lexer

func (*Token) Type

func (t *Token) Type() Type

Type returns the token Type of t

func (*Token) TypeID

func (t *Token) TypeID() string

TypeID returns the token Type ID of t. This may be different from the literal of token t.

type Type

type Type int

Type is the token type

const (
	Error Type = iota // Error
	EOF               // $
	T_0               // apply_snapshot_chunk
	T_1               // commit
	T_2               // finalize_block
	T_3               // init_chain
	T_4               // offer_snapshot
	T_5               // prepare_proposal
	T_6               // process_proposal
)

func (Type) ID

func (t Type) ID() string

ID returns the token type ID of token Type t

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