| 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 Comparable<ScannerErrorCode>, ErrorCode { | 138 class ScannerErrorCode implements Enum<ScannerErrorCode>, 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('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('ILLEGA
L_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('MISSING_DI
GIT', 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('MISSIN
G_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('MISSING_QU
OTE', 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('UNTERMINATED_MULTI_LINE_COMMENT', 5, "Unterminated multi-line comment"); |
| 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('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, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 StringTokenWithComment(TokenType type, String value, int offset, Token precedi
ngComment) : super(type, value, offset) { | 202 StringTokenWithComment(TokenType type, String value, int offset, Token precedi
ngComment) : super(type, value, offset) { |
| 203 this._precedingComment = precedingComment; | 203 this._precedingComment = precedingComment; |
| 204 } | 204 } |
| 205 Token get precedingComments => _precedingComment; | 205 Token get precedingComments => _precedingComment; |
| 206 } | 206 } |
| 207 /** | 207 /** |
| 208 * The enumeration `Keyword` defines the keywords in the Dart programming langua
ge. | 208 * The enumeration `Keyword` defines the keywords in the Dart programming langua
ge. |
| 209 * | 209 * |
| 210 * @coverage dart.engine.parser | 210 * @coverage dart.engine.parser |
| 211 */ | 211 */ |
| 212 class Keyword implements Comparable<Keyword> { | 212 class Keyword implements Enum<Keyword> { |
| 213 static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert"); | 213 static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert"); |
| 214 static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break"); | 214 static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break"); |
| 215 static final Keyword CASE = new Keyword.con1('CASE', 2, "case"); | 215 static final Keyword CASE = new Keyword.con1('CASE', 2, "case"); |
| 216 static final Keyword CATCH = new Keyword.con1('CATCH', 3, "catch"); | 216 static final Keyword CATCH = new Keyword.con1('CATCH', 3, "catch"); |
| 217 static final Keyword CLASS = new Keyword.con1('CLASS', 4, "class"); | 217 static final Keyword CLASS = new Keyword.con1('CLASS', 4, "class"); |
| 218 static final Keyword CONST = new Keyword.con1('CONST', 5, "const"); | 218 static final Keyword CONST = new Keyword.con1('CONST', 5, "const"); |
| 219 static final Keyword CONTINUE = new Keyword.con1('CONTINUE', 6, "continue"); | 219 static final Keyword CONTINUE = new Keyword.con1('CONTINUE', 6, "continue"); |
| 220 static final Keyword DEFAULT = new Keyword.con1('DEFAULT', 7, "default"); | 220 static final Keyword DEFAULT = new Keyword.con1('DEFAULT', 7, "default"); |
| 221 static final Keyword DO = new Keyword.con1('DO', 8, "do"); | 221 static final Keyword DO = new Keyword.con1('DO', 8, "do"); |
| 222 static final Keyword ELSE = new Keyword.con1('ELSE', 9, "else"); | 222 static final Keyword ELSE = new Keyword.con1('ELSE', 9, "else"); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 try { | 496 try { |
| 497 int next = advance(); | 497 int next = advance(); |
| 498 while (next != -1) { | 498 while (next != -1) { |
| 499 tokenCounter++; | 499 tokenCounter++; |
| 500 next = bigSwitch(next); | 500 next = bigSwitch(next); |
| 501 } | 501 } |
| 502 appendEofToken(); | 502 appendEofToken(); |
| 503 instrumentation.metric2("tokensCount", tokenCounter); | 503 instrumentation.metric2("tokensCount", tokenCounter); |
| 504 return firstToken(); | 504 return firstToken(); |
| 505 } finally { | 505 } finally { |
| 506 instrumentation.log(); | 506 instrumentation.log2(2); |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 | 509 |
| 510 /** | 510 /** |
| 511 * Advance the current position and return the character at the new current po
sition. | 511 * Advance the current position and return the character at the new current po
sition. |
| 512 * | 512 * |
| 513 * @return the character at the new current position | 513 * @return the character at the new current position |
| 514 */ | 514 */ |
| 515 int advance(); | 515 int advance(); |
| 516 | 516 |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 return advance(); | 1226 return advance(); |
| 1227 } else { | 1227 } else { |
| 1228 appendToken(TokenType.PLUS); | 1228 appendToken(TokenType.PLUS); |
| 1229 return next; | 1229 return next; |
| 1230 } | 1230 } |
| 1231 } | 1231 } |
| 1232 int tokenizeSingleLineComment(int next) { | 1232 int tokenizeSingleLineComment(int next) { |
| 1233 while (true) { | 1233 while (true) { |
| 1234 next = advance(); | 1234 next = advance(); |
| 1235 if (0xA == next || 0xD == next || -1 == next) { | 1235 if (0xA == next || 0xD == next || -1 == next) { |
| 1236 appendCommentToken(TokenType.SINGLE_LINE_COMMENT, getString(_tokenStart,
0)); | 1236 appendCommentToken(TokenType.SINGLE_LINE_COMMENT, getString(_tokenStart,
-1)); |
| 1237 return next; | 1237 return next; |
| 1238 } | 1238 } |
| 1239 } | 1239 } |
| 1240 } | 1240 } |
| 1241 int tokenizeSingleLineRawString(int next, int quoteChar, int start) { | 1241 int tokenizeSingleLineRawString(int next, int quoteChar, int start) { |
| 1242 next = advance(); | 1242 next = advance(); |
| 1243 while (next != -1) { | 1243 while (next != -1) { |
| 1244 if (next == quoteChar) { | 1244 if (next == quoteChar) { |
| 1245 appendStringToken(TokenType.STRING, getString(start, 0)); | 1245 appendStringToken(TokenType.STRING, getString(start, 0)); |
| 1246 return advance(); | 1246 return advance(); |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 */ | 1793 */ |
| 1794 void set endToken(Token token) { | 1794 void set endToken(Token token) { |
| 1795 this._endToken = token; | 1795 this._endToken = token; |
| 1796 } | 1796 } |
| 1797 } | 1797 } |
| 1798 /** | 1798 /** |
| 1799 * The enumeration `TokenClass` represents classes (or groups) of tokens with a
similar use. | 1799 * The enumeration `TokenClass` represents classes (or groups) of tokens with a
similar use. |
| 1800 * | 1800 * |
| 1801 * @coverage dart.engine.parser | 1801 * @coverage dart.engine.parser |
| 1802 */ | 1802 */ |
| 1803 class TokenClass implements Comparable<TokenClass> { | 1803 class TokenClass implements Enum<TokenClass> { |
| 1804 | 1804 |
| 1805 /** | 1805 /** |
| 1806 * A value used to indicate that the token type is not part of any specific cl
ass of token. | 1806 * A value used to indicate that the token type is not part of any specific cl
ass of token. |
| 1807 */ | 1807 */ |
| 1808 static final TokenClass NO_CLASS = new TokenClass.con1('NO_CLASS', 0); | 1808 static final TokenClass NO_CLASS = new TokenClass.con1('NO_CLASS', 0); |
| 1809 | 1809 |
| 1810 /** | 1810 /** |
| 1811 * A value used to indicate that the token type is an additive operator. | 1811 * A value used to indicate that the token type is an additive operator. |
| 1812 */ | 1812 */ |
| 1813 static final TokenClass ADDITIVE_OPERATOR = new TokenClass.con2('ADDITIVE_OPER
ATOR', 1, 12); | 1813 static final TokenClass ADDITIVE_OPERATOR = new TokenClass.con2('ADDITIVE_OPER
ATOR', 1, 12); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 this._precedingComment = precedingComment; | 1951 this._precedingComment = precedingComment; |
| 1952 } | 1952 } |
| 1953 Token get precedingComments => _precedingComment; | 1953 Token get precedingComments => _precedingComment; |
| 1954 } | 1954 } |
| 1955 /** | 1955 /** |
| 1956 * The enumeration `TokenType` defines the types of tokens that can be returned
by the | 1956 * The enumeration `TokenType` defines the types of tokens that can be returned
by the |
| 1957 * scanner. | 1957 * scanner. |
| 1958 * | 1958 * |
| 1959 * @coverage dart.engine.parser | 1959 * @coverage dart.engine.parser |
| 1960 */ | 1960 */ |
| 1961 class TokenType implements Comparable<TokenType> { | 1961 class TokenType implements Enum<TokenType> { |
| 1962 | 1962 |
| 1963 /** | 1963 /** |
| 1964 * The type of the token that marks the end of the input. | 1964 * The type of the token that marks the end of the input. |
| 1965 */ | 1965 */ |
| 1966 static final TokenType EOF = new TokenType_EOF('EOF', 0, null, ""); | 1966 static final TokenType EOF = new TokenType_EOF('EOF', 0, null, ""); |
| 1967 static final TokenType DOUBLE = new TokenType.con1('DOUBLE', 1); | 1967 static final TokenType DOUBLE = new TokenType.con1('DOUBLE', 1); |
| 1968 static final TokenType HEXADECIMAL = new TokenType.con1('HEXADECIMAL', 2); | 1968 static final TokenType HEXADECIMAL = new TokenType.con1('HEXADECIMAL', 2); |
| 1969 static final TokenType IDENTIFIER = new TokenType.con1('IDENTIFIER', 3); | 1969 static final TokenType IDENTIFIER = new TokenType.con1('IDENTIFIER', 3); |
| 1970 static final TokenType INT = new TokenType.con1('INT', 4); | 1970 static final TokenType INT = new TokenType.con1('INT', 4); |
| 1971 static final TokenType KEYWORD = new TokenType.con1('KEYWORD', 5); | 1971 static final TokenType KEYWORD = new TokenType.con1('KEYWORD', 5); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2229 */ | 2229 */ |
| 2230 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, "|"); | 2230 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, "|"); |
| 2231 int compareTo(TokenType other) => ordinal - other.ordinal; | 2231 int compareTo(TokenType other) => ordinal - other.ordinal; |
| 2232 int get hashCode => ordinal; | 2232 int get hashCode => ordinal; |
| 2233 String toString() => name; | 2233 String toString() => name; |
| 2234 } | 2234 } |
| 2235 class TokenType_EOF extends TokenType { | 2235 class TokenType_EOF extends TokenType { |
| 2236 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); | 2236 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.
con2(name, ordinal, arg0, arg1); |
| 2237 String toString() => "-eof-"; | 2237 String toString() => "-eof-"; |
| 2238 } | 2238 } |
| OLD | NEW |