token

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package token holds the tokens the lexer hands the parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type    Type
	Literal string
	diag.Pos
	NewlineBefore bool // a line break separates this token from the one before it
}

A token: its type, its text without delimiters, and where it is

func (Token) Describe

func (t Token) Describe() string

Describe names the token the way an error message should

func (Token) IsEOS

func (t Token) IsEOS() bool

IsEOS reports whether the token signals end-of-source

func (Token) IsSimple

func (t Token) IsSimple(lit string) bool

func (Token) IsWord

func (t Token) IsWord(lit string) bool

func (Token) String

func (t Token) String() string

type Type

type Type int
const (
	EOS Type = iota // end of source

	Simple
	Word
	String
	Number
	Invalid
)

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