TokenType class

The types of tokens that can be returned by the scanner.

Clients may not extend, implement or mix-in this class.

Implementers

Constructors

TokenType(int index, String lexeme, String name, int precedence, int kind, {TokenType? binaryOperatorOfCompoundAssignment, bool isBinaryOperator = false, bool isModifier = false, bool isOperator = false, bool isTopLevelKeyword = false, bool isUserDefinableOperator = false, String? stringValue = 'unspecified'})
const

Properties

binaryOperatorOfCompoundAssignment TokenType?
The binary operator that is invoked by this compound assignment operator, or null otherwise.
final
hashCode int
The hash code for this object.
read-onlyinherited
index int
A unique index identifying this TokenType.
final
isAdditiveOperator bool
Return true if this type of token represents an additive operator.
read-only
isAssignmentOperator bool
Return true if this type of token represents an assignment operator.
read-only
isAssociativeOperator bool
Return true if this type of token represents an associative operator. An associative operator is an operator for which the following equality is true: (a * b) * c == a * (b * c). In other words, if the result of applying the operator to multiple operands does not depend on the order in which those applications occur.
read-only
isBinaryOperator bool
true if this token type represents a binary operator.
final
isBuiltIn bool
A flag indicating whether the keyword is a "built-in" identifier.
read-only
isEqualityOperator bool
Return true if this type of token represents an equality operator.
read-only
isIncrementOperator bool
Return true if this type of token represents an increment operator.
read-only
isKeyword bool
Return true if this type of token is a keyword.
read-only
isModifier bool
true if this token type represents a modifier such as abstract or const.
final
isMultiplicativeOperator bool
Return true if this type of token represents a multiplicative operator.
read-only
isOperator bool
true if this token type represents an operator.
final
isPseudo bool
A flag indicating whether the keyword can be used as an identifier in some situations.
read-only
isRelationalOperator bool
Return true if this type of token represents a relational operator.
read-only
isReservedWord bool
A flag indicating whether the keyword is a "reserved word".
read-only
isSelectorOperator bool
Return true if this type of token represents a selector operator (starting token of a selector).
read-only
isShiftOperator bool
Return true if this type of token represents a shift operator.
read-only
isTopLevelKeyword bool
true if this token type represents a keyword starting a top level declaration such as class, enum, import, etc.
final
isUnaryPostfixOperator bool
Return true if this type of token represents a unary postfix operator.
read-only
isUnaryPrefixOperator bool
Return true if this type of token represents a unary prefix operator.
read-only
isUserDefinableOperator bool
true if this token type represents an operator that can be defined by users.
final
kind int
final
lexeme String
The lexeme that defines this type of token, or null if there is more than one possible lexeme for this type of token.
final
name String
The name of the token type.
final
precedence int
The precedence of this type of token, or 0 if the token does not represent an operator.
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
stringValue String?
See Token.stringValue for an explanation.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

all → const List<TokenType>
const <TokenType>[TokenType.EOF, TokenType.DOUBLE, TokenType.HEXADECIMAL, TokenType.IDENTIFIER, TokenType.INT, TokenType.MULTI_LINE_COMMENT, TokenType.SCRIPT_TAG, TokenType.SINGLE_LINE_COMMENT, …
AMPERSAND → const TokenType
const TokenType(9, '&', 'AMPERSAND', BITWISE_AND_PRECEDENCE, AMPERSAND_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
AMPERSAND_AMPERSAND → const TokenType
const TokenType(10, '&&', 'AMPERSAND_AMPERSAND', LOGICAL_AND_PRECEDENCE, AMPERSAND_AMPERSAND_TOKEN, isOperator: true, isBinaryOperator: true)
AMPERSAND_AMPERSAND_EQ → const TokenType
const TokenType(11, '&&=', 'AMPERSAND_AMPERSAND_EQ', ASSIGNMENT_PRECEDENCE, AMPERSAND_AMPERSAND_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.AMPERSAND_AMPERSAND, isO…
AMPERSAND_EQ → const TokenType
const TokenType(12, '&=', 'AMPERSAND_EQ', ASSIGNMENT_PRECEDENCE, AMPERSAND_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.AMPERSAND, isOperator: true)
AS → const TokenType
Keyword.AS
AT → const TokenType
const TokenType(13, '@', 'AT', NO_PRECEDENCE, AT_TOKEN)
BACKPING → const TokenType
const TokenType(72, '`', 'BACKPING', NO_PRECEDENCE, BACKPING_TOKEN)
BACKSLASH → const TokenType
const TokenType(73, '\\', 'BACKSLASH', NO_PRECEDENCE, BACKSLASH_TOKEN)
BAD_INPUT → const TokenType
Token type used by error tokens.
const TokenType(77, 'malformed input', 'BAD_INPUT', NO_PRECEDENCE, BAD_INPUT_TOKEN, stringValue: null)
BANG → const TokenType
const TokenType(14, '!', 'BANG', PREFIX_PRECEDENCE, BANG_TOKEN, isOperator: true)
BANG_EQ → const TokenType
const TokenType(15, '!=', 'BANG_EQ', EQUALITY_PRECEDENCE, BANG_EQ_TOKEN, isOperator: true)
BANG_EQ_EQ → const TokenType
const TokenType(16, '!==', 'BANG_EQ_EQ', EQUALITY_PRECEDENCE, BANG_EQ_EQ_TOKEN)
BAR → const TokenType
const TokenType(17, '|', 'BAR', BITWISE_OR_PRECEDENCE, BAR_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
BAR_BAR → const TokenType
const TokenType(18, '||', 'BAR_BAR', LOGICAL_OR_PRECEDENCE, BAR_BAR_TOKEN, isOperator: true, isBinaryOperator: true)
BAR_BAR_EQ → const TokenType
const TokenType(19, '||=', 'BAR_BAR_EQ', ASSIGNMENT_PRECEDENCE, BAR_BAR_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.BAR_BAR, isOperator: true)
BAR_EQ → const TokenType
const TokenType(20, '|=', 'BAR_EQ', ASSIGNMENT_PRECEDENCE, BAR_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.BAR, isOperator: true)
CARET → const TokenType
const TokenType(23, '^', 'CARET', BITWISE_XOR_PRECEDENCE, CARET_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
CARET_EQ → const TokenType
const TokenType(24, '^=', 'CARET_EQ', ASSIGNMENT_PRECEDENCE, CARET_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.CARET, isOperator: true)
CLOSE_CURLY_BRACKET → const TokenType
const TokenType(25, '}', 'CLOSE_CURLY_BRACKET', NO_PRECEDENCE, CLOSE_CURLY_BRACKET_TOKEN)
CLOSE_PAREN → const TokenType
const TokenType(26, ')', 'CLOSE_PAREN', NO_PRECEDENCE, CLOSE_PAREN_TOKEN)
CLOSE_SQUARE_BRACKET → const TokenType
const TokenType(27, ']', 'CLOSE_SQUARE_BRACKET', NO_PRECEDENCE, CLOSE_SQUARE_BRACKET_TOKEN)
COLON → const TokenType
const TokenType(21, ':', 'COLON', NO_PRECEDENCE, COLON_TOKEN)
COMMA → const TokenType
const TokenType(22, ',', 'COMMA', NO_PRECEDENCE, COMMA_TOKEN)
DOUBLE → const TokenType
const TokenType(1, 'double', 'DOUBLE', NO_PRECEDENCE, DOUBLE_TOKEN, stringValue: null)
EOF → const TokenType
The type of the token that marks the start or end of the input.
const TokenType(0, '', 'EOF', NO_PRECEDENCE, EOF_TOKEN)
EQ → const TokenType
const TokenType(28, '=', 'EQ', ASSIGNMENT_PRECEDENCE, EQ_TOKEN, isOperator: true)
EQ_EQ → const TokenType
const TokenType(29, '==', 'EQ_EQ', EQUALITY_PRECEDENCE, EQ_EQ_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
EQ_EQ_EQ → const TokenType
The === operator is not supported in the Dart language but is parsed as such by the scanner to support better recovery when a JavaScript code snippet is pasted into a Dart file.
const TokenType(30, '===', 'EQ_EQ_EQ', EQUALITY_PRECEDENCE, EQ_EQ_EQ_TOKEN)
FUNCTION → const TokenType
const TokenType(31, '=>', 'FUNCTION', NO_PRECEDENCE, FUNCTION_TOKEN)
GT → const TokenType
const TokenType(32, '>', 'GT', RELATIONAL_PRECEDENCE, GT_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
GT_EQ → const TokenType
const TokenType(33, '>=', 'GT_EQ', RELATIONAL_PRECEDENCE, GT_EQ_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
GT_GT → const TokenType
const TokenType(34, '>>', 'GT_GT', SHIFT_PRECEDENCE, GT_GT_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
GT_GT_EQ → const TokenType
const TokenType(35, '>>=', 'GT_GT_EQ', ASSIGNMENT_PRECEDENCE, GT_GT_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.GT_GT, isOperator: true)
GT_GT_GT → const TokenType
const TokenType(36, '>>>', 'GT_GT_GT', SHIFT_PRECEDENCE, GT_GT_GT_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
GT_GT_GT_EQ → const TokenType
const TokenType(37, '>>>=', 'GT_GT_GT_EQ', ASSIGNMENT_PRECEDENCE, GT_GT_GT_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.GT_GT_GT, isOperator: true)
HASH → const TokenType
const TokenType(38, '#', 'HASH', NO_PRECEDENCE, HASH_TOKEN)
HEXADECIMAL → const TokenType
const TokenType(2, 'hexadecimal', 'HEXADECIMAL', NO_PRECEDENCE, HEXADECIMAL_TOKEN, stringValue: null)
IDENTIFIER → const TokenType
const TokenType(3, 'identifier', 'IDENTIFIER', NO_PRECEDENCE, IDENTIFIER_TOKEN, stringValue: null)
INDEX → const TokenType
const TokenType(39, '[]', 'INDEX', SELECTOR_PRECEDENCE, INDEX_TOKEN, isOperator: true, isUserDefinableOperator: true)
INDEX_EQ → const TokenType
const TokenType(40, '[]=', 'INDEX_EQ', NO_PRECEDENCE, INDEX_EQ_TOKEN, isOperator: true, isUserDefinableOperator: true)
INT → const TokenType
const TokenType(4, 'int', 'INT', NO_PRECEDENCE, INT_TOKEN, stringValue: null)
IS → const TokenType
Keyword.IS
LT → const TokenType
const TokenType(41, '<', 'LT', RELATIONAL_PRECEDENCE, LT_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
LT_EQ → const TokenType
const TokenType(42, '<=', 'LT_EQ', RELATIONAL_PRECEDENCE, LT_EQ_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
LT_LT → const TokenType
const TokenType(43, '<<', 'LT_LT', SHIFT_PRECEDENCE, LT_LT_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
LT_LT_EQ → const TokenType
const TokenType(44, '<<=', 'LT_LT_EQ', ASSIGNMENT_PRECEDENCE, LT_LT_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.LT_LT, isOperator: true)
MINUS → const TokenType
const TokenType(45, '-', 'MINUS', ADDITIVE_PRECEDENCE, MINUS_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
MINUS_EQ → const TokenType
const TokenType(46, '-=', 'MINUS_EQ', ASSIGNMENT_PRECEDENCE, MINUS_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.MINUS, isOperator: true)
MINUS_MINUS → const TokenType
const TokenType(47, '--', 'MINUS_MINUS', POSTFIX_PRECEDENCE, MINUS_MINUS_TOKEN, isOperator: true)
MULTI_LINE_COMMENT → const TokenType
const TokenType(5, 'comment', 'MULTI_LINE_COMMENT', NO_PRECEDENCE, COMMENT_TOKEN, stringValue: null)
OPEN_CURLY_BRACKET → const TokenType
const TokenType(48, '{', 'OPEN_CURLY_BRACKET', NO_PRECEDENCE, OPEN_CURLY_BRACKET_TOKEN)
OPEN_PAREN → const TokenType
const TokenType(49, '(', 'OPEN_PAREN', SELECTOR_PRECEDENCE, OPEN_PAREN_TOKEN)
OPEN_SQUARE_BRACKET → const TokenType
const TokenType(50, '[', 'OPEN_SQUARE_BRACKET', SELECTOR_PRECEDENCE, OPEN_SQUARE_BRACKET_TOKEN)
PERCENT → const TokenType
const TokenType(51, '%', 'PERCENT', MULTIPLICATIVE_PRECEDENCE, PERCENT_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
PERCENT_EQ → const TokenType
const TokenType(52, '%=', 'PERCENT_EQ', ASSIGNMENT_PRECEDENCE, PERCENT_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.PERCENT, isOperator: true)
PERIOD → const TokenType
const TokenType(53, '.', 'PERIOD', SELECTOR_PRECEDENCE, PERIOD_TOKEN)
PERIOD_PERIOD → const TokenType
const TokenType(54, '..', 'PERIOD_PERIOD', CASCADE_PRECEDENCE, PERIOD_PERIOD_TOKEN, isOperator: true)
PERIOD_PERIOD_PERIOD → const TokenType
const TokenType(74, '...', 'PERIOD_PERIOD_PERIOD', NO_PRECEDENCE, PERIOD_PERIOD_PERIOD_TOKEN)
PERIOD_PERIOD_PERIOD_QUESTION → const TokenType
const TokenType(75, '...?', 'PERIOD_PERIOD_PERIOD_QUESTION', NO_PRECEDENCE, PERIOD_PERIOD_PERIOD_QUESTION_TOKEN)
PLUS → const TokenType
const TokenType(55, '+', 'PLUS', ADDITIVE_PRECEDENCE, PLUS_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
PLUS_EQ → const TokenType
const TokenType(56, '+=', 'PLUS_EQ', ASSIGNMENT_PRECEDENCE, PLUS_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.PLUS, isOperator: true)
PLUS_PLUS → const TokenType
const TokenType(57, '++', 'PLUS_PLUS', POSTFIX_PRECEDENCE, PLUS_PLUS_TOKEN, isOperator: true)
QUESTION → const TokenType
const TokenType(58, '?', 'QUESTION', CONDITIONAL_PRECEDENCE, QUESTION_TOKEN, isOperator: true)
QUESTION_PERIOD → const TokenType
const TokenType(59, '?.', 'QUESTION_PERIOD', SELECTOR_PRECEDENCE, QUESTION_PERIOD_TOKEN, isOperator: true)
QUESTION_PERIOD_PERIOD → const TokenType
const TokenType(76, '?..', 'QUESTION_PERIOD_PERIOD', CASCADE_PRECEDENCE, QUESTION_PERIOD_PERIOD_TOKEN)
QUESTION_QUESTION → const TokenType
const TokenType(60, '??', 'QUESTION_QUESTION', IF_NULL_PRECEDENCE, QUESTION_QUESTION_TOKEN, isOperator: true, isBinaryOperator: true)
QUESTION_QUESTION_EQ → const TokenType
const TokenType(61, '??=', 'QUESTION_QUESTION_EQ', ASSIGNMENT_PRECEDENCE, QUESTION_QUESTION_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.QUESTION_QUESTION, isOperator: true)
RECOVERY → const TokenType
Token type used by synthetic tokens that are created during parser recovery (non-analyzer use case).
const TokenType(78, 'recovery', 'RECOVERY', NO_PRECEDENCE, RECOVERY_TOKEN, stringValue: null)
SCRIPT_TAG → const TokenType
const TokenType(6, 'script', 'SCRIPT_TAG', NO_PRECEDENCE, SCRIPT_TOKEN)
SEMICOLON → const TokenType
const TokenType(62, ';', 'SEMICOLON', NO_PRECEDENCE, SEMICOLON_TOKEN)
SINGLE_LINE_COMMENT → const TokenType
const TokenType(7, 'comment', 'SINGLE_LINE_COMMENT', NO_PRECEDENCE, COMMENT_TOKEN, stringValue: null)
SLASH → const TokenType
const TokenType(63, '/', 'SLASH', MULTIPLICATIVE_PRECEDENCE, SLASH_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
SLASH_EQ → const TokenType
const TokenType(64, '/=', 'SLASH_EQ', ASSIGNMENT_PRECEDENCE, SLASH_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.SLASH, isOperator: true)
STAR → const TokenType
const TokenType(65, '*', 'STAR', MULTIPLICATIVE_PRECEDENCE, STAR_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
STAR_EQ → const TokenType
const TokenType(66, '*=', 'STAR_EQ', ASSIGNMENT_PRECEDENCE, STAR_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.STAR, isOperator: true)
STRING → const TokenType
const TokenType(8, 'string', 'STRING', NO_PRECEDENCE, STRING_TOKEN, stringValue: null)
STRING_INTERPOLATION_EXPRESSION → const TokenType
const TokenType(67, '\${', 'STRING_INTERPOLATION_EXPRESSION', NO_PRECEDENCE, STRING_INTERPOLATION_TOKEN)
STRING_INTERPOLATION_IDENTIFIER → const TokenType
const TokenType(68, '\$', 'STRING_INTERPOLATION_IDENTIFIER', NO_PRECEDENCE, STRING_INTERPOLATION_IDENTIFIER_TOKEN)
TILDE → const TokenType
const TokenType(69, '~', 'TILDE', PREFIX_PRECEDENCE, TILDE_TOKEN, isOperator: true, isUserDefinableOperator: true)
TILDE_SLASH → const TokenType
const TokenType(70, '~/', 'TILDE_SLASH', MULTIPLICATIVE_PRECEDENCE, TILDE_SLASH_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
TILDE_SLASH_EQ → const TokenType
const TokenType(71, '~/=', 'TILDE_SLASH_EQ', ASSIGNMENT_PRECEDENCE, TILDE_SLASH_EQ_TOKEN, binaryOperatorOfCompoundAssignment: TokenType.TILDE_SLASH, isOperator: true)