token

package
v0.0.0-...-ebc58a5 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 1 Imported by: 4

Documentation

Index

Constants

View Source
const LowestPrec = 0

LowestPrec represents lowest operator precedence.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token int

Token represents a token.

const (
	Illegal Token = iota
	EOF
	Comment
	ConfigStart
	ConfigEnd
	MixedValueStart
	MixedValueEnd
	MixedCodeStart
	MixedCodeEnd
	LiteralBegin_
	MixedText
	Ident
	Int
	Uint
	Float
	Decimal
	Char
	String
	RawString
	RawHeredoc
	Template
	LiteralEnd_
	OperatorBegin_
	BinaryOperatorBegin_
	Add         // +
	Sub         // -
	Mul         // *
	Quo         // /
	Rem         // %
	And         // &
	Or          // |
	Xor         // ^
	Shl         // <<
	Shr         // >>
	AndNot      // &^
	LAnd        // &&
	Equal       // ==
	NotEqual    // !=
	Less        // <
	Greater     // >
	LessEq      // <=
	GreaterEq   // >=
	Tilde       // ~
	DoubleTilde // ~~
	TripleTilde // ~~~
	BinaryOperatorEnd_
	DefaultOperatorsBegin_
	NullichCoalesce // ??
	LOr             // ||
	DefaultOperatorsEnd_
	AssignOperatorBegin_
	Define        // :=
	Assign        // =
	AddAssign     // +=
	SubAssign     // -=
	MulAssign     // *=
	QuoAssign     // /=
	RemAssign     // %=
	AndAssign     // &=
	OrAssign      // |=
	XorAssign     // ^=
	ShlAssign     // <<=
	ShrAssign     // >>=
	AndNotAssign  // &^=
	LOrAssign     // ||=
	NullichAssign // ??=
	AssignOperatorEnd_
	UnaryOperatorBegin_
	Inc // ++
	Dec // --
	UnaryOperatorEnd_
	Lambda          // =>
	Not             // !
	Null            // a == nil || nil == a
	NotNull         // a != nil || nil != a
	Pipe            // .|
	LParen          // (
	RParen          // )
	LBrack          // [
	RBrack          // ]
	Comma           // ,
	Period          // .
	RBrace          // }
	LBrace          // {
	Semicolon       // ;
	Colon           // :
	Question        // ?
	NullishSelector // ?.
	OperatorEnd_
	KeyworkBegin_
	Break
	Continue
	Else
	For
	Func
	If
	Return
	True
	False
	Yes
	No
	In
	Nil
	Import
	Param
	Global
	Var
	Const
	Try
	Catch
	Finally
	Throw
	Callee
	NamedArgs
	Args
	StdIn
	StdOut
	StdErr
	DotName
	DotFile
	IsModule
	KeywordEnd_
)

List of tokens

func Lookup

func Lookup(ident string) Token

Lookup returns corresponding keyword if ident is a keyword.

func (Token) Is

func (tok Token) Is(other ...Token) bool

Is returns true if then token equals one of args.

func (Token) IsBinaryOperator

func (tok Token) IsBinaryOperator() bool

IsBinaryOperator reports whether token is a binary operator.

func (Token) IsBlockEnd

func (tok Token) IsBlockEnd() bool

func (Token) IsBlockStart

func (tok Token) IsBlockStart() bool

func (Token) IsKeyword

func (tok Token) IsKeyword() bool

IsKeyword returns true if the token is a keyword.

func (Token) IsLiteral

func (tok Token) IsLiteral() bool

IsLiteral returns true if the token is a literal.

func (Token) IsOperator

func (tok Token) IsOperator() bool

IsOperator returns true if the token is an operator.

func (Token) Precedence

func (tok Token) Precedence() int

Precedence returns the precedence for the operator token.

func (Token) String

func (tok Token) String() string

Jump to

Keyboard shortcuts

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