Documentation ¶
Overview ¶
Package token defines constants representing the lexical tokens.
Index ¶
Constants ¶
View Source
const ( LowestPrec = 0 // non-operators HighestPrec = 7 )
A set of constants for precedence-based expression parsing. Non-operators have lowest precedence.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Token ¶
type Token int
const ( ILLEGAL Token = iota EOF STRING // "text" INT // 123 FLOAT // 1.23 BOOL // true IDENT // vars ADD // + SUB // - MUL // * QUO // / REM // % CALL // }}:\n LAND // && LOR // || EQL // == NEQ // != LSS // < LEQ // <= GTR // > GEQ // >= NOT // ! LPAREN // ( RPAREN // ) LBRACK // [ RBRACK // ] LDBRACE // {{ RDBRACE // }} COMMA // , PERIOD // . QUESTION // ? COLON // : LARROW // <- LINEBREAK // end of a larrow expression argument DEFINED // defined )
func (Token) Precedence ¶
Precedence returns the operator precedence of the binary operator op. If op is not a binary operator, the result is LowestPrecedence.
Click to show internal directories.
Click to hide internal directories.