| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.scanner; | 3 library engine.scanner; |
| 4 import 'dart:collection'; | 4 import 'dart:collection'; |
| 5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 6 import 'java_engine.dart'; | 6 import 'java_engine.dart'; |
| 7 import 'source.dart'; | 7 import 'source.dart'; |
| 8 import 'error.dart'; | 8 import 'error.dart'; |
| 9 import 'instrumentation.dart'; | 9 import 'instrumentation.dart'; |
| 10 /** | 10 /** |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 * @return the state that follows this state on a transition of the given char
acter | 128 * @return the state that follows this state on a transition of the given char
acter |
| 129 */ | 129 */ |
| 130 KeywordState next(int c) => _table[c - 0x61]; | 130 KeywordState next(int c) => _table[c - 0x61]; |
| 131 } | 131 } |
| 132 /** | 132 /** |
| 133 * The enumeration `ScannerErrorCode` defines the error codes used for errors de
tected by the | 133 * The enumeration `ScannerErrorCode` defines the error codes used for errors de
tected by the |
| 134 * scanner. | 134 * scanner. |
| 135 * | 135 * |
| 136 * @coverage dart.engine.parser | 136 * @coverage dart.engine.parser |
| 137 */ | 137 */ |
| 138 class ScannerErrorCode implements Enum<ScannerErrorCode>, ErrorCode { | 138 class ScannerErrorCode extends Enum<ScannerErrorCode> implements ErrorCode { |
| 139 static final ScannerErrorCode CHARACTER_EXPECTED_AFTER_SLASH = new ScannerErro
rCode('CHARACTER_EXPECTED_AFTER_SLASH', 0, "Character expected after slash"); | 139 static final ScannerErrorCode CHARACTER_EXPECTED_AFTER_SLASH = new ScannerErro
rCode.con1('CHARACTER_EXPECTED_AFTER_SLASH', 0, "Character expected after slash"
); |
| 140 static final ScannerErrorCode ILLEGAL_CHARACTER = new ScannerErrorCode('ILLEGA
L_CHARACTER', 1, "Illegal character %x"); | 140 static final ScannerErrorCode ILLEGAL_CHARACTER = new ScannerErrorCode.con1('I
LLEGAL_CHARACTER', 1, "Illegal character %x"); |
| 141 static final ScannerErrorCode MISSING_DIGIT = new ScannerErrorCode('MISSING_DI
GIT', 2, "Decimal digit expected"); | 141 static final ScannerErrorCode MISSING_DIGIT = new ScannerErrorCode.con1('MISSI
NG_DIGIT', 2, "Decimal digit expected"); |
| 142 static final ScannerErrorCode MISSING_HEX_DIGIT = new ScannerErrorCode('MISSIN
G_HEX_DIGIT', 3, "Hexidecimal digit expected"); | 142 static final ScannerErrorCode MISSING_HEX_DIGIT = new ScannerErrorCode.con1('M
ISSING_HEX_DIGIT', 3, "Hexidecimal digit expected"); |
| 143 static final ScannerErrorCode MISSING_QUOTE = new ScannerErrorCode('MISSING_QU
OTE', 4, "Expected quote (' or \")"); | 143 static final ScannerErrorCode MISSING_QUOTE = new ScannerErrorCode.con1('MISSI
NG_QUOTE', 4, "Expected quote (' or \")"); |
| 144 static final ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = new ScannerErr
orCode('UNTERMINATED_MULTI_LINE_COMMENT', 5, "Unterminated multi-line comment"); | 144 static final ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = new ScannerErr
orCode.con1('UNTERMINATED_MULTI_LINE_COMMENT', 5, "Unterminated multi-line comme
nt"); |
| 145 static final ScannerErrorCode UNTERMINATED_STRING_LITERAL = new ScannerErrorCo
de('UNTERMINATED_STRING_LITERAL', 6, "Unterminated string literal"); | 145 static final ScannerErrorCode UNTERMINATED_STRING_LITERAL = new ScannerErrorCo
de.con1('UNTERMINATED_STRING_LITERAL', 6, "Unterminated string literal"); |
| 146 static final List<ScannerErrorCode> values = [ | 146 static final List<ScannerErrorCode> values = [ |
| 147 CHARACTER_EXPECTED_AFTER_SLASH, | 147 CHARACTER_EXPECTED_AFTER_SLASH, |
| 148 ILLEGAL_CHARACTER, | 148 ILLEGAL_CHARACTER, |
| 149 MISSING_DIGIT, | 149 MISSING_DIGIT, |
| 150 MISSING_HEX_DIGIT, | 150 MISSING_HEX_DIGIT, |
| 151 MISSING_QUOTE, | 151 MISSING_QUOTE, |
| 152 UNTERMINATED_MULTI_LINE_COMMENT, | 152 UNTERMINATED_MULTI_LINE_COMMENT, |
| 153 UNTERMINATED_STRING_LITERAL]; | 153 UNTERMINATED_STRING_LITERAL]; |
| 154 | 154 |
| 155 /// The name of this enum constant, as declared in the enum declaration. | 155 /** |
| 156 final String name; | 156 * The template used to create the message to be displayed for this error. |
| 157 | 157 */ |
| 158 /// The position in the enum declaration. | 158 String _message; |
| 159 final int ordinal; | |
| 160 | 159 |
| 161 /** | 160 /** |
| 162 * The message template used to create the message to be displayed for this er
ror. | 161 * The template used to create the correction to be displayed for this error,
or `null` if |
| 162 * there is no correction information for this error. |
| 163 */ | 163 */ |
| 164 String _message; | 164 String correction10; |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * Initialize a newly created error code to have the given message. | 167 * Initialize a newly created error code to have the given message. |
| 168 * | 168 * |
| 169 * @param message the message template used to create the message to be displa
yed for this error | 169 * @param message the message template used to create the message to be displa
yed for this error |
| 170 */ | 170 */ |
| 171 ScannerErrorCode(this.name, this.ordinal, String message) { | 171 ScannerErrorCode.con1(String name, int ordinal, String message) : super(name,
ordinal) { |
| 172 this._message = message; | 172 this._message = message; |
| 173 } | 173 } |
| 174 |
| 175 /** |
| 176 * Initialize a newly created error code to have the given message and correct
ion. |
| 177 * |
| 178 * @param message the template used to create the message to be displayed for
the error |
| 179 * @param correction the template used to create the correction to be displaye
d for the error |
| 180 */ |
| 181 ScannerErrorCode.con2(String name, int ordinal, String message, String correct
ion) : super(name, ordinal) { |
| 182 this._message = message; |
| 183 this.correction10 = correction; |
| 184 } |
| 185 String get correction => correction10; |
| 174 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | 186 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; |
| 175 String get message => _message; | 187 String get message => _message; |
| 176 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | 188 ErrorType get type => ErrorType.SYNTACTIC_ERROR; |
| 177 int compareTo(ScannerErrorCode other) => ordinal - other.ordinal; | |
| 178 int get hashCode => ordinal; | |
| 179 String toString() => name; | |
| 180 } | 189 } |
| 181 /** | 190 /** |
| 182 * Instances of the class `TokenWithComment` represent a string token that is pr
eceded by | 191 * Instances of the class `TokenWithComment` represent a string token that is pr
eceded by |
| 183 * comments. | 192 * comments. |
| 184 * | 193 * |
| 185 * @coverage dart.engine.parser | 194 * @coverage dart.engine.parser |
| 186 */ | 195 */ |
| 187 class StringTokenWithComment extends StringToken { | 196 class StringTokenWithComment extends StringToken { |
| 188 | 197 |
| 189 /** | 198 /** |
| (...skipping 12 matching lines...) Expand all Loading... |
| 202 StringTokenWithComment(TokenType type, String value, int offset, Token precedi
ngComment) : super(type, value, offset) { | 211 StringTokenWithComment(TokenType type, String value, int offset, Token precedi
ngComment) : super(type, value, offset) { |
| 203 this._precedingComment = precedingComment; | 212 this._precedingComment = precedingComment; |
| 204 } | 213 } |
| 205 Token get precedingComments => _precedingComment; | 214 Token get precedingComments => _precedingComment; |
| 206 } | 215 } |
| 207 /** | 216 /** |
| 208 * The enumeration `Keyword` defines the keywords in the Dart programming langua
ge. | 217 * The enumeration `Keyword` defines the keywords in the Dart programming langua
ge. |
| 209 * | 218 * |
| 210 * @coverage dart.engine.parser | 219 * @coverage dart.engine.parser |
| 211 */ | 220 */ |
| 212 class Keyword implements Enum<Keyword> { | 221 class Keyword extends Enum<Keyword> { |
| 213 static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert"); | 222 static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert"); |
| 214 static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break"); | 223 static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break"); |
| 215 static final Keyword CASE = new Keyword.con1('CASE', 2, "case"); | 224 static final Keyword CASE = new Keyword.con1('CASE', 2, "case"); |
| 216 static final Keyword CATCH = new Keyword.con1('CATCH', 3, "catch"); | 225 static final Keyword CATCH = new Keyword.con1('CATCH', 3, "catch"); |
| 217 static final Keyword CLASS = new Keyword.con1('CLASS', 4, "class"); | 226 static final Keyword CLASS = new Keyword.con1('CLASS', 4, "class"); |
| 218 static final Keyword CONST = new Keyword.con1('CONST', 5, "const"); | 227 static final Keyword CONST = new Keyword.con1('CONST', 5, "const"); |
| 219 static final Keyword CONTINUE = new Keyword.con1('CONTINUE', 6, "continue"); | 228 static final Keyword CONTINUE = new Keyword.con1('CONTINUE', 6, "continue"); |
| 220 static final Keyword DEFAULT = new Keyword.con1('DEFAULT', 7, "default"); | 229 static final Keyword DEFAULT = new Keyword.con1('DEFAULT', 7, "default"); |
| 221 static final Keyword DO = new Keyword.con1('DO', 8, "do"); | 230 static final Keyword DO = new Keyword.con1('DO', 8, "do"); |
| 222 static final Keyword ELSE = new Keyword.con1('ELSE', 9, "else"); | 231 static final Keyword ELSE = new Keyword.con1('ELSE', 9, "else"); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 GET, | 310 GET, |
| 302 IMPLEMENTS, | 311 IMPLEMENTS, |
| 303 IMPORT, | 312 IMPORT, |
| 304 LIBRARY, | 313 LIBRARY, |
| 305 OPERATOR, | 314 OPERATOR, |
| 306 PART, | 315 PART, |
| 307 SET, | 316 SET, |
| 308 STATIC, | 317 STATIC, |
| 309 TYPEDEF]; | 318 TYPEDEF]; |
| 310 | 319 |
| 311 /// The name of this enum constant, as declared in the enum declaration. | |
| 312 final String name; | |
| 313 | |
| 314 /// The position in the enum declaration. | |
| 315 final int ordinal; | |
| 316 | |
| 317 /** | 320 /** |
| 318 * The lexeme for the keyword. | 321 * The lexeme for the keyword. |
| 319 */ | 322 */ |
| 320 String _syntax; | 323 String _syntax; |
| 321 | 324 |
| 322 /** | 325 /** |
| 323 * A flag indicating whether the keyword is a pseudo-keyword. Pseudo keywords
can be used as | 326 * A flag indicating whether the keyword is a pseudo-keyword. Pseudo keywords
can be used as |
| 324 * identifiers. | 327 * identifiers. |
| 325 */ | 328 */ |
| 326 bool _isPseudoKeyword2 = false; | 329 bool _isPseudoKeyword2 = false; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 351 */ | 354 */ |
| 352 Keyword.con1(String name, int ordinal, String syntax) : this.con2(name, ordina
l, syntax, false); | 355 Keyword.con1(String name, int ordinal, String syntax) : this.con2(name, ordina
l, syntax, false); |
| 353 | 356 |
| 354 /** | 357 /** |
| 355 * Initialize a newly created keyword to have the given syntax. The keyword is
a pseudo-keyword if | 358 * Initialize a newly created keyword to have the given syntax. The keyword is
a pseudo-keyword if |
| 356 * the given flag is `true`. | 359 * the given flag is `true`. |
| 357 * | 360 * |
| 358 * @param syntax the lexeme for the keyword | 361 * @param syntax the lexeme for the keyword |
| 359 * @param isPseudoKeyword `true` if this keyword is a pseudo-keyword | 362 * @param isPseudoKeyword `true` if this keyword is a pseudo-keyword |
| 360 */ | 363 */ |
| 361 Keyword.con2(this.name, this.ordinal, String syntax, bool isPseudoKeyword) { | 364 Keyword.con2(String name, int ordinal, String syntax, bool isPseudoKeyword) :
super(name, ordinal) { |
| 362 this._syntax = syntax; | 365 this._syntax = syntax; |
| 363 this._isPseudoKeyword2 = isPseudoKeyword; | 366 this._isPseudoKeyword2 = isPseudoKeyword; |
| 364 } | 367 } |
| 365 | 368 |
| 366 /** | 369 /** |
| 367 * Return the lexeme for the keyword. | 370 * Return the lexeme for the keyword. |
| 368 * | 371 * |
| 369 * @return the lexeme for the keyword | 372 * @return the lexeme for the keyword |
| 370 */ | 373 */ |
| 371 String get syntax => _syntax; | 374 String get syntax => _syntax; |
| 372 | 375 |
| 373 /** | 376 /** |
| 374 * Return `true` if this keyword is a pseudo-keyword. Pseudo keywords can be u
sed as | 377 * Return `true` if this keyword is a pseudo-keyword. Pseudo keywords can be u
sed as |
| 375 * identifiers. | 378 * identifiers. |
| 376 * | 379 * |
| 377 * @return `true` if this keyword is a pseudo-keyword | 380 * @return `true` if this keyword is a pseudo-keyword |
| 378 */ | 381 */ |
| 379 bool get isPseudoKeyword => _isPseudoKeyword2; | 382 bool get isPseudoKeyword => _isPseudoKeyword2; |
| 380 int compareTo(Keyword other) => ordinal - other.ordinal; | |
| 381 int get hashCode => ordinal; | |
| 382 String toString() => name; | |
| 383 } | 383 } |
| 384 /** | 384 /** |
| 385 * The abstract class `AbstractScanner` implements a scanner for Dart code. Subc
lasses are | 385 * The abstract class `AbstractScanner` implements a scanner for Dart code. Subc
lasses are |
| 386 * required to implement the interface used to access the characters being scann
ed. | 386 * required to implement the interface used to access the characters being scann
ed. |
| 387 * | 387 * |
| 388 * The lexical structure of Dart is ambiguous without knowledge of the context i
n which a token is | 388 * The lexical structure of Dart is ambiguous without knowledge of the context i
n which a token is |
| 389 * being scanned. For example, without context we cannot determine whether sourc
e of the form "<<" | 389 * being scanned. For example, without context we cannot determine whether sourc
e of the form "<<" |
| 390 * should be scanned as a single left-shift operator or as two left angle bracke
ts. This scanner | 390 * should be scanned as a single left-shift operator or as two left angle bracke
ts. This scanner |
| 391 * does not have any context, so it always resolves such conflicts by scanning t
he longest possible | 391 * does not have any context, so it always resolves such conflicts by scanning t
he longest possible |
| 392 * token. | 392 * token. |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 beginToken(); | 1039 beginToken(); |
| 1040 next = tokenizeKeywordOrIdentifier(next, false); | 1040 next = tokenizeKeywordOrIdentifier(next, false); |
| 1041 } | 1041 } |
| 1042 beginToken(); | 1042 beginToken(); |
| 1043 return next; | 1043 return next; |
| 1044 } | 1044 } |
| 1045 int tokenizeKeywordOrIdentifier(int next2, bool allowDollar) { | 1045 int tokenizeKeywordOrIdentifier(int next2, bool allowDollar) { |
| 1046 KeywordState state = KeywordState.KEYWORD_STATE; | 1046 KeywordState state = KeywordState.KEYWORD_STATE; |
| 1047 int start = offset; | 1047 int start = offset; |
| 1048 while (state != null && 0x61 <= next2 && next2 <= 0x7A) { | 1048 while (state != null && 0x61 <= next2 && next2 <= 0x7A) { |
| 1049 state = state.next((next2 as int)); | 1049 state = state.next(next2 as int); |
| 1050 next2 = advance(); | 1050 next2 = advance(); |
| 1051 } | 1051 } |
| 1052 if (state == null || state.keyword() == null) { | 1052 if (state == null || state.keyword() == null) { |
| 1053 return tokenizeIdentifier(next2, start, allowDollar); | 1053 return tokenizeIdentifier(next2, start, allowDollar); |
| 1054 } | 1054 } |
| 1055 if ((0x41 <= next2 && next2 <= 0x5A) || (0x30 <= next2 && next2 <= 0x39) ||
next2 == 0x5F || next2 == 0x24) { | 1055 if ((0x41 <= next2 && next2 <= 0x5A) || (0x30 <= next2 && next2 <= 0x39) ||
next2 == 0x5F || next2 == 0x24) { |
| 1056 return tokenizeIdentifier(next2, start, allowDollar); | 1056 return tokenizeIdentifier(next2, start, allowDollar); |
| 1057 } else if (next2 < 128) { | 1057 } else if (next2 < 128) { |
| 1058 appendKeywordToken(state.keyword()); | 1058 appendKeywordToken(state.keyword()); |
| 1059 return next2; | 1059 return next2; |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1796 */ | 1796 */ |
| 1797 void set endToken(Token token) { | 1797 void set endToken(Token token) { |
| 1798 this._endToken = token; | 1798 this._endToken = token; |
| 1799 } | 1799 } |
| 1800 } | 1800 } |
| 1801 /** | 1801 /** |
| 1802 * The enumeration `TokenClass` represents classes (or groups) of tokens with a
similar use. | 1802 * The enumeration `TokenClass` represents classes (or groups) of tokens with a
similar use. |
| 1803 * | 1803 * |
| 1804 * @coverage dart.engine.parser | 1804 * @coverage dart.engine.parser |
| 1805 */ | 1805 */ |
| 1806 class TokenClass implements Enum<TokenClass> { | 1806 class TokenClass extends Enum<TokenClass> { |
| 1807 | 1807 |
| 1808 /** | 1808 /** |
| 1809 * A value used to indicate that the token type is not part of any specific cl
ass of token. | 1809 * A value used to indicate that the token type is not part of any specific cl
ass of token. |
| 1810 */ | 1810 */ |
| 1811 static final TokenClass NO_CLASS = new TokenClass.con1('NO_CLASS', 0); | 1811 static final TokenClass NO_CLASS = new TokenClass.con1('NO_CLASS', 0); |
| 1812 | 1812 |
| 1813 /** | 1813 /** |
| 1814 * A value used to indicate that the token type is an additive operator. | 1814 * A value used to indicate that the token type is an additive operator. |
| 1815 */ | 1815 */ |
| 1816 static final TokenClass ADDITIVE_OPERATOR = new TokenClass.con2('ADDITIVE_OPER
ATOR', 1, 12); | 1816 static final TokenClass ADDITIVE_OPERATOR = new TokenClass.con2('ADDITIVE_OPER
ATOR', 1, 12); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 CONDITIONAL_OPERATOR, | 1895 CONDITIONAL_OPERATOR, |
| 1896 EQUALITY_OPERATOR, | 1896 EQUALITY_OPERATOR, |
| 1897 LOGICAL_AND_OPERATOR, | 1897 LOGICAL_AND_OPERATOR, |
| 1898 LOGICAL_OR_OPERATOR, | 1898 LOGICAL_OR_OPERATOR, |
| 1899 MULTIPLICATIVE_OPERATOR, | 1899 MULTIPLICATIVE_OPERATOR, |
| 1900 RELATIONAL_OPERATOR, | 1900 RELATIONAL_OPERATOR, |
| 1901 SHIFT_OPERATOR, | 1901 SHIFT_OPERATOR, |
| 1902 UNARY_POSTFIX_OPERATOR, | 1902 UNARY_POSTFIX_OPERATOR, |
| 1903 UNARY_PREFIX_OPERATOR]; | 1903 UNARY_PREFIX_OPERATOR]; |
| 1904 | 1904 |
| 1905 /// The name of this enum constant, as declared in the enum declaration. | |
| 1906 final String name; | |
| 1907 | |
| 1908 /// The position in the enum declaration. | |
| 1909 final int ordinal; | |
| 1910 | |
| 1911 /** | 1905 /** |
| 1912 * The precedence of tokens of this class, or `0` if the such tokens do not re
present an | 1906 * The precedence of tokens of this class, or `0` if the such tokens do not re
present an |
| 1913 * operator. | 1907 * operator. |
| 1914 */ | 1908 */ |
| 1915 int _precedence = 0; | 1909 int _precedence = 0; |
| 1916 TokenClass.con1(String name, int ordinal) : this.con2(name, ordinal, 0); | 1910 TokenClass.con1(String name, int ordinal) : this.con2(name, ordinal, 0); |
| 1917 TokenClass.con2(this.name, this.ordinal, int precedence) { | 1911 TokenClass.con2(String name, int ordinal, int precedence) : super(name, ordina
l) { |
| 1918 this._precedence = precedence; | 1912 this._precedence = precedence; |
| 1919 } | 1913 } |
| 1920 | 1914 |
| 1921 /** | 1915 /** |
| 1922 * Return the precedence of tokens of this class, or `0` if the such tokens do
not represent | 1916 * Return the precedence of tokens of this class, or `0` if the such tokens do
not represent |
| 1923 * an operator. | 1917 * an operator. |
| 1924 * | 1918 * |
| 1925 * @return the precedence of tokens of this class | 1919 * @return the precedence of tokens of this class |
| 1926 */ | 1920 */ |
| 1927 int get precedence => _precedence; | 1921 int get precedence => _precedence; |
| 1928 int compareTo(TokenClass other) => ordinal - other.ordinal; | |
| 1929 int get hashCode => ordinal; | |
| 1930 String toString() => name; | |
| 1931 } | 1922 } |
| 1932 /** | 1923 /** |
| 1933 * Instances of the class `KeywordTokenWithComment` implement a keyword token th
at is preceded | 1924 * Instances of the class `KeywordTokenWithComment` implement a keyword token th
at is preceded |
| 1934 * by comments. | 1925 * by comments. |
| 1935 * | 1926 * |
| 1936 * @coverage dart.engine.parser | 1927 * @coverage dart.engine.parser |
| 1937 */ | 1928 */ |
| 1938 class KeywordTokenWithComment extends KeywordToken { | 1929 class KeywordTokenWithComment extends KeywordToken { |
| 1939 | 1930 |
| 1940 /** | 1931 /** |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1954 this._precedingComment = precedingComment; | 1945 this._precedingComment = precedingComment; |
| 1955 } | 1946 } |
| 1956 Token get precedingComments => _precedingComment; | 1947 Token get precedingComments => _precedingComment; |
| 1957 } | 1948 } |
| 1958 /** | 1949 /** |
| 1959 * The enumeration `TokenType` defines the types of tokens that can be returned
by the | 1950 * The enumeration `TokenType` defines the types of tokens that can be returned
by the |
| 1960 * scanner. | 1951 * scanner. |
| 1961 * | 1952 * |
| 1962 * @coverage dart.engine.parser | 1953 * @coverage dart.engine.parser |
| 1963 */ | 1954 */ |
| 1964 class TokenType implements Enum<TokenType> { | 1955 class TokenType extends Enum<TokenType> { |
| 1965 | 1956 |
| 1966 /** | 1957 /** |
| 1967 * The type of the token that marks the end of the input. | 1958 * The type of the token that marks the end of the input. |
| 1968 */ | 1959 */ |
| 1969 static final TokenType EOF = new TokenType_EOF('EOF', 0, null, ""); | 1960 static final TokenType EOF = new TokenType_EOF('EOF', 0, null, ""); |
| 1970 static final TokenType DOUBLE = new TokenType.con1('DOUBLE', 1); | 1961 static final TokenType DOUBLE = new TokenType.con1('DOUBLE', 1); |
| 1971 static final TokenType HEXADECIMAL = new TokenType.con1('HEXADECIMAL', 2); | 1962 static final TokenType HEXADECIMAL = new TokenType.con1('HEXADECIMAL', 2); |
| 1972 static final TokenType IDENTIFIER = new TokenType.con1('IDENTIFIER', 3); | 1963 static final TokenType IDENTIFIER = new TokenType.con1('IDENTIFIER', 3); |
| 1973 static final TokenType INT = new TokenType.con1('INT', 4); | 1964 static final TokenType INT = new TokenType.con1('INT', 4); |
| 1974 static final TokenType KEYWORD = new TokenType.con1('KEYWORD', 5); | 1965 static final TokenType KEYWORD = new TokenType.con1('KEYWORD', 5); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2097 STAR_EQ, | 2088 STAR_EQ, |
| 2098 STRING_INTERPOLATION_EXPRESSION, | 2089 STRING_INTERPOLATION_EXPRESSION, |
| 2099 STRING_INTERPOLATION_IDENTIFIER, | 2090 STRING_INTERPOLATION_IDENTIFIER, |
| 2100 TILDE, | 2091 TILDE, |
| 2101 TILDE_SLASH, | 2092 TILDE_SLASH, |
| 2102 TILDE_SLASH_EQ, | 2093 TILDE_SLASH_EQ, |
| 2103 BACKPING, | 2094 BACKPING, |
| 2104 BACKSLASH, | 2095 BACKSLASH, |
| 2105 PERIOD_PERIOD_PERIOD]; | 2096 PERIOD_PERIOD_PERIOD]; |
| 2106 | 2097 |
| 2107 /// The name of this enum constant, as declared in the enum declaration. | |
| 2108 final String name; | |
| 2109 | |
| 2110 /// The position in the enum declaration. | |
| 2111 final int ordinal; | |
| 2112 | |
| 2113 /** | 2098 /** |
| 2114 * The class of the token. | 2099 * The class of the token. |
| 2115 */ | 2100 */ |
| 2116 TokenClass _tokenClass; | 2101 TokenClass _tokenClass; |
| 2117 | 2102 |
| 2118 /** | 2103 /** |
| 2119 * The lexeme that defines this type of token, or `null` if there is more than
one possible | 2104 * The lexeme that defines this type of token, or `null` if there is more than
one possible |
| 2120 * lexeme for this type of token. | 2105 * lexeme for this type of token. |
| 2121 */ | 2106 */ |
| 2122 String _lexeme; | 2107 String _lexeme; |
| 2123 TokenType.con1(String name, int ordinal) : this.con2(name, ordinal, TokenClass
.NO_CLASS, null); | 2108 TokenType.con1(String name, int ordinal) : this.con2(name, ordinal, TokenClass
.NO_CLASS, null); |
| 2124 TokenType.con2(this.name, this.ordinal, TokenClass tokenClass, String lexeme)
{ | 2109 TokenType.con2(String name, int ordinal, TokenClass tokenClass, String lexeme)
: super(name, ordinal) { |
| 2125 this._tokenClass = tokenClass == null ? TokenClass.NO_CLASS : tokenClass; | 2110 this._tokenClass = tokenClass == null ? TokenClass.NO_CLASS : tokenClass; |
| 2126 this._lexeme = lexeme; | 2111 this._lexeme = lexeme; |
| 2127 } | 2112 } |
| 2128 | 2113 |
| 2129 /** | 2114 /** |
| 2130 * Return the lexeme that defines this type of token, or `null` if there is mo
re than one | 2115 * Return the lexeme that defines this type of token, or `null` if there is mo
re than one |
| 2131 * possible lexeme for this type of token. | 2116 * possible lexeme for this type of token. |
| 2132 * | 2117 * |
| 2133 * @return the lexeme that defines this type of token | 2118 * @return the lexeme that defines this type of token |
| 2134 */ | 2119 */ |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2224 * @return `true` if this type of token represents a unary prefix operator | 2209 * @return `true` if this type of token represents a unary prefix operator |
| 2225 */ | 2210 */ |
| 2226 bool get isUnaryPrefixOperator => identical(_tokenClass, TokenClass.UNARY_PREF
IX_OPERATOR); | 2211 bool get isUnaryPrefixOperator => identical(_tokenClass, TokenClass.UNARY_PREF
IX_OPERATOR); |
| 2227 | 2212 |
| 2228 /** | 2213 /** |
| 2229 * Return `true` if this token type represents an operator that can be defined
by users. | 2214 * Return `true` if this token type represents an operator that can be defined
by users. |
| 2230 * | 2215 * |
| 2231 * @return `true` if this token type represents an operator that can be define
d by users | 2216 * @return `true` if this token type represents an operator that can be define
d by users |
| 2232 */ | 2217 */ |
| 2233 bool get isUserDefinableOperator => identical(_lexeme, "==") || identical(_lex
eme, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(
_lexeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical
(_lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identic
al(_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || ide
ntical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || i
dentical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|"); | 2218 bool get isUserDefinableOperator => identical(_lexeme, "==") || identical(_lex
eme, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(
_lexeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical
(_lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identic
al(_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || ide
ntical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || i
dentical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|"); |
| 2234 int compareTo(TokenType other) => ordinal - other.ordinal; | |
| 2235 int get hashCode => ordinal; | |
| 2236 String toString() => name; | |
| 2237 } | 2219 } |
| 2238 class TokenType_EOF extends TokenType { | 2220 class TokenType_EOF extends TokenType { |
| 2239 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); | 2221 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); |
| 2240 String toString() => "-eof-"; | 2222 String toString() => "-eof-"; |
| 2241 } | 2223 } |
| OLD | NEW |