Documentation
¶
Index ¶
- Constants
- type Token
- func (tok Token) Is(other ...Token) bool
- func (tok Token) IsBinaryOperator() bool
- func (tok Token) IsBlockEnd() bool
- func (tok Token) IsBlockStart() bool
- func (tok Token) IsKeyword() bool
- func (tok Token) IsLiteral() bool
- func (tok Token) IsOperator() bool
- func (tok Token) Name() string
- func (tok Token) Precedence() int
- func (tok Token) String() string
Constants ¶
View Source
const LowestPrec = 0
LowestPrec represents lowest operator precedence.
View Source
const NumTokens = int(GroupKeywordEnd)
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 MixedText GroupLiteralBegin Ident Int Uint Float Decimal Char String RawString RawHeredoc Template GroupLiteralEnd GroupOperatorBegin GroupBinaryOperatorBegin Add // + Sub // - Mul // * Pow // ** Quo // / Rem // % And // & Or // | Xor // ^ Shl // << Shr // >> AndNot // &^ LAnd // && Equal // == NotEqual // != Less // < Greater // > LessEq // <= GreaterEq // >= Tilde // ~ DoubleTilde // ~~ TripleTilde // ~~~ GroupBinaryOperatorEnd GroupDefaultOperatorBegin Nullich // ?? LOr // || GroupDefaultOperatorEnd GroupAssignOperatorBegin Define // := Assign // = GroupSelfAssignOperatorBegin AddAssign // += IncAssign // ++= SubAssign // -= DecAssign // --= MulAssign // *= PowAssign // **= QuoAssign // /= RemAssign // %= AndAssign // &= OrAssign // |= XorAssign // ^= ShlAssign // <<= ShrAssign // >>= AndNotAssign // &^= LOrAssign // ||= NullichAssign // ??= GroupSelfAssignOperatorEnd GroupAssignOperatorEnd GroupUnaryOperatorBegin Inc // ++ Dec // -- GroupUnaryOperatorEnd Lambda // => Not // ! Null // a == nil || nil == a NotNull // a != nil || nil != a Pipe // .| Question // ? NullishSelector // ?. GroupOperatorEnd LParen // ( RParen // ) LBrack // [ RBrack // ] LBrace // { RBrace // } Semicolon // ; Colon // : Comma // , Period // . GroupKeywordBegin Break Continue Else For Func If Return True False Yes No In Nil Import Embed Param Global Var Const Try Catch Finally Throw Callee NamedArgs Args StdIn StdOut StdErr DotName DotFile IsModule GroupKeywordEnd )
List of tokens
func (Token) IsBinaryOperator ¶
IsBinaryOperator reports whether token is a binary operator.
func (Token) IsBlockEnd ¶
func (Token) IsBlockStart ¶
func (Token) IsOperator ¶
IsOperator returns true if the token is an operator.
func (Token) Precedence ¶
Precedence returns the precedence for the operator token.
Click to show internal directories.
Click to hide internal directories.