Documentation ¶
Overview ¶
Package token defines constants representing the lexical tokens of the TTCN-3 programming language and basic operations on tokens (printing, predicates).
Index ¶
Constants ¶
const ( LowestPrec = 0 // non-operators UnaryPrec = 6 HighestPrec = 15 )
A set of constants for precedence-based expression parsing. Non-operators have lowest precedence, followed by operators starting with precedence 1 up to unary operators. The highest precedence serves as "catch-all" precedence for selector, indexing, and other operator and delimiter tokens.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Kind ¶
type Kind int
Kind is the set of lexical tokens of the Go programming language.
const ( // Special tokens ILLEGAL Kind = iota EOF COMMENT PREPROC // Identifiers and basic type literals // (these tokens stand for classes of literals) IDENT // main INT // 12345 FLOAT // 123.45 STRING // "abc" BSTRING // '101?F'H MODIF // @fuzzy // Operators and delimiters ADD // + SUB // - MUL // * DIV // / SHL // << ROL // <@ SHR // >> ROR // @> CONCAT // & REDIR // -> DECODE // => ANY // ? EXCL // ! RANGE // .. ASSIGN // := COLONCOLON // :: EQ // == NE // != LT // < LE // <= GT // > GE // >= LPAREN // ( LBRACK // [ LBRACE // { COMMA // , DOT // . RPAREN // ) RBRACK // ] RBRACE // } SEMICOLON // ; COLON // : // Keywords MOD // mod REM // rem AND // and OR // or XOR // xor NOT // not AND4B // and4b OR4B // or4b XOR4B // xor4b NOT4B // not4b ADDRESS ALIVE ALL ALT ALTSTEP ANYKW BREAK CASE CHARSTRING COMPONENT CONST CONTINUE CONTROL DECMATCH DISPLAY DO ELSE ENCODE ENUMERATED ERROR EXCEPT EXCEPTION EXTENDS EXTENSION EXTERNAL FAIL FALSE FOR FRIEND FROM FUNCTION GOTO GROUP IF IFPRESENT IMPORT IN INCONC INOUT INTERLEAVE LABEL LANGUAGE LENGTH MAP MESSAGE MIXED MODIFIES MODULE MODULEPAR MTC NAN NOBLOCK NONE NULL OF OMIT ON OPTIONAL OUT OVERRIDE PARAM PASS PATTERN PORT PRESENT PRIVATE PROCEDURE PUBLIC REALTIME RECORD REGEXP REPEAT RETURN RUNS SELECT SENDER SET SIGNATURE STEPSIZE SYSTEM TEMPLATE TESTCASE TIMER TIMESTAMP TO TRUE TYPE UNION UNIVERSAL UNMAP VALUE VAR VARIANT WHILE WITH )
The list of tokens.
func (Kind) IsKeyword ¶
IsKeyword returns true for tokens corresponding to keywords; it returns false otherwise.
func (Kind) IsLiteral ¶
IsLiteral returns true for tokens corresponding to identifiers and basic type literals; it returns false otherwise.
func (Kind) IsOperator ¶
IsOperator returns true for tokens corresponding to operators and delimiters; it returns false otherwise.
func (Kind) Precedence ¶
Precedence returns the operator precedence of the binary operator op. If op is not a binary operator, the result is LowestPrecedence.
func (Kind) String ¶
String returns the string corresponding to the token tok. For operators, delimiters, and keywords the string is the actual token character sequence (e.g., for the token ADD, the string is "+"). For all other tokens the string corresponds to the token constant name (e.g. for the token IDENT, the string is "IDENT").