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 asabstract
orconst
.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 asclass
,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
- AMPERSAND_EQ → const TokenType
- 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
- BAR_EQ → const TokenType
- CARET → const TokenType
-
const TokenType(23, '^', 'CARET', BITWISE_XOR_PRECEDENCE, CARET_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
- CARET_EQ → const TokenType
- 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
- 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
- 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
- MINUS → const TokenType
-
const TokenType(45, '-', 'MINUS', ADDITIVE_PRECEDENCE, MINUS_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
- MINUS_EQ → const TokenType
- 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
- 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
- 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
- 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
- STAR → const TokenType
-
const TokenType(65, '*', 'STAR', MULTIPLICATIVE_PRECEDENCE, STAR_TOKEN, isOperator: true, isBinaryOperator: true, isUserDefinableOperator: true)
- STAR_EQ → const TokenType
- 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