token

package
v0.0.0-...-c3e307e Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 1 Imported by: 2

Documentation

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
	Line    int
	Column  int
}

Token represents a config token

func (Token) EqualTo

func (t Token) EqualTo(t2 Token) bool

EqualTo checks equality

func (Token) Is

func (t Token) Is(typ Type) bool

Is check type of a token

func (Token) IsParameterEligible

func (t Token) IsParameterEligible() bool

IsParameterEligible checks if token is directive parameter eligible

func (Token) Lit

func (t Token) Lit(literal string) Token

Lit set literal string

func (Token) String

func (t Token) String() string

type Tokens

type Tokens []Token

Tokens list of token

func (Tokens) Diff

func (ts Tokens) Diff(tokens Tokens) error

Diff find what is difference between two Token collection

func (Tokens) EqualTo

func (ts Tokens) EqualTo(tokens Tokens) bool

EqualTo check Tokens equality of token list

type Type

type Type int

Type Token.Type

const (
	//EOF end of file
	EOF Type = iota
	//Eol end of line
	Eol
	//Keyword any keyword
	Keyword
	//QuotedString Quoted String
	QuotedString
	//Variable any $variabl
	Variable
	//BlockStart {
	BlockStart
	//BlockEnd }
	BlockEnd
	//Semicolon ;
	Semicolon
	//Comment #comment
	Comment
	//EndOfLine \n or \r
	EndOfLine
	//Illegal a token that should never happen
	Illegal
	//Regex any reg expression
	Regex
	// LuaCode lua block
	LuaCode
)

func (Type) String

func (tt Type) String() string

String convert a token to string as it should be written

Jump to

Keyboard shortcuts

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