| Index: pkg/analyzer/lib/src/generated/scanner.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/scanner.dart b/pkg/analyzer/lib/src/generated/scanner.dart
|
| index 894edacc8ff52fefff1106ff57d84cb1d7914b9e..ef03a42cfe5d23cd1d96229f4bfba5b278c2ff1f 100644
|
| --- a/pkg/analyzer/lib/src/generated/scanner.dart
|
| +++ b/pkg/analyzer/lib/src/generated/scanner.dart
|
| @@ -97,7 +97,7 @@ class KeywordState {
|
| * A table mapping characters to the states to which those characters will transition. (The index
|
| * into the array is the offset from the character `'a'` to the transitioning character.)
|
| */
|
| - final List<KeywordState> _table;
|
| + List<KeywordState> _table;
|
|
|
| /**
|
| * The keyword that is recognized by this state, or `null` if this state is not a terminal
|
| @@ -112,7 +112,8 @@ class KeywordState {
|
| * @param table a table mapping characters to the states to which those characters will transition
|
| * @param syntax the syntax of the keyword that is recognized by the state
|
| */
|
| - KeywordState(this._table, String syntax) {
|
| + KeywordState(List<KeywordState> table, String syntax) {
|
| + this._table = table;
|
| this._keyword = (syntax == null) ? null : Keyword.keywords[syntax];
|
| }
|
|
|
| @@ -139,19 +140,19 @@ class KeywordState {
|
| * scanner.
|
| */
|
| class ScannerErrorCode extends Enum<ScannerErrorCode> implements ErrorCode {
|
| - static const ScannerErrorCode ILLEGAL_CHARACTER = const ScannerErrorCode.con1('ILLEGAL_CHARACTER', 0, "Illegal character %x");
|
| + static final ScannerErrorCode ILLEGAL_CHARACTER = new ScannerErrorCode.con1('ILLEGAL_CHARACTER', 0, "Illegal character %x");
|
|
|
| - static const ScannerErrorCode MISSING_DIGIT = const ScannerErrorCode.con1('MISSING_DIGIT', 1, "Decimal digit expected");
|
| + static final ScannerErrorCode MISSING_DIGIT = new ScannerErrorCode.con1('MISSING_DIGIT', 1, "Decimal digit expected");
|
|
|
| - static const ScannerErrorCode MISSING_HEX_DIGIT = const ScannerErrorCode.con1('MISSING_HEX_DIGIT', 2, "Hexidecimal digit expected");
|
| + static final ScannerErrorCode MISSING_HEX_DIGIT = new ScannerErrorCode.con1('MISSING_HEX_DIGIT', 2, "Hexidecimal digit expected");
|
|
|
| - static const ScannerErrorCode MISSING_QUOTE = const ScannerErrorCode.con1('MISSING_QUOTE', 3, "Expected quote (' or \")");
|
| + static final ScannerErrorCode MISSING_QUOTE = new ScannerErrorCode.con1('MISSING_QUOTE', 3, "Expected quote (' or \")");
|
|
|
| - static const ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = const ScannerErrorCode.con1('UNTERMINATED_MULTI_LINE_COMMENT', 4, "Unterminated multi-line comment");
|
| + static final ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = new ScannerErrorCode.con1('UNTERMINATED_MULTI_LINE_COMMENT', 4, "Unterminated multi-line comment");
|
|
|
| - static const ScannerErrorCode UNTERMINATED_STRING_LITERAL = const ScannerErrorCode.con1('UNTERMINATED_STRING_LITERAL', 5, "Unterminated string literal");
|
| + static final ScannerErrorCode UNTERMINATED_STRING_LITERAL = new ScannerErrorCode.con1('UNTERMINATED_STRING_LITERAL', 5, "Unterminated string literal");
|
|
|
| - static const List<ScannerErrorCode> values = const [
|
| + static final List<ScannerErrorCode> values = [
|
| ILLEGAL_CHARACTER,
|
| MISSING_DIGIT,
|
| MISSING_HEX_DIGIT,
|
| @@ -162,20 +163,22 @@ class ScannerErrorCode extends Enum<ScannerErrorCode> implements ErrorCode {
|
| /**
|
| * The template used to create the message to be displayed for this error.
|
| */
|
| - final String message;
|
| + String message;
|
|
|
| /**
|
| * The template used to create the correction to be displayed for this error, or `null` if
|
| * there is no correction information for this error.
|
| */
|
| - final String correction;
|
| + String correction10;
|
|
|
| /**
|
| * Initialize a newly created error code to have the given message.
|
| *
|
| * @param message the message template used to create the message to be displayed for this error
|
| */
|
| - const ScannerErrorCode.con1(String name, int ordinal, String message) : this.con2(name, ordinal, message, null);
|
| + ScannerErrorCode.con1(String name, int ordinal, String message) : super(name, ordinal) {
|
| + this.message = message;
|
| + }
|
|
|
| /**
|
| * Initialize a newly created error code to have the given message and correction.
|
| @@ -183,7 +186,13 @@ class ScannerErrorCode extends Enum<ScannerErrorCode> implements ErrorCode {
|
| * @param message the template used to create the message to be displayed for the error
|
| * @param correction the template used to create the correction to be displayed for the error
|
| */
|
| - const ScannerErrorCode.con2(String name, int ordinal, this.message, this.correction) : super(name, ordinal);
|
| + ScannerErrorCode.con2(String name, int ordinal, String message, String correction) : super(name, ordinal) {
|
| + this.message = message;
|
| + this.correction10 = correction;
|
| + }
|
| +
|
| + @override
|
| + String get correction => correction10;
|
|
|
| @override
|
| ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
|
| @@ -201,7 +210,7 @@ class SubSequenceReader extends CharSequenceReader {
|
| /**
|
| * The offset from the beginning of the file to the beginning of the source being scanned.
|
| */
|
| - final int _offsetDelta;
|
| + int _offsetDelta = 0;
|
|
|
| /**
|
| * Initialize a newly created reader to read the characters in the given sequence.
|
| @@ -210,7 +219,9 @@ class SubSequenceReader extends CharSequenceReader {
|
| * @param offsetDelta the offset from the beginning of the file to the beginning of the source
|
| * being scanned
|
| */
|
| - SubSequenceReader(String sequence, this._offsetDelta) : super(sequence);
|
| + SubSequenceReader(String sequence, int offsetDelta) : super(sequence) {
|
| + this._offsetDelta = offsetDelta;
|
| + }
|
|
|
| @override
|
| int get offset => _offsetDelta + super.offset;
|
| @@ -232,7 +243,7 @@ class StringTokenWithComment extends StringToken {
|
| /**
|
| * The first comment in the list of comments that precede this token.
|
| */
|
| - final Token _precedingComment;
|
| + Token _precedingComment;
|
|
|
| /**
|
| * Initialize a newly created token to have the given type and offset and to be preceded by the
|
| @@ -242,7 +253,9 @@ class StringTokenWithComment extends StringToken {
|
| * @param offset the offset from the beginning of the file to the first character in the token
|
| * @param precedingComment the first comment in the list of comments that precede this token
|
| */
|
| - StringTokenWithComment(TokenType type, String value, int offset, this._precedingComment) : super(type, value, offset);
|
| + StringTokenWithComment(TokenType type, String value, int offset, Token precedingComment) : super(type, value, offset) {
|
| + this._precedingComment = precedingComment;
|
| + }
|
|
|
| @override
|
| Token copy() => new StringTokenWithComment(type, lexeme, offset, copyComments(_precedingComment));
|
| @@ -265,103 +278,103 @@ class StringTokenWithComment extends StringToken {
|
| * The enumeration `Keyword` defines the keywords in the Dart programming language.
|
| */
|
| class Keyword extends Enum<Keyword> {
|
| - static const Keyword ASSERT = const Keyword.con1('ASSERT', 0, "assert");
|
| + static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert");
|
|
|
| - static const Keyword BREAK = const Keyword.con1('BREAK', 1, "break");
|
| + static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break");
|
|
|
| - static const Keyword CASE = const Keyword.con1('CASE', 2, "case");
|
| + static final Keyword CASE = new Keyword.con1('CASE', 2, "case");
|
|
|
| - static const Keyword CATCH = const Keyword.con1('CATCH', 3, "catch");
|
| + static final Keyword CATCH = new Keyword.con1('CATCH', 3, "catch");
|
|
|
| - static const Keyword CLASS = const Keyword.con1('CLASS', 4, "class");
|
| + static final Keyword CLASS = new Keyword.con1('CLASS', 4, "class");
|
|
|
| - static const Keyword CONST = const Keyword.con1('CONST', 5, "const");
|
| + static final Keyword CONST = new Keyword.con1('CONST', 5, "const");
|
|
|
| - static const Keyword CONTINUE = const Keyword.con1('CONTINUE', 6, "continue");
|
| + static final Keyword CONTINUE = new Keyword.con1('CONTINUE', 6, "continue");
|
|
|
| - static const Keyword DEFAULT = const Keyword.con1('DEFAULT', 7, "default");
|
| + static final Keyword DEFAULT = new Keyword.con1('DEFAULT', 7, "default");
|
|
|
| - static const Keyword DO = const Keyword.con1('DO', 8, "do");
|
| + static final Keyword DO = new Keyword.con1('DO', 8, "do");
|
|
|
| - static const Keyword ELSE = const Keyword.con1('ELSE', 9, "else");
|
| + static final Keyword ELSE = new Keyword.con1('ELSE', 9, "else");
|
|
|
| - static const Keyword ENUM = const Keyword.con1('ENUM', 10, "enum");
|
| + static final Keyword ENUM = new Keyword.con1('ENUM', 10, "enum");
|
|
|
| - static const Keyword EXTENDS = const Keyword.con1('EXTENDS', 11, "extends");
|
| + static final Keyword EXTENDS = new Keyword.con1('EXTENDS', 11, "extends");
|
|
|
| - static const Keyword FALSE = const Keyword.con1('FALSE', 12, "false");
|
| + static final Keyword FALSE = new Keyword.con1('FALSE', 12, "false");
|
|
|
| - static const Keyword FINAL = const Keyword.con1('FINAL', 13, "final");
|
| + static final Keyword FINAL = new Keyword.con1('FINAL', 13, "final");
|
|
|
| - static const Keyword FINALLY = const Keyword.con1('FINALLY', 14, "finally");
|
| + static final Keyword FINALLY = new Keyword.con1('FINALLY', 14, "finally");
|
|
|
| - static const Keyword FOR = const Keyword.con1('FOR', 15, "for");
|
| + static final Keyword FOR = new Keyword.con1('FOR', 15, "for");
|
|
|
| - static const Keyword IF = const Keyword.con1('IF', 16, "if");
|
| + static final Keyword IF = new Keyword.con1('IF', 16, "if");
|
|
|
| - static const Keyword IN = const Keyword.con1('IN', 17, "in");
|
| + static final Keyword IN = new Keyword.con1('IN', 17, "in");
|
|
|
| - static const Keyword IS = const Keyword.con1('IS', 18, "is");
|
| + static final Keyword IS = new Keyword.con1('IS', 18, "is");
|
|
|
| - static const Keyword NEW = const Keyword.con1('NEW', 19, "new");
|
| + static final Keyword NEW = new Keyword.con1('NEW', 19, "new");
|
|
|
| - static const Keyword NULL = const Keyword.con1('NULL', 20, "null");
|
| + static final Keyword NULL = new Keyword.con1('NULL', 20, "null");
|
|
|
| - static const Keyword RETHROW = const Keyword.con1('RETHROW', 21, "rethrow");
|
| + static final Keyword RETHROW = new Keyword.con1('RETHROW', 21, "rethrow");
|
|
|
| - static const Keyword RETURN = const Keyword.con1('RETURN', 22, "return");
|
| + static final Keyword RETURN = new Keyword.con1('RETURN', 22, "return");
|
|
|
| - static const Keyword SUPER = const Keyword.con1('SUPER', 23, "super");
|
| + static final Keyword SUPER = new Keyword.con1('SUPER', 23, "super");
|
|
|
| - static const Keyword SWITCH = const Keyword.con1('SWITCH', 24, "switch");
|
| + static final Keyword SWITCH = new Keyword.con1('SWITCH', 24, "switch");
|
|
|
| - static const Keyword THIS = const Keyword.con1('THIS', 25, "this");
|
| + static final Keyword THIS = new Keyword.con1('THIS', 25, "this");
|
|
|
| - static const Keyword THROW = const Keyword.con1('THROW', 26, "throw");
|
| + static final Keyword THROW = new Keyword.con1('THROW', 26, "throw");
|
|
|
| - static const Keyword TRUE = const Keyword.con1('TRUE', 27, "true");
|
| + static final Keyword TRUE = new Keyword.con1('TRUE', 27, "true");
|
|
|
| - static const Keyword TRY = const Keyword.con1('TRY', 28, "try");
|
| + static final Keyword TRY = new Keyword.con1('TRY', 28, "try");
|
|
|
| - static const Keyword VAR = const Keyword.con1('VAR', 29, "var");
|
| + static final Keyword VAR = new Keyword.con1('VAR', 29, "var");
|
|
|
| - static const Keyword VOID = const Keyword.con1('VOID', 30, "void");
|
| + static final Keyword VOID = new Keyword.con1('VOID', 30, "void");
|
|
|
| - static const Keyword WHILE = const Keyword.con1('WHILE', 31, "while");
|
| + static final Keyword WHILE = new Keyword.con1('WHILE', 31, "while");
|
|
|
| - static const Keyword WITH = const Keyword.con1('WITH', 32, "with");
|
| + static final Keyword WITH = new Keyword.con1('WITH', 32, "with");
|
|
|
| - static const Keyword ABSTRACT = const Keyword.con2('ABSTRACT', 33, "abstract", true);
|
| + static final Keyword ABSTRACT = new Keyword.con2('ABSTRACT', 33, "abstract", true);
|
|
|
| - static const Keyword AS = const Keyword.con2('AS', 34, "as", true);
|
| + static final Keyword AS = new Keyword.con2('AS', 34, "as", true);
|
|
|
| - static const Keyword DYNAMIC = const Keyword.con2('DYNAMIC', 35, "dynamic", true);
|
| + static final Keyword DYNAMIC = new Keyword.con2('DYNAMIC', 35, "dynamic", true);
|
|
|
| - static const Keyword EXPORT = const Keyword.con2('EXPORT', 36, "export", true);
|
| + static final Keyword EXPORT = new Keyword.con2('EXPORT', 36, "export", true);
|
|
|
| - static const Keyword EXTERNAL = const Keyword.con2('EXTERNAL', 37, "external", true);
|
| + static final Keyword EXTERNAL = new Keyword.con2('EXTERNAL', 37, "external", true);
|
|
|
| - static const Keyword FACTORY = const Keyword.con2('FACTORY', 38, "factory", true);
|
| + static final Keyword FACTORY = new Keyword.con2('FACTORY', 38, "factory", true);
|
|
|
| - static const Keyword GET = const Keyword.con2('GET', 39, "get", true);
|
| + static final Keyword GET = new Keyword.con2('GET', 39, "get", true);
|
|
|
| - static const Keyword IMPLEMENTS = const Keyword.con2('IMPLEMENTS', 40, "implements", true);
|
| + static final Keyword IMPLEMENTS = new Keyword.con2('IMPLEMENTS', 40, "implements", true);
|
|
|
| - static const Keyword IMPORT = const Keyword.con2('IMPORT', 41, "import", true);
|
| + static final Keyword IMPORT = new Keyword.con2('IMPORT', 41, "import", true);
|
|
|
| - static const Keyword LIBRARY = const Keyword.con2('LIBRARY', 42, "library", true);
|
| + static final Keyword LIBRARY = new Keyword.con2('LIBRARY', 42, "library", true);
|
|
|
| - static const Keyword OPERATOR = const Keyword.con2('OPERATOR', 43, "operator", true);
|
| + static final Keyword OPERATOR = new Keyword.con2('OPERATOR', 43, "operator", true);
|
|
|
| - static const Keyword PART = const Keyword.con2('PART', 44, "part", true);
|
| + static final Keyword PART = new Keyword.con2('PART', 44, "part", true);
|
|
|
| - static const Keyword SET = const Keyword.con2('SET', 45, "set", true);
|
| + static final Keyword SET = new Keyword.con2('SET', 45, "set", true);
|
|
|
| - static const Keyword STATIC = const Keyword.con2('STATIC', 46, "static", true);
|
| + static final Keyword STATIC = new Keyword.con2('STATIC', 46, "static", true);
|
|
|
| - static const Keyword TYPEDEF = const Keyword.con2('TYPEDEF', 47, "typedef", true);
|
| + static final Keyword TYPEDEF = new Keyword.con2('TYPEDEF', 47, "typedef", true);
|
|
|
| - static const List<Keyword> values = const [
|
| + static final List<Keyword> values = [
|
| ASSERT,
|
| BREAK,
|
| CASE,
|
| @@ -414,13 +427,13 @@ class Keyword extends Enum<Keyword> {
|
| /**
|
| * The lexeme for the keyword.
|
| */
|
| - final String syntax;
|
| + String _syntax;
|
|
|
| /**
|
| * A flag indicating whether the keyword is a pseudo-keyword. Pseudo keywords can be used as
|
| * identifiers.
|
| */
|
| - final bool isPseudoKeyword;
|
| + bool _isPseudoKeyword = false;
|
|
|
| /**
|
| * A table mapping the lexemes of keywords to the corresponding keyword.
|
| @@ -435,7 +448,7 @@ class Keyword extends Enum<Keyword> {
|
| static Map<String, Keyword> _createKeywordMap() {
|
| LinkedHashMap<String, Keyword> result = new LinkedHashMap<String, Keyword>();
|
| for (Keyword keyword in values) {
|
| - result[keyword.syntax] = keyword;
|
| + result[keyword._syntax] = keyword;
|
| }
|
| return result;
|
| }
|
| @@ -446,7 +459,7 @@ class Keyword extends Enum<Keyword> {
|
| *
|
| * @param syntax the lexeme for the keyword
|
| */
|
| - const Keyword.con1(String name, int ordinal, String syntax) : this.con2(name, ordinal, syntax, false);
|
| + Keyword.con1(String name, int ordinal, String syntax) : this.con2(name, ordinal, syntax, false);
|
|
|
| /**
|
| * Initialize a newly created keyword to have the given syntax. The keyword is a pseudo-keyword if
|
| @@ -455,7 +468,25 @@ class Keyword extends Enum<Keyword> {
|
| * @param syntax the lexeme for the keyword
|
| * @param isPseudoKeyword `true` if this keyword is a pseudo-keyword
|
| */
|
| - const Keyword.con2(String name, int ordinal, this.syntax, this.isPseudoKeyword) : super(name, ordinal);
|
| + Keyword.con2(String name, int ordinal, String syntax, bool isPseudoKeyword) : super(name, ordinal) {
|
| + this._syntax = syntax;
|
| + this._isPseudoKeyword = isPseudoKeyword;
|
| + }
|
| +
|
| + /**
|
| + * Return the lexeme for the keyword.
|
| + *
|
| + * @return the lexeme for the keyword
|
| + */
|
| + String get syntax => _syntax;
|
| +
|
| + /**
|
| + * Return `true` if this keyword is a pseudo-keyword. Pseudo keywords can be used as
|
| + * identifiers.
|
| + *
|
| + * @return `true` if this keyword is a pseudo-keyword
|
| + */
|
| + bool get isPseudoKeyword => _isPseudoKeyword;
|
| }
|
|
|
| /**
|
| @@ -466,7 +497,7 @@ class CharSequenceReader implements CharacterReader {
|
| /**
|
| * The sequence from which characters will be read.
|
| */
|
| - final String _sequence;
|
| + String _sequence;
|
|
|
| /**
|
| * The number of characters in the string.
|
| @@ -483,8 +514,9 @@ class CharSequenceReader implements CharacterReader {
|
| *
|
| * @param sequence the sequence from which characters will be read
|
| */
|
| - CharSequenceReader(this._sequence) {
|
| - this._stringLength = _sequence.length;
|
| + CharSequenceReader(String sequence) {
|
| + this._sequence = sequence;
|
| + this._stringLength = sequence.length;
|
| this._charOffset = -1;
|
| }
|
|
|
| @@ -766,17 +798,17 @@ class Scanner {
|
| /**
|
| * The source being scanned.
|
| */
|
| - final Source source;
|
| + Source source;
|
|
|
| /**
|
| * The reader used to access the characters in the source.
|
| */
|
| - final CharacterReader _reader;
|
| + CharacterReader _reader;
|
|
|
| /**
|
| * The error listener that will be informed of any errors that are found during the scan.
|
| */
|
| - final AnalysisErrorListener _errorListener;
|
| + AnalysisErrorListener _errorListener;
|
|
|
| /**
|
| * The flag specifying if documentation comments should be parsed.
|
| @@ -836,7 +868,10 @@ class Scanner {
|
| * @param reader the character reader used to read the characters in the source
|
| * @param errorListener the error listener that will be informed of any errors that are found
|
| */
|
| - Scanner(this.source, this._reader, this._errorListener) {
|
| + Scanner(Source source, CharacterReader reader, AnalysisErrorListener errorListener) {
|
| + this.source = source;
|
| + this._reader = reader;
|
| + this._errorListener = errorListener;
|
| _tokens = new Token(TokenType.EOF, -1);
|
| _tokens.setNext(_tokens);
|
| _tail = _tokens;
|
| @@ -1867,7 +1902,7 @@ class TokenWithComment extends Token {
|
| /**
|
| * The first comment in the list of comments that precede this token.
|
| */
|
| - final Token _precedingComment;
|
| + Token _precedingComment;
|
|
|
| /**
|
| * Initialize a newly created token to have the given type and offset and to be preceded by the
|
| @@ -1877,7 +1912,9 @@ class TokenWithComment extends Token {
|
| * @param offset the offset from the beginning of the file to the first character in the token
|
| * @param precedingComment the first comment in the list of comments that precede this token
|
| */
|
| - TokenWithComment(TokenType type, int offset, this._precedingComment) : super(type, offset);
|
| + TokenWithComment(TokenType type, int offset, Token precedingComment) : super(type, offset) {
|
| + this._precedingComment = precedingComment;
|
| + }
|
|
|
| @override
|
| Token copy() => new TokenWithComment(type, offset, _precedingComment);
|
| @@ -1894,7 +1931,7 @@ class Token {
|
| /**
|
| * The type of the token.
|
| */
|
| - final TokenType type;
|
| + TokenType type;
|
|
|
| /**
|
| * The offset from the beginning of the file to the first character in the token.
|
| @@ -1917,7 +1954,8 @@ class Token {
|
| * @param type the type of the token
|
| * @param offset the offset from the beginning of the file to the first character in the token
|
| */
|
| - Token(this.type, int offset) {
|
| + Token(TokenType type, int offset) {
|
| + this.type = type;
|
| this.offset = offset;
|
| }
|
|
|
| @@ -2127,7 +2165,7 @@ class BeginTokenWithComment extends BeginToken {
|
| /**
|
| * The first comment in the list of comments that precede this token.
|
| */
|
| - final Token _precedingComment;
|
| + Token _precedingComment;
|
|
|
| /**
|
| * Initialize a newly created token to have the given type and offset and to be preceded by the
|
| @@ -2137,7 +2175,9 @@ class BeginTokenWithComment extends BeginToken {
|
| * @param offset the offset from the beginning of the file to the first character in the token
|
| * @param precedingComment the first comment in the list of comments that precede this token
|
| */
|
| - BeginTokenWithComment(TokenType type, int offset, this._precedingComment) : super(type, offset);
|
| + BeginTokenWithComment(TokenType type, int offset, Token precedingComment) : super(type, offset) {
|
| + this._precedingComment = precedingComment;
|
| + }
|
|
|
| @override
|
| Token copy() => new BeginTokenWithComment(type, offset, copyComments(_precedingComment));
|
| @@ -2163,7 +2203,7 @@ class KeywordToken extends Token {
|
| /**
|
| * The keyword being represented by this token.
|
| */
|
| - final Keyword keyword;
|
| + Keyword keyword;
|
|
|
| /**
|
| * Initialize a newly created token to represent the given keyword.
|
| @@ -2171,7 +2211,9 @@ class KeywordToken extends Token {
|
| * @param keyword the keyword being represented by this token
|
| * @param offset the offset from the beginning of the file to the first character in the token
|
| */
|
| - KeywordToken(this.keyword, int offset) : super(TokenType.KEYWORD, offset);
|
| + KeywordToken(Keyword keyword, int offset) : super(TokenType.KEYWORD, offset) {
|
| + this.keyword = keyword;
|
| + }
|
|
|
| @override
|
| Token copy() => new KeywordToken(keyword, offset);
|
| @@ -2214,84 +2256,84 @@ class TokenClass extends Enum<TokenClass> {
|
| /**
|
| * A value used to indicate that the token type is not part of any specific class of token.
|
| */
|
| - static const TokenClass NO_CLASS = const TokenClass.con1('NO_CLASS', 0);
|
| + static final TokenClass NO_CLASS = new TokenClass.con1('NO_CLASS', 0);
|
|
|
| /**
|
| * A value used to indicate that the token type is an additive operator.
|
| */
|
| - static const TokenClass ADDITIVE_OPERATOR = const TokenClass.con2('ADDITIVE_OPERATOR', 1, 12);
|
| + static final TokenClass ADDITIVE_OPERATOR = new TokenClass.con2('ADDITIVE_OPERATOR', 1, 12);
|
|
|
| /**
|
| * A value used to indicate that the token type is an assignment operator.
|
| */
|
| - static const TokenClass ASSIGNMENT_OPERATOR = const TokenClass.con2('ASSIGNMENT_OPERATOR', 2, 1);
|
| + static final TokenClass ASSIGNMENT_OPERATOR = new TokenClass.con2('ASSIGNMENT_OPERATOR', 2, 1);
|
|
|
| /**
|
| * A value used to indicate that the token type is a bitwise-and operator.
|
| */
|
| - static const TokenClass BITWISE_AND_OPERATOR = const TokenClass.con2('BITWISE_AND_OPERATOR', 3, 10);
|
| + static final TokenClass BITWISE_AND_OPERATOR = new TokenClass.con2('BITWISE_AND_OPERATOR', 3, 10);
|
|
|
| /**
|
| * A value used to indicate that the token type is a bitwise-or operator.
|
| */
|
| - static const TokenClass BITWISE_OR_OPERATOR = const TokenClass.con2('BITWISE_OR_OPERATOR', 4, 8);
|
| + static final TokenClass BITWISE_OR_OPERATOR = new TokenClass.con2('BITWISE_OR_OPERATOR', 4, 8);
|
|
|
| /**
|
| * A value used to indicate that the token type is a bitwise-xor operator.
|
| */
|
| - static const TokenClass BITWISE_XOR_OPERATOR = const TokenClass.con2('BITWISE_XOR_OPERATOR', 5, 9);
|
| + static final TokenClass BITWISE_XOR_OPERATOR = new TokenClass.con2('BITWISE_XOR_OPERATOR', 5, 9);
|
|
|
| /**
|
| * A value used to indicate that the token type is a cascade operator.
|
| */
|
| - static const TokenClass CASCADE_OPERATOR = const TokenClass.con2('CASCADE_OPERATOR', 6, 2);
|
| + static final TokenClass CASCADE_OPERATOR = new TokenClass.con2('CASCADE_OPERATOR', 6, 2);
|
|
|
| /**
|
| * A value used to indicate that the token type is a conditional operator.
|
| */
|
| - static const TokenClass CONDITIONAL_OPERATOR = const TokenClass.con2('CONDITIONAL_OPERATOR', 7, 3);
|
| + static final TokenClass CONDITIONAL_OPERATOR = new TokenClass.con2('CONDITIONAL_OPERATOR', 7, 3);
|
|
|
| /**
|
| * A value used to indicate that the token type is an equality operator.
|
| */
|
| - static const TokenClass EQUALITY_OPERATOR = const TokenClass.con2('EQUALITY_OPERATOR', 8, 6);
|
| + static final TokenClass EQUALITY_OPERATOR = new TokenClass.con2('EQUALITY_OPERATOR', 8, 6);
|
|
|
| /**
|
| * A value used to indicate that the token type is a logical-and operator.
|
| */
|
| - static const TokenClass LOGICAL_AND_OPERATOR = const TokenClass.con2('LOGICAL_AND_OPERATOR', 9, 5);
|
| + static final TokenClass LOGICAL_AND_OPERATOR = new TokenClass.con2('LOGICAL_AND_OPERATOR', 9, 5);
|
|
|
| /**
|
| * A value used to indicate that the token type is a logical-or operator.
|
| */
|
| - static const TokenClass LOGICAL_OR_OPERATOR = const TokenClass.con2('LOGICAL_OR_OPERATOR', 10, 4);
|
| + static final TokenClass LOGICAL_OR_OPERATOR = new TokenClass.con2('LOGICAL_OR_OPERATOR', 10, 4);
|
|
|
| /**
|
| * A value used to indicate that the token type is a multiplicative operator.
|
| */
|
| - static const TokenClass MULTIPLICATIVE_OPERATOR = const TokenClass.con2('MULTIPLICATIVE_OPERATOR', 11, 13);
|
| + static final TokenClass MULTIPLICATIVE_OPERATOR = new TokenClass.con2('MULTIPLICATIVE_OPERATOR', 11, 13);
|
|
|
| /**
|
| * A value used to indicate that the token type is a relational operator.
|
| */
|
| - static const TokenClass RELATIONAL_OPERATOR = const TokenClass.con2('RELATIONAL_OPERATOR', 12, 7);
|
| + static final TokenClass RELATIONAL_OPERATOR = new TokenClass.con2('RELATIONAL_OPERATOR', 12, 7);
|
|
|
| /**
|
| * A value used to indicate that the token type is a shift operator.
|
| */
|
| - static const TokenClass SHIFT_OPERATOR = const TokenClass.con2('SHIFT_OPERATOR', 13, 11);
|
| + static final TokenClass SHIFT_OPERATOR = new TokenClass.con2('SHIFT_OPERATOR', 13, 11);
|
|
|
| /**
|
| * A value used to indicate that the token type is a unary operator.
|
| */
|
| - static const TokenClass UNARY_POSTFIX_OPERATOR = const TokenClass.con2('UNARY_POSTFIX_OPERATOR', 14, 15);
|
| + static final TokenClass UNARY_POSTFIX_OPERATOR = new TokenClass.con2('UNARY_POSTFIX_OPERATOR', 14, 15);
|
|
|
| /**
|
| * A value used to indicate that the token type is a unary operator.
|
| */
|
| - static const TokenClass UNARY_PREFIX_OPERATOR = const TokenClass.con2('UNARY_PREFIX_OPERATOR', 15, 14);
|
| + static final TokenClass UNARY_PREFIX_OPERATOR = new TokenClass.con2('UNARY_PREFIX_OPERATOR', 15, 14);
|
|
|
| - static const List<TokenClass> values = const [
|
| + static final List<TokenClass> values = [
|
| NO_CLASS,
|
| ADDITIVE_OPERATOR,
|
| ASSIGNMENT_OPERATOR,
|
| @@ -2313,11 +2355,21 @@ class TokenClass extends Enum<TokenClass> {
|
| * The precedence of tokens of this class, or `0` if the such tokens do not represent an
|
| * operator.
|
| */
|
| - final int precedence;
|
| + int _precedence = 0;
|
| +
|
| + TokenClass.con1(String name, int ordinal) : this.con2(name, ordinal, 0);
|
|
|
| - const TokenClass.con1(String name, int ordinal) : this.con2(name, ordinal, 0);
|
| + TokenClass.con2(String name, int ordinal, int precedence) : super(name, ordinal) {
|
| + this._precedence = precedence;
|
| + }
|
|
|
| - const TokenClass.con2(String name, int ordinal, this.precedence) : super(name, ordinal);
|
| + /**
|
| + * Return the precedence of tokens of this class, or `0` if the such tokens do not represent
|
| + * an operator.
|
| + *
|
| + * @return the precedence of tokens of this class
|
| + */
|
| + int get precedence => _precedence;
|
| }
|
|
|
| /**
|
| @@ -2328,7 +2380,7 @@ class KeywordTokenWithComment extends KeywordToken {
|
| /**
|
| * The first comment in the list of comments that precede this token.
|
| */
|
| - final Token _precedingComment;
|
| + Token _precedingComment;
|
|
|
| /**
|
| * Initialize a newly created token to to represent the given keyword and to be preceded by the
|
| @@ -2338,7 +2390,9 @@ class KeywordTokenWithComment extends KeywordToken {
|
| * @param offset the offset from the beginning of the file to the first character in the token
|
| * @param precedingComment the first comment in the list of comments that precede this token
|
| */
|
| - KeywordTokenWithComment(Keyword keyword, int offset, this._precedingComment) : super(keyword, offset);
|
| + KeywordTokenWithComment(Keyword keyword, int offset, Token precedingComment) : super(keyword, offset) {
|
| + this._precedingComment = precedingComment;
|
| + }
|
|
|
| @override
|
| Token copy() => new KeywordTokenWithComment(keyword, offset, copyComments(_precedingComment));
|
| @@ -2365,143 +2419,143 @@ class TokenType extends Enum<TokenType> {
|
| /**
|
| * The type of the token that marks the end of the input.
|
| */
|
| - static const TokenType EOF = const TokenType_EOF('EOF', 0, TokenClass.NO_CLASS, "");
|
| + static final TokenType EOF = new TokenType_EOF('EOF', 0, null, "");
|
|
|
| - static const TokenType DOUBLE = const TokenType.con1('DOUBLE', 1);
|
| + static final TokenType DOUBLE = new TokenType.con1('DOUBLE', 1);
|
|
|
| - static const TokenType HEXADECIMAL = const TokenType.con1('HEXADECIMAL', 2);
|
| + static final TokenType HEXADECIMAL = new TokenType.con1('HEXADECIMAL', 2);
|
|
|
| - static const TokenType IDENTIFIER = const TokenType.con1('IDENTIFIER', 3);
|
| + static final TokenType IDENTIFIER = new TokenType.con1('IDENTIFIER', 3);
|
|
|
| - static const TokenType INT = const TokenType.con1('INT', 4);
|
| + static final TokenType INT = new TokenType.con1('INT', 4);
|
|
|
| - static const TokenType KEYWORD = const TokenType.con1('KEYWORD', 5);
|
| + static final TokenType KEYWORD = new TokenType.con1('KEYWORD', 5);
|
|
|
| - static const TokenType MULTI_LINE_COMMENT = const TokenType.con1('MULTI_LINE_COMMENT', 6);
|
| + static final TokenType MULTI_LINE_COMMENT = new TokenType.con1('MULTI_LINE_COMMENT', 6);
|
|
|
| - static const TokenType SCRIPT_TAG = const TokenType.con1('SCRIPT_TAG', 7);
|
| + static final TokenType SCRIPT_TAG = new TokenType.con1('SCRIPT_TAG', 7);
|
|
|
| - static const TokenType SINGLE_LINE_COMMENT = const TokenType.con1('SINGLE_LINE_COMMENT', 8);
|
| + static final TokenType SINGLE_LINE_COMMENT = new TokenType.con1('SINGLE_LINE_COMMENT', 8);
|
|
|
| - static const TokenType STRING = const TokenType.con1('STRING', 9);
|
| + static final TokenType STRING = new TokenType.con1('STRING', 9);
|
|
|
| - static const TokenType AMPERSAND = const TokenType.con2('AMPERSAND', 10, TokenClass.BITWISE_AND_OPERATOR, "&");
|
| + static final TokenType AMPERSAND = new TokenType.con2('AMPERSAND', 10, TokenClass.BITWISE_AND_OPERATOR, "&");
|
|
|
| - static const TokenType AMPERSAND_AMPERSAND = const TokenType.con2('AMPERSAND_AMPERSAND', 11, TokenClass.LOGICAL_AND_OPERATOR, "&&");
|
| + static final TokenType AMPERSAND_AMPERSAND = new TokenType.con2('AMPERSAND_AMPERSAND', 11, TokenClass.LOGICAL_AND_OPERATOR, "&&");
|
|
|
| - static const TokenType AMPERSAND_EQ = const TokenType.con2('AMPERSAND_EQ', 12, TokenClass.ASSIGNMENT_OPERATOR, "&=");
|
| + static final TokenType AMPERSAND_EQ = new TokenType.con2('AMPERSAND_EQ', 12, TokenClass.ASSIGNMENT_OPERATOR, "&=");
|
|
|
| - static const TokenType AT = const TokenType.con2('AT', 13, TokenClass.NO_CLASS, "@");
|
| + static final TokenType AT = new TokenType.con2('AT', 13, null, "@");
|
|
|
| - static const TokenType BANG = const TokenType.con2('BANG', 14, TokenClass.UNARY_PREFIX_OPERATOR, "!");
|
| + static final TokenType BANG = new TokenType.con2('BANG', 14, TokenClass.UNARY_PREFIX_OPERATOR, "!");
|
|
|
| - static const TokenType BANG_EQ = const TokenType.con2('BANG_EQ', 15, TokenClass.EQUALITY_OPERATOR, "!=");
|
| + static final TokenType BANG_EQ = new TokenType.con2('BANG_EQ', 15, TokenClass.EQUALITY_OPERATOR, "!=");
|
|
|
| - static const TokenType BAR = const TokenType.con2('BAR', 16, TokenClass.BITWISE_OR_OPERATOR, "|");
|
| + static final TokenType BAR = new TokenType.con2('BAR', 16, TokenClass.BITWISE_OR_OPERATOR, "|");
|
|
|
| - static const TokenType BAR_BAR = const TokenType.con2('BAR_BAR', 17, TokenClass.LOGICAL_OR_OPERATOR, "||");
|
| + static final TokenType BAR_BAR = new TokenType.con2('BAR_BAR', 17, TokenClass.LOGICAL_OR_OPERATOR, "||");
|
|
|
| - static const TokenType BAR_EQ = const TokenType.con2('BAR_EQ', 18, TokenClass.ASSIGNMENT_OPERATOR, "|=");
|
| + static final TokenType BAR_EQ = new TokenType.con2('BAR_EQ', 18, TokenClass.ASSIGNMENT_OPERATOR, "|=");
|
|
|
| - static const TokenType COLON = const TokenType.con2('COLON', 19, TokenClass.NO_CLASS, ":");
|
| + static final TokenType COLON = new TokenType.con2('COLON', 19, null, ":");
|
|
|
| - static const TokenType COMMA = const TokenType.con2('COMMA', 20, TokenClass.NO_CLASS, ",");
|
| + static final TokenType COMMA = new TokenType.con2('COMMA', 20, null, ",");
|
|
|
| - static const TokenType CARET = const TokenType.con2('CARET', 21, TokenClass.BITWISE_XOR_OPERATOR, "^");
|
| + static final TokenType CARET = new TokenType.con2('CARET', 21, TokenClass.BITWISE_XOR_OPERATOR, "^");
|
|
|
| - static const TokenType CARET_EQ = const TokenType.con2('CARET_EQ', 22, TokenClass.ASSIGNMENT_OPERATOR, "^=");
|
| + static final TokenType CARET_EQ = new TokenType.con2('CARET_EQ', 22, TokenClass.ASSIGNMENT_OPERATOR, "^=");
|
|
|
| - static const TokenType CLOSE_CURLY_BRACKET = const TokenType.con2('CLOSE_CURLY_BRACKET', 23, TokenClass.NO_CLASS, "}");
|
| + static final TokenType CLOSE_CURLY_BRACKET = new TokenType.con2('CLOSE_CURLY_BRACKET', 23, null, "}");
|
|
|
| - static const TokenType CLOSE_PAREN = const TokenType.con2('CLOSE_PAREN', 24, TokenClass.NO_CLASS, ")");
|
| + static final TokenType CLOSE_PAREN = new TokenType.con2('CLOSE_PAREN', 24, null, ")");
|
|
|
| - static const TokenType CLOSE_SQUARE_BRACKET = const TokenType.con2('CLOSE_SQUARE_BRACKET', 25, TokenClass.NO_CLASS, "]");
|
| + static final TokenType CLOSE_SQUARE_BRACKET = new TokenType.con2('CLOSE_SQUARE_BRACKET', 25, null, "]");
|
|
|
| - static const TokenType EQ = const TokenType.con2('EQ', 26, TokenClass.ASSIGNMENT_OPERATOR, "=");
|
| + static final TokenType EQ = new TokenType.con2('EQ', 26, TokenClass.ASSIGNMENT_OPERATOR, "=");
|
|
|
| - static const TokenType EQ_EQ = const TokenType.con2('EQ_EQ', 27, TokenClass.EQUALITY_OPERATOR, "==");
|
| + static final TokenType EQ_EQ = new TokenType.con2('EQ_EQ', 27, TokenClass.EQUALITY_OPERATOR, "==");
|
|
|
| - static const TokenType FUNCTION = const TokenType.con2('FUNCTION', 28, TokenClass.NO_CLASS, "=>");
|
| + static final TokenType FUNCTION = new TokenType.con2('FUNCTION', 28, null, "=>");
|
|
|
| - static const TokenType GT = const TokenType.con2('GT', 29, TokenClass.RELATIONAL_OPERATOR, ">");
|
| + static final TokenType GT = new TokenType.con2('GT', 29, TokenClass.RELATIONAL_OPERATOR, ">");
|
|
|
| - static const TokenType GT_EQ = const TokenType.con2('GT_EQ', 30, TokenClass.RELATIONAL_OPERATOR, ">=");
|
| + static final TokenType GT_EQ = new TokenType.con2('GT_EQ', 30, TokenClass.RELATIONAL_OPERATOR, ">=");
|
|
|
| - static const TokenType GT_GT = const TokenType.con2('GT_GT', 31, TokenClass.SHIFT_OPERATOR, ">>");
|
| + static final TokenType GT_GT = new TokenType.con2('GT_GT', 31, TokenClass.SHIFT_OPERATOR, ">>");
|
|
|
| - static const TokenType GT_GT_EQ = const TokenType.con2('GT_GT_EQ', 32, TokenClass.ASSIGNMENT_OPERATOR, ">>=");
|
| + static final TokenType GT_GT_EQ = new TokenType.con2('GT_GT_EQ', 32, TokenClass.ASSIGNMENT_OPERATOR, ">>=");
|
|
|
| - static const TokenType HASH = const TokenType.con2('HASH', 33, TokenClass.NO_CLASS, "#");
|
| + static final TokenType HASH = new TokenType.con2('HASH', 33, null, "#");
|
|
|
| - static const TokenType INDEX = const TokenType.con2('INDEX', 34, TokenClass.UNARY_POSTFIX_OPERATOR, "[]");
|
| + static final TokenType INDEX = new TokenType.con2('INDEX', 34, TokenClass.UNARY_POSTFIX_OPERATOR, "[]");
|
|
|
| - static const TokenType INDEX_EQ = const TokenType.con2('INDEX_EQ', 35, TokenClass.UNARY_POSTFIX_OPERATOR, "[]=");
|
| + static final TokenType INDEX_EQ = new TokenType.con2('INDEX_EQ', 35, TokenClass.UNARY_POSTFIX_OPERATOR, "[]=");
|
|
|
| - static const TokenType IS = const TokenType.con2('IS', 36, TokenClass.RELATIONAL_OPERATOR, "is");
|
| + static final TokenType IS = new TokenType.con2('IS', 36, TokenClass.RELATIONAL_OPERATOR, "is");
|
|
|
| - static const TokenType LT = const TokenType.con2('LT', 37, TokenClass.RELATIONAL_OPERATOR, "<");
|
| + static final TokenType LT = new TokenType.con2('LT', 37, TokenClass.RELATIONAL_OPERATOR, "<");
|
|
|
| - static const TokenType LT_EQ = const TokenType.con2('LT_EQ', 38, TokenClass.RELATIONAL_OPERATOR, "<=");
|
| + static final TokenType LT_EQ = new TokenType.con2('LT_EQ', 38, TokenClass.RELATIONAL_OPERATOR, "<=");
|
|
|
| - static const TokenType LT_LT = const TokenType.con2('LT_LT', 39, TokenClass.SHIFT_OPERATOR, "<<");
|
| + static final TokenType LT_LT = new TokenType.con2('LT_LT', 39, TokenClass.SHIFT_OPERATOR, "<<");
|
|
|
| - static const TokenType LT_LT_EQ = const TokenType.con2('LT_LT_EQ', 40, TokenClass.ASSIGNMENT_OPERATOR, "<<=");
|
| + static final TokenType LT_LT_EQ = new TokenType.con2('LT_LT_EQ', 40, TokenClass.ASSIGNMENT_OPERATOR, "<<=");
|
|
|
| - static const TokenType MINUS = const TokenType.con2('MINUS', 41, TokenClass.ADDITIVE_OPERATOR, "-");
|
| + static final TokenType MINUS = new TokenType.con2('MINUS', 41, TokenClass.ADDITIVE_OPERATOR, "-");
|
|
|
| - static const TokenType MINUS_EQ = const TokenType.con2('MINUS_EQ', 42, TokenClass.ASSIGNMENT_OPERATOR, "-=");
|
| + static final TokenType MINUS_EQ = new TokenType.con2('MINUS_EQ', 42, TokenClass.ASSIGNMENT_OPERATOR, "-=");
|
|
|
| - static const TokenType MINUS_MINUS = const TokenType.con2('MINUS_MINUS', 43, TokenClass.UNARY_PREFIX_OPERATOR, "--");
|
| + static final TokenType MINUS_MINUS = new TokenType.con2('MINUS_MINUS', 43, TokenClass.UNARY_PREFIX_OPERATOR, "--");
|
|
|
| - static const TokenType OPEN_CURLY_BRACKET = const TokenType.con2('OPEN_CURLY_BRACKET', 44, TokenClass.NO_CLASS, "{");
|
| + static final TokenType OPEN_CURLY_BRACKET = new TokenType.con2('OPEN_CURLY_BRACKET', 44, null, "{");
|
|
|
| - static const TokenType OPEN_PAREN = const TokenType.con2('OPEN_PAREN', 45, TokenClass.UNARY_POSTFIX_OPERATOR, "(");
|
| + static final TokenType OPEN_PAREN = new TokenType.con2('OPEN_PAREN', 45, TokenClass.UNARY_POSTFIX_OPERATOR, "(");
|
|
|
| - static const TokenType OPEN_SQUARE_BRACKET = const TokenType.con2('OPEN_SQUARE_BRACKET', 46, TokenClass.UNARY_POSTFIX_OPERATOR, "[");
|
| + static final TokenType OPEN_SQUARE_BRACKET = new TokenType.con2('OPEN_SQUARE_BRACKET', 46, TokenClass.UNARY_POSTFIX_OPERATOR, "[");
|
|
|
| - static const TokenType PERCENT = const TokenType.con2('PERCENT', 47, TokenClass.MULTIPLICATIVE_OPERATOR, "%");
|
| + static final TokenType PERCENT = new TokenType.con2('PERCENT', 47, TokenClass.MULTIPLICATIVE_OPERATOR, "%");
|
|
|
| - static const TokenType PERCENT_EQ = const TokenType.con2('PERCENT_EQ', 48, TokenClass.ASSIGNMENT_OPERATOR, "%=");
|
| + static final TokenType PERCENT_EQ = new TokenType.con2('PERCENT_EQ', 48, TokenClass.ASSIGNMENT_OPERATOR, "%=");
|
|
|
| - static const TokenType PERIOD = const TokenType.con2('PERIOD', 49, TokenClass.UNARY_POSTFIX_OPERATOR, ".");
|
| + static final TokenType PERIOD = new TokenType.con2('PERIOD', 49, TokenClass.UNARY_POSTFIX_OPERATOR, ".");
|
|
|
| - static const TokenType PERIOD_PERIOD = const TokenType.con2('PERIOD_PERIOD', 50, TokenClass.CASCADE_OPERATOR, "..");
|
| + static final TokenType PERIOD_PERIOD = new TokenType.con2('PERIOD_PERIOD', 50, TokenClass.CASCADE_OPERATOR, "..");
|
|
|
| - static const TokenType PLUS = const TokenType.con2('PLUS', 51, TokenClass.ADDITIVE_OPERATOR, "+");
|
| + static final TokenType PLUS = new TokenType.con2('PLUS', 51, TokenClass.ADDITIVE_OPERATOR, "+");
|
|
|
| - static const TokenType PLUS_EQ = const TokenType.con2('PLUS_EQ', 52, TokenClass.ASSIGNMENT_OPERATOR, "+=");
|
| + static final TokenType PLUS_EQ = new TokenType.con2('PLUS_EQ', 52, TokenClass.ASSIGNMENT_OPERATOR, "+=");
|
|
|
| - static const TokenType PLUS_PLUS = const TokenType.con2('PLUS_PLUS', 53, TokenClass.UNARY_PREFIX_OPERATOR, "++");
|
| + static final TokenType PLUS_PLUS = new TokenType.con2('PLUS_PLUS', 53, TokenClass.UNARY_PREFIX_OPERATOR, "++");
|
|
|
| - static const TokenType QUESTION = const TokenType.con2('QUESTION', 54, TokenClass.CONDITIONAL_OPERATOR, "?");
|
| + static final TokenType QUESTION = new TokenType.con2('QUESTION', 54, TokenClass.CONDITIONAL_OPERATOR, "?");
|
|
|
| - static const TokenType SEMICOLON = const TokenType.con2('SEMICOLON', 55, TokenClass.NO_CLASS, ";");
|
| + static final TokenType SEMICOLON = new TokenType.con2('SEMICOLON', 55, null, ";");
|
|
|
| - static const TokenType SLASH = const TokenType.con2('SLASH', 56, TokenClass.MULTIPLICATIVE_OPERATOR, "/");
|
| + static final TokenType SLASH = new TokenType.con2('SLASH', 56, TokenClass.MULTIPLICATIVE_OPERATOR, "/");
|
|
|
| - static const TokenType SLASH_EQ = const TokenType.con2('SLASH_EQ', 57, TokenClass.ASSIGNMENT_OPERATOR, "/=");
|
| + static final TokenType SLASH_EQ = new TokenType.con2('SLASH_EQ', 57, TokenClass.ASSIGNMENT_OPERATOR, "/=");
|
|
|
| - static const TokenType STAR = const TokenType.con2('STAR', 58, TokenClass.MULTIPLICATIVE_OPERATOR, "*");
|
| + static final TokenType STAR = new TokenType.con2('STAR', 58, TokenClass.MULTIPLICATIVE_OPERATOR, "*");
|
|
|
| - static const TokenType STAR_EQ = const TokenType.con2('STAR_EQ', 59, TokenClass.ASSIGNMENT_OPERATOR, "*=");
|
| + static final TokenType STAR_EQ = new TokenType.con2('STAR_EQ', 59, TokenClass.ASSIGNMENT_OPERATOR, "*=");
|
|
|
| - static const TokenType STRING_INTERPOLATION_EXPRESSION = const TokenType.con2('STRING_INTERPOLATION_EXPRESSION', 60, TokenClass.NO_CLASS, "\${");
|
| + static final TokenType STRING_INTERPOLATION_EXPRESSION = new TokenType.con2('STRING_INTERPOLATION_EXPRESSION', 60, null, "\${");
|
|
|
| - static const TokenType STRING_INTERPOLATION_IDENTIFIER = const TokenType.con2('STRING_INTERPOLATION_IDENTIFIER', 61, TokenClass.NO_CLASS, "\$");
|
| + static final TokenType STRING_INTERPOLATION_IDENTIFIER = new TokenType.con2('STRING_INTERPOLATION_IDENTIFIER', 61, null, "\$");
|
|
|
| - static const TokenType TILDE = const TokenType.con2('TILDE', 62, TokenClass.UNARY_PREFIX_OPERATOR, "~");
|
| + static final TokenType TILDE = new TokenType.con2('TILDE', 62, TokenClass.UNARY_PREFIX_OPERATOR, "~");
|
|
|
| - static const TokenType TILDE_SLASH = const TokenType.con2('TILDE_SLASH', 63, TokenClass.MULTIPLICATIVE_OPERATOR, "~/");
|
| + static final TokenType TILDE_SLASH = new TokenType.con2('TILDE_SLASH', 63, TokenClass.MULTIPLICATIVE_OPERATOR, "~/");
|
|
|
| - static const TokenType TILDE_SLASH_EQ = const TokenType.con2('TILDE_SLASH_EQ', 64, TokenClass.ASSIGNMENT_OPERATOR, "~/=");
|
| + static final TokenType TILDE_SLASH_EQ = new TokenType.con2('TILDE_SLASH_EQ', 64, TokenClass.ASSIGNMENT_OPERATOR, "~/=");
|
|
|
| - static const TokenType BACKPING = const TokenType.con2('BACKPING', 65, TokenClass.NO_CLASS, "`");
|
| + static final TokenType BACKPING = new TokenType.con2('BACKPING', 65, null, "`");
|
|
|
| - static const TokenType BACKSLASH = const TokenType.con2('BACKSLASH', 66, TokenClass.NO_CLASS, "\\");
|
| + static final TokenType BACKSLASH = new TokenType.con2('BACKSLASH', 66, null, "\\");
|
|
|
| - static const TokenType PERIOD_PERIOD_PERIOD = const TokenType.con2('PERIOD_PERIOD_PERIOD', 67, TokenClass.NO_CLASS, "...");
|
| + static final TokenType PERIOD_PERIOD_PERIOD = new TokenType.con2('PERIOD_PERIOD_PERIOD', 67, null, "...");
|
|
|
| - static const List<TokenType> values = const [
|
| + static final List<TokenType> values = [
|
| EOF,
|
| DOUBLE,
|
| HEXADECIMAL,
|
| @@ -2574,17 +2628,28 @@ class TokenType extends Enum<TokenType> {
|
| /**
|
| * The class of the token.
|
| */
|
| - final TokenClass _tokenClass;
|
| + TokenClass _tokenClass;
|
|
|
| /**
|
| * The lexeme that defines this type of token, or `null` if there is more than one possible
|
| * lexeme for this type of token.
|
| */
|
| - final String lexeme;
|
| + String _lexeme;
|
| +
|
| + TokenType.con1(String name, int ordinal) : this.con2(name, ordinal, TokenClass.NO_CLASS, null);
|
|
|
| - const TokenType.con1(String name, int ordinal) : this.con2(name, ordinal, TokenClass.NO_CLASS, null);
|
| + TokenType.con2(String name, int ordinal, TokenClass tokenClass, String lexeme) : super(name, ordinal) {
|
| + this._tokenClass = tokenClass == null ? TokenClass.NO_CLASS : tokenClass;
|
| + this._lexeme = lexeme;
|
| + }
|
|
|
| - const TokenType.con2(String name, int ordinal, this._tokenClass, this.lexeme) : super(name, ordinal);
|
| + /**
|
| + * Return the lexeme that defines this type of token, or `null` if there is more than one
|
| + * possible lexeme for this type of token.
|
| + *
|
| + * @return the lexeme that defines this type of token
|
| + */
|
| + String get lexeme => _lexeme;
|
|
|
| /**
|
| * Return the precedence of the token, or `0` if the token does not represent an operator.
|
| @@ -2633,7 +2698,7 @@ class TokenType extends Enum<TokenType> {
|
| *
|
| * @return `true` if this type of token represents an increment operator
|
| */
|
| - bool get isIncrementOperator => identical(lexeme, "++") || identical(lexeme, "--");
|
| + bool get isIncrementOperator => identical(_lexeme, "++") || identical(_lexeme, "--");
|
|
|
| /**
|
| * Return `true` if this type of token represents a multiplicative operator.
|
| @@ -2682,11 +2747,11 @@ class TokenType extends Enum<TokenType> {
|
| *
|
| * @return `true` if this token type represents an operator that can be defined by users
|
| */
|
| - bool get isUserDefinableOperator => identical(lexeme, "==") || identical(lexeme, "~") || identical(lexeme, "[]") || identical(lexeme, "[]=") || identical(lexeme, "*") || identical(lexeme, "/") || identical(lexeme, "%") || identical(lexeme, "~/") || identical(lexeme, "+") || identical(lexeme, "-") || identical(lexeme, "<<") || identical(lexeme, ">>") || identical(lexeme, ">=") || identical(lexeme, ">") || identical(lexeme, "<=") || identical(lexeme, "<") || identical(lexeme, "&") || identical(lexeme, "^") || identical(lexeme, "|");
|
| + bool get isUserDefinableOperator => identical(_lexeme, "==") || identical(_lexeme, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(_lexeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical(_lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identical(_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || identical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || identical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|");
|
| }
|
|
|
| class TokenType_EOF extends TokenType {
|
| - const TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.con2(name, ordinal, arg0, arg1);
|
| + TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.con2(name, ordinal, arg0, arg1);
|
|
|
| @override
|
| String toString() => "-eof-";
|
|
|