token

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(t Token) bool

IsEmpty determines whether the given token is empty.

func IsValidIndetifier

func IsValidIndetifier(ident string) bool

IsValidIndetifier determines whether the given identifier is valid.

func RegisterIdentifiers

func RegisterIdentifiers(ident ...string)

RegisterIdentifiers registers a new identifiers.

Types

type Kind

type Kind string

Kind is a token kind.

const (
	// EOF indicates that we are at the end.
	EOF Kind = "EOF"

	// IDENT is a token that represents a tag name.
	IDENT Kind = "IDENT"

	// NL is a new line token.
	NL Kind = "\n"

	// STRING is string token.
	STRING Kind = "STRING"

	// LBRACKET is a `[` token.
	LBRACKET Kind = "["
	// RBRACKET is a `]` token.
	RBRACKET Kind = "]"
	// SLASH is `/` token.
	SLASH Kind = "/"
	// EQUAL is a `=` token.
	EQUAL Kind = "="
	// QUOTE is a `"` token.
	QUOTE Kind = `"`
)

type Token

type Token struct {
	Kind    Kind
	Literal string
}

Token is produced by Lexer.

Jump to

Keyboard shortcuts

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