token

package
v12.2.12 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: BSD-3-Clause Imports: 1 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EOF = iota // 0
	ILLEGAL

	// Identifiers + literals
	LBRACE // {
	RBRACE // }
	//	PARAM_IDENTIFIER // id
	COLON  // :
	LPAREN // (
	RPAREN // )
	//	PARAM_FUNC_ARG   // 1
	COMMA
	IDENT // string or keyword
	// Keywords
	// keywords_start
	ELSE // else
	// keywords_end
	INT // 42
)

/about/{fullname:alphabetical} /profile/{anySpecialName:string} {id:uint64 range(1,5) else 404} /admin/{id:int eq(1) else 402} /file/{filepath:file else 405}

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type    Type
	Literal string
	Start   int // including the first char
	End     int // including the last char
}

Token describes the letter(s) or symbol, is a result of the lexer.

type Type

type Type int

Type is a specific type of int which describes the symbols.

func LookupIdent

func LookupIdent(ident string) Type

LookupIdent receives a series of chars and tries to resolves the token type.

func (Type) String added in v12.2.12

func (t Type) String() string

String returns the name of the token type, e.g. "LBRACE" for the '{' symbol. It returns the numeric value of an unknown type as it is.

Jump to

Keyboard shortcuts

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