Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/scanner.dart

Issue 14308011: New Analysis Engine snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 3
4 library engine.scanner; 4 library engine.scanner;
5 5
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'java_core.dart'; 7 import 'java_core.dart';
8 import 'java_engine.dart';
8 import 'source.dart'; 9 import 'source.dart';
9 import 'error.dart'; 10 import 'error.dart';
10 import 'instrumentation.dart'; 11 import 'instrumentation.dart';
11 12
12 /** 13 /**
13 * Instances of the abstract class {@code KeywordState} represent a state in a s tate machine used to 14 * Instances of the abstract class {@code KeywordState} represent a state in a s tate machine used to
14 * scan keywords. 15 * scan keywords.
15 * @coverage dart.engine.parser 16 * @coverage dart.engine.parser
16 */ 17 */
17 class KeywordState { 18 class KeywordState {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 * @param c the character used to transition from this state to another state 114 * @param c the character used to transition from this state to another state
114 * @return the state that follows this state on a transition of the given char acter 115 * @return the state that follows this state on a transition of the given char acter
115 */ 116 */
116 KeywordState next(int c) => _table[c - 0x61]; 117 KeywordState next(int c) => _table[c - 0x61];
117 } 118 }
118 /** 119 /**
119 * The enumeration {@code ScannerErrorCode} defines the error codes used for err ors detected by the 120 * The enumeration {@code ScannerErrorCode} defines the error codes used for err ors detected by the
120 * scanner. 121 * scanner.
121 * @coverage dart.engine.parser 122 * @coverage dart.engine.parser
122 */ 123 */
123 class ScannerErrorCode implements ErrorCode { 124 class ScannerErrorCode implements Comparable<ScannerErrorCode>, ErrorCode {
124 static final ScannerErrorCode ILLEGAL_CHARACTER = new ScannerErrorCode('ILLEGA L_CHARACTER', 0, "Illegal character %x"); 125 static final ScannerErrorCode ILLEGAL_CHARACTER = new ScannerErrorCode('ILLEGA L_CHARACTER', 0, "Illegal character %x");
125 static final ScannerErrorCode MISSING_DIGIT = new ScannerErrorCode('MISSING_DI GIT', 1, "Decimal digit expected"); 126 static final ScannerErrorCode MISSING_DIGIT = new ScannerErrorCode('MISSING_DI GIT', 1, "Decimal digit expected");
126 static final ScannerErrorCode MISSING_HEX_DIGIT = new ScannerErrorCode('MISSIN G_HEX_DIGIT', 2, "Hexidecimal digit expected"); 127 static final ScannerErrorCode MISSING_HEX_DIGIT = new ScannerErrorCode('MISSIN G_HEX_DIGIT', 2, "Hexidecimal digit expected");
127 static final ScannerErrorCode MISSING_QUOTE = new ScannerErrorCode('MISSING_QU OTE', 3, "Expected quote (' or \")"); 128 static final ScannerErrorCode MISSING_QUOTE = new ScannerErrorCode('MISSING_QU OTE', 3, "Expected quote (' or \")");
128 static final ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = new ScannerErr orCode('UNTERMINATED_MULTI_LINE_COMMENT', 4, "Unterminated multi-line comment"); 129 static final ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = new ScannerErr orCode('UNTERMINATED_MULTI_LINE_COMMENT', 4, "Unterminated multi-line comment");
129 static final ScannerErrorCode UNTERMINATED_STRING_LITERAL = new ScannerErrorCo de('UNTERMINATED_STRING_LITERAL', 5, "Unterminated string literal"); 130 static final ScannerErrorCode UNTERMINATED_STRING_LITERAL = new ScannerErrorCo de('UNTERMINATED_STRING_LITERAL', 5, "Unterminated string literal");
130 static final List<ScannerErrorCode> values = [ILLEGAL_CHARACTER, MISSING_DIGIT , MISSING_HEX_DIGIT, MISSING_QUOTE, UNTERMINATED_MULTI_LINE_COMMENT, UNTERMINATE D_STRING_LITERAL]; 131 static final List<ScannerErrorCode> values = [ILLEGAL_CHARACTER, MISSING_DIGIT , MISSING_HEX_DIGIT, MISSING_QUOTE, UNTERMINATED_MULTI_LINE_COMMENT, UNTERMINATE D_STRING_LITERAL];
131 final String __name; 132 final String __name;
132 final int __ordinal; 133 final int __ordinal;
133 int get ordinal => __ordinal; 134 int get ordinal => __ordinal;
134 /** 135 /**
135 * The message template used to create the message to be displayed for this er ror. 136 * The message template used to create the message to be displayed for this er ror.
136 */ 137 */
137 String _message; 138 String _message;
138 /** 139 /**
139 * Initialize a newly created error code to have the given message. 140 * Initialize a newly created error code to have the given message.
140 * @param message the message template used to create the message to be displa yed for this error 141 * @param message the message template used to create the message to be displa yed for this error
141 */ 142 */
142 ScannerErrorCode(this.__name, this.__ordinal, String message) { 143 ScannerErrorCode(this.__name, this.__ordinal, String message) {
143 this._message = message; 144 this._message = message;
144 } 145 }
145 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; 146 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
146 String get message => _message; 147 String get message => _message;
147 ErrorType get type => ErrorType.SYNTACTIC_ERROR; 148 ErrorType get type => ErrorType.SYNTACTIC_ERROR;
148 bool needsRecompilation() => true; 149 bool needsRecompilation() => true;
150 int compareTo(ScannerErrorCode other) => __ordinal - other.__ordinal;
149 String toString() => __name; 151 String toString() => __name;
150 } 152 }
151 /** 153 /**
152 * Instances of the class {@code TokenWithComment} represent a string token that is preceded by 154 * Instances of the class {@code TokenWithComment} represent a string token that is preceded by
153 * comments. 155 * comments.
154 * @coverage dart.engine.parser 156 * @coverage dart.engine.parser
155 */ 157 */
156 class StringTokenWithComment extends StringToken { 158 class StringTokenWithComment extends StringToken {
157 /** 159 /**
158 * The first comment in the list of comments that precede this token. 160 * The first comment in the list of comments that precede this token.
159 */ 161 */
160 Token _precedingComment; 162 Token _precedingComment;
161 /** 163 /**
162 * Initialize a newly created token to have the given type and offset and to b e preceded by the 164 * Initialize a newly created token to have the given type and offset and to b e preceded by the
163 * comments reachable from the given comment. 165 * comments reachable from the given comment.
164 * @param type the type of the token 166 * @param type the type of the token
165 * @param offset the offset from the beginning of the file to the first charac ter in the token 167 * @param offset the offset from the beginning of the file to the first charac ter in the token
166 * @param precedingComment the first comment in the list of comments that prec ede this token 168 * @param precedingComment the first comment in the list of comments that prec ede this token
167 */ 169 */
168 StringTokenWithComment(TokenType type, String value, int offset, Token precedi ngComment) : super(type, value, offset) { 170 StringTokenWithComment(TokenType type, String value, int offset, Token precedi ngComment) : super(type, value, offset) {
169 this._precedingComment = precedingComment; 171 this._precedingComment = precedingComment;
170 } 172 }
171 Token get precedingComments => _precedingComment; 173 Token get precedingComments => _precedingComment;
172 } 174 }
173 /** 175 /**
174 * The enumeration {@code Keyword} defines the keywords in the Dart programming language. 176 * The enumeration {@code Keyword} defines the keywords in the Dart programming language.
175 * @coverage dart.engine.parser 177 * @coverage dart.engine.parser
176 */ 178 */
177 class Keyword { 179 class Keyword implements Comparable<Keyword> {
178 static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert"); 180 static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert");
179 static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break"); 181 static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break");
180 static final Keyword CASE = new Keyword.con1('CASE', 2, "case"); 182 static final Keyword CASE = new Keyword.con1('CASE', 2, "case");
181 static final Keyword CATCH = new Keyword.con1('CATCH', 3, "catch"); 183 static final Keyword CATCH = new Keyword.con1('CATCH', 3, "catch");
182 static final Keyword CLASS = new Keyword.con1('CLASS', 4, "class"); 184 static final Keyword CLASS = new Keyword.con1('CLASS', 4, "class");
183 static final Keyword CONST = new Keyword.con1('CONST', 5, "const"); 185 static final Keyword CONST = new Keyword.con1('CONST', 5, "const");
184 static final Keyword CONTINUE = new Keyword.con1('CONTINUE', 6, "continue"); 186 static final Keyword CONTINUE = new Keyword.con1('CONTINUE', 6, "continue");
185 static final Keyword DEFAULT = new Keyword.con1('DEFAULT', 7, "default"); 187 static final Keyword DEFAULT = new Keyword.con1('DEFAULT', 7, "default");
186 static final Keyword DO = new Keyword.con1('DO', 8, "do"); 188 static final Keyword DO = new Keyword.con1('DO', 8, "do");
187 static final Keyword ELSE = new Keyword.con1('ELSE', 9, "else"); 189 static final Keyword ELSE = new Keyword.con1('ELSE', 9, "else");
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 result[keyword._syntax] = keyword; 252 result[keyword._syntax] = keyword;
251 } 253 }
252 return result; 254 return result;
253 } 255 }
254 /** 256 /**
255 * Initialize a newly created keyword to have the given syntax. The keyword is not a 257 * Initialize a newly created keyword to have the given syntax. The keyword is not a
256 * pseudo-keyword. 258 * pseudo-keyword.
257 * @param syntax the lexeme for the keyword 259 * @param syntax the lexeme for the keyword
258 */ 260 */
259 Keyword.con1(String ___name, int ___ordinal, String syntax) { 261 Keyword.con1(String ___name, int ___ordinal, String syntax) {
260 _jtd_constructor_282_impl(___name, ___ordinal, syntax); 262 _jtd_constructor_308_impl(___name, ___ordinal, syntax);
261 } 263 }
262 _jtd_constructor_282_impl(String ___name, int ___ordinal, String syntax) { 264 _jtd_constructor_308_impl(String ___name, int ___ordinal, String syntax) {
263 _jtd_constructor_283_impl(___name, ___ordinal, syntax, false); 265 _jtd_constructor_309_impl(___name, ___ordinal, syntax, false);
264 } 266 }
265 /** 267 /**
266 * Initialize a newly created keyword to have the given syntax. The keyword is a pseudo-keyword if 268 * Initialize a newly created keyword to have the given syntax. The keyword is a pseudo-keyword if
267 * the given flag is {@code true}. 269 * the given flag is {@code true}.
268 * @param syntax the lexeme for the keyword 270 * @param syntax the lexeme for the keyword
269 * @param isPseudoKeyword {@code true} if this keyword is a pseudo-keyword 271 * @param isPseudoKeyword {@code true} if this keyword is a pseudo-keyword
270 */ 272 */
271 Keyword.con2(String ___name, int ___ordinal, String syntax2, bool isPseudoKeyw ord) { 273 Keyword.con2(String ___name, int ___ordinal, String syntax2, bool isPseudoKeyw ord) {
272 _jtd_constructor_283_impl(___name, ___ordinal, syntax2, isPseudoKeyword); 274 _jtd_constructor_309_impl(___name, ___ordinal, syntax2, isPseudoKeyword);
273 } 275 }
274 _jtd_constructor_283_impl(String ___name, int ___ordinal, String syntax2, bool isPseudoKeyword) { 276 _jtd_constructor_309_impl(String ___name, int ___ordinal, String syntax2, bool isPseudoKeyword) {
275 __name = ___name; 277 __name = ___name;
276 __ordinal = ___ordinal; 278 __ordinal = ___ordinal;
277 this._syntax = syntax2; 279 this._syntax = syntax2;
278 this._isPseudoKeyword2 = isPseudoKeyword; 280 this._isPseudoKeyword2 = isPseudoKeyword;
279 } 281 }
280 /** 282 /**
281 * Return the lexeme for the keyword. 283 * Return the lexeme for the keyword.
282 * @return the lexeme for the keyword 284 * @return the lexeme for the keyword
283 */ 285 */
284 String get syntax => _syntax; 286 String get syntax => _syntax;
285 /** 287 /**
286 * Return {@code true} if this keyword is a pseudo-keyword. Pseudo keywords ca n be used as 288 * Return {@code true} if this keyword is a pseudo-keyword. Pseudo keywords ca n be used as
287 * identifiers. 289 * identifiers.
288 * @return {@code true} if this keyword is a pseudo-keyword 290 * @return {@code true} if this keyword is a pseudo-keyword
289 */ 291 */
290 bool isPseudoKeyword() => _isPseudoKeyword2; 292 bool isPseudoKeyword() => _isPseudoKeyword2;
293 int compareTo(Keyword other) => __ordinal - other.__ordinal;
291 String toString() => __name; 294 String toString() => __name;
292 } 295 }
293 /** 296 /**
294 * The abstract class {@code AbstractScanner} implements a scanner for Dart code . Subclasses are 297 * The abstract class {@code AbstractScanner} implements a scanner for Dart code . Subclasses are
295 * required to implement the interface used to access the characters being scann ed. 298 * required to implement the interface used to access the characters being scann ed.
296 * <p> 299 * <p>
297 * The lexical structure of Dart is ambiguous without knowledge of the context i n which a token is 300 * The lexical structure of Dart is ambiguous without knowledge of the context i n which a token is
298 * being scanned. For example, without context we cannot determine whether sourc e of the form "<<" 301 * being scanned. For example, without context we cannot determine whether sourc e of the form "<<"
299 * should be scanned as a single left-shift operator or as two left angle bracke ts. This scanner 302 * should be scanned as a single left-shift operator or as two left angle bracke ts. This scanner
300 * does not have any context, so it always resolves such conflicts by scanning t he longest possible 303 * does not have any context, so it always resolves such conflicts by scanning t he longest possible
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 /** 379 /**
377 * Return {@code true} if any unmatched groups were found during the parse. 380 * Return {@code true} if any unmatched groups were found during the parse.
378 * @return {@code true} if any unmatched groups were found during the parse 381 * @return {@code true} if any unmatched groups were found during the parse
379 */ 382 */
380 bool hasUnmatchedGroups() => _hasUnmatchedGroups2; 383 bool hasUnmatchedGroups() => _hasUnmatchedGroups2;
381 /** 384 /**
382 * Scan the source code to produce a list of tokens representing the source. 385 * Scan the source code to produce a list of tokens representing the source.
383 * @return the first token in the list of tokens that were produced 386 * @return the first token in the list of tokens that were produced
384 */ 387 */
385 Token tokenize() { 388 Token tokenize() {
386 int next = advance(); 389 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.AbstractScanner.tokenize");
387 while (next != -1) { 390 int tokenCounter = 0;
388 next = bigSwitch(next); 391 try {
392 int next = advance();
393 while (next != -1) {
394 tokenCounter++;
395 next = bigSwitch(next);
396 }
397 appendEofToken();
398 instrumentation.metric2("tokensCount", tokenCounter);
399 return firstToken();
400 } finally {
401 instrumentation.log();
389 } 402 }
390 appendEofToken();
391 return firstToken();
392 } 403 }
393 /** 404 /**
394 * Advance the current position and return the character at the new current po sition. 405 * Advance the current position and return the character at the new current po sition.
395 * @return the character at the new current position 406 * @return the character at the new current position
396 */ 407 */
397 int advance(); 408 int advance();
398 /** 409 /**
399 * Return the substring of the source code between the start offset and the mo dified current 410 * Return the substring of the source code between the start offset and the mo dified current
400 * position. The current position is modified by adding the end delta. 411 * position. The current position is modified by adding the end delta.
401 * @param start the offset to the beginning of the string, relative to the sta rt of the file 412 * @param start the offset to the beginning of the string, relative to the sta rt of the file
(...skipping 27 matching lines...) Expand all
429 _groupingStack.add(token); 440 _groupingStack.add(token);
430 } 441 }
431 void appendCommentToken(TokenType type, String value) { 442 void appendCommentToken(TokenType type, String value) {
432 if (_firstComment == null) { 443 if (_firstComment == null) {
433 _firstComment = new StringToken(type, value, _tokenStart); 444 _firstComment = new StringToken(type, value, _tokenStart);
434 _lastComment = _firstComment; 445 _lastComment = _firstComment;
435 } else { 446 } else {
436 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta rt)); 447 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta rt));
437 } 448 }
438 } 449 }
439 void appendEndToken(TokenType type33, TokenType beginType) { 450 void appendEndToken(TokenType type42, TokenType beginType) {
440 Token token; 451 Token token;
441 if (_firstComment == null) { 452 if (_firstComment == null) {
442 token = new Token(type33, _tokenStart); 453 token = new Token(type42, _tokenStart);
443 } else { 454 } else {
444 token = new TokenWithComment(type33, _tokenStart, _firstComment); 455 token = new TokenWithComment(type42, _tokenStart, _firstComment);
445 _firstComment = null; 456 _firstComment = null;
446 _lastComment = null; 457 _lastComment = null;
447 } 458 }
448 _tail = _tail.setNext(token); 459 _tail = _tail.setNext(token);
449 int last = _groupingStack.length - 1; 460 int last = _groupingStack.length - 1;
450 if (last >= 0) { 461 if (last >= 0) {
451 BeginToken begin = _groupingStack[last]; 462 BeginToken begin = _groupingStack[last];
452 if (identical(begin.type, beginType)) { 463 if (identical(begin.type, beginType)) {
453 begin.endToken = token; 464 begin.endToken = token;
454 _groupingStack.removeAt(last); 465 _groupingStack.removeAt(last);
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 } else { 989 } else {
979 next = advance(); 990 next = advance();
980 } 991 }
981 } 992 }
982 } else if (0x2F == next) { 993 } else if (0x2F == next) {
983 next = advance(); 994 next = advance();
984 if (0x2A == next) { 995 if (0x2A == next) {
985 next = advance(); 996 next = advance();
986 ++nesting; 997 ++nesting;
987 } 998 }
999 } else if (next == 0xD) {
1000 next = advance();
1001 if (next == 0xA) {
1002 next = advance();
1003 }
1004 recordStartOfLine();
1005 } else if (next == 0xA) {
1006 recordStartOfLine();
1007 next = advance();
988 } else { 1008 } else {
989 next = advance(); 1009 next = advance();
990 } 1010 }
991 } 1011 }
992 } 1012 }
993 int tokenizeMultiLineRawString(int quoteChar, int start) { 1013 int tokenizeMultiLineRawString(int quoteChar, int start) {
994 int next = advance(); 1014 int next = advance();
995 outer: while (next != -1) { 1015 outer: while (next != -1) {
996 while (next != quoteChar) { 1016 while (next != quoteChar) {
997 next = advance(); 1017 next = advance();
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 * The lexeme represented by this token. 1232 * The lexeme represented by this token.
1213 */ 1233 */
1214 String _value2; 1234 String _value2;
1215 /** 1235 /**
1216 * Initialize a newly created token to represent a token of the given type wit h the given value. 1236 * Initialize a newly created token to represent a token of the given type wit h the given value.
1217 * @param type the type of the token 1237 * @param type the type of the token
1218 * @param value the lexeme represented by this token 1238 * @param value the lexeme represented by this token
1219 * @param offset the offset from the beginning of the file to the first charac ter in the token 1239 * @param offset the offset from the beginning of the file to the first charac ter in the token
1220 */ 1240 */
1221 StringToken(TokenType type, String value, int offset) : super(type, offset) { 1241 StringToken(TokenType type, String value, int offset) : super(type, offset) {
1222 this._value2 = value; 1242 this._value2 = StringUtilities.intern(value);
1223 } 1243 }
1224 String get lexeme => _value2; 1244 String get lexeme => _value2;
1225 String value() => _value2; 1245 String value() => _value2;
1226 } 1246 }
1227 /** 1247 /**
1228 * Instances of the class {@code CharBufferScanner} implement a scanner that rea ds from a character 1248 * Instances of the class {@code CharBufferScanner} implement a scanner that rea ds from a character
1229 * buffer. The scanning logic is in the superclass. 1249 * buffer. The scanning logic is in the superclass.
1230 * @coverage dart.engine.parser 1250 * @coverage dart.engine.parser
1231 */ 1251 */
1232 class CharBufferScanner extends AbstractScanner { 1252 class CharBufferScanner extends AbstractScanner {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 * @param token the token that corresponds to this token 1594 * @param token the token that corresponds to this token
1575 */ 1595 */
1576 void set endToken(Token token) { 1596 void set endToken(Token token) {
1577 this._endToken = token; 1597 this._endToken = token;
1578 } 1598 }
1579 } 1599 }
1580 /** 1600 /**
1581 * The enumeration {@code TokenClass} represents classes (or groups) of tokens w ith a similar use. 1601 * The enumeration {@code TokenClass} represents classes (or groups) of tokens w ith a similar use.
1582 * @coverage dart.engine.parser 1602 * @coverage dart.engine.parser
1583 */ 1603 */
1584 class TokenClass { 1604 class TokenClass implements Comparable<TokenClass> {
1585 /** 1605 /**
1586 * A value used to indicate that the token type is not part of any specific cl ass of token. 1606 * A value used to indicate that the token type is not part of any specific cl ass of token.
1587 */ 1607 */
1588 static final TokenClass NO_CLASS = new TokenClass.con1('NO_CLASS', 0); 1608 static final TokenClass NO_CLASS = new TokenClass.con1('NO_CLASS', 0);
1589 /** 1609 /**
1590 * A value used to indicate that the token type is an additive operator. 1610 * A value used to indicate that the token type is an additive operator.
1591 */ 1611 */
1592 static final TokenClass ADDITIVE_OPERATOR = new TokenClass.con2('ADDITIVE_OPER ATOR', 1, 12); 1612 static final TokenClass ADDITIVE_OPERATOR = new TokenClass.con2('ADDITIVE_OPER ATOR', 1, 12);
1593 /** 1613 /**
1594 * A value used to indicate that the token type is an assignment operator. 1614 * A value used to indicate that the token type is an assignment operator.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 static final List<TokenClass> values = [NO_CLASS, ADDITIVE_OPERATOR, ASSIGNMEN T_OPERATOR, BITWISE_AND_OPERATOR, BITWISE_OR_OPERATOR, BITWISE_XOR_OPERATOR, CAS CADE_OPERATOR, CONDITIONAL_OPERATOR, EQUALITY_OPERATOR, LOGICAL_AND_OPERATOR, LO GICAL_OR_OPERATOR, MULTIPLICATIVE_OPERATOR, RELATIONAL_OPERATOR, SHIFT_OPERATOR, UNARY_POSTFIX_OPERATOR, UNARY_PREFIX_OPERATOR]; 1669 static final List<TokenClass> values = [NO_CLASS, ADDITIVE_OPERATOR, ASSIGNMEN T_OPERATOR, BITWISE_AND_OPERATOR, BITWISE_OR_OPERATOR, BITWISE_XOR_OPERATOR, CAS CADE_OPERATOR, CONDITIONAL_OPERATOR, EQUALITY_OPERATOR, LOGICAL_AND_OPERATOR, LO GICAL_OR_OPERATOR, MULTIPLICATIVE_OPERATOR, RELATIONAL_OPERATOR, SHIFT_OPERATOR, UNARY_POSTFIX_OPERATOR, UNARY_PREFIX_OPERATOR];
1650 String __name; 1670 String __name;
1651 int __ordinal = 0; 1671 int __ordinal = 0;
1652 int get ordinal => __ordinal; 1672 int get ordinal => __ordinal;
1653 /** 1673 /**
1654 * The precedence of tokens of this class, or {@code 0} if the such tokens do not represent an 1674 * The precedence of tokens of this class, or {@code 0} if the such tokens do not represent an
1655 * operator. 1675 * operator.
1656 */ 1676 */
1657 int _precedence = 0; 1677 int _precedence = 0;
1658 TokenClass.con1(String ___name, int ___ordinal) { 1678 TokenClass.con1(String ___name, int ___ordinal) {
1659 _jtd_constructor_292_impl(___name, ___ordinal); 1679 _jtd_constructor_318_impl(___name, ___ordinal);
1660 } 1680 }
1661 _jtd_constructor_292_impl(String ___name, int ___ordinal) { 1681 _jtd_constructor_318_impl(String ___name, int ___ordinal) {
1662 _jtd_constructor_293_impl(___name, ___ordinal, 0); 1682 _jtd_constructor_319_impl(___name, ___ordinal, 0);
1663 } 1683 }
1664 TokenClass.con2(String ___name, int ___ordinal, int precedence2) { 1684 TokenClass.con2(String ___name, int ___ordinal, int precedence2) {
1665 _jtd_constructor_293_impl(___name, ___ordinal, precedence2); 1685 _jtd_constructor_319_impl(___name, ___ordinal, precedence2);
1666 } 1686 }
1667 _jtd_constructor_293_impl(String ___name, int ___ordinal, int precedence2) { 1687 _jtd_constructor_319_impl(String ___name, int ___ordinal, int precedence2) {
1668 __name = ___name; 1688 __name = ___name;
1669 __ordinal = ___ordinal; 1689 __ordinal = ___ordinal;
1670 this._precedence = precedence2; 1690 this._precedence = precedence2;
1671 } 1691 }
1672 /** 1692 /**
1673 * Return the precedence of tokens of this class, or {@code 0} if the such tok ens do not represent 1693 * Return the precedence of tokens of this class, or {@code 0} if the such tok ens do not represent
1674 * an operator. 1694 * an operator.
1675 * @return the precedence of tokens of this class 1695 * @return the precedence of tokens of this class
1676 */ 1696 */
1677 int get precedence => _precedence; 1697 int get precedence => _precedence;
1698 int compareTo(TokenClass other) => __ordinal - other.__ordinal;
1678 String toString() => __name; 1699 String toString() => __name;
1679 } 1700 }
1680 /** 1701 /**
1681 * Instances of the class {@code KeywordTokenWithComment} implement a keyword to ken that is preceded 1702 * Instances of the class {@code KeywordTokenWithComment} implement a keyword to ken that is preceded
1682 * by comments. 1703 * by comments.
1683 * @coverage dart.engine.parser 1704 * @coverage dart.engine.parser
1684 */ 1705 */
1685 class KeywordTokenWithComment extends KeywordToken { 1706 class KeywordTokenWithComment extends KeywordToken {
1686 /** 1707 /**
1687 * The first comment in the list of comments that precede this token. 1708 * The first comment in the list of comments that precede this token.
1688 */ 1709 */
1689 Token _precedingComment; 1710 Token _precedingComment;
1690 /** 1711 /**
1691 * Initialize a newly created token to to represent the given keyword and to b e preceded by the 1712 * Initialize a newly created token to to represent the given keyword and to b e preceded by the
1692 * comments reachable from the given comment. 1713 * comments reachable from the given comment.
1693 * @param keyword the keyword being represented by this token 1714 * @param keyword the keyword being represented by this token
1694 * @param offset the offset from the beginning of the file to the first charac ter in the token 1715 * @param offset the offset from the beginning of the file to the first charac ter in the token
1695 * @param precedingComment the first comment in the list of comments that prec ede this token 1716 * @param precedingComment the first comment in the list of comments that prec ede this token
1696 */ 1717 */
1697 KeywordTokenWithComment(Keyword keyword, int offset, Token precedingComment) : super(keyword, offset) { 1718 KeywordTokenWithComment(Keyword keyword, int offset, Token precedingComment) : super(keyword, offset) {
1698 this._precedingComment = precedingComment; 1719 this._precedingComment = precedingComment;
1699 } 1720 }
1700 Token get precedingComments => _precedingComment; 1721 Token get precedingComments => _precedingComment;
1701 } 1722 }
1702 /** 1723 /**
1703 * The enumeration {@code TokenType} defines the types of tokens that can be ret urned by the 1724 * The enumeration {@code TokenType} defines the types of tokens that can be ret urned by the
1704 * scanner. 1725 * scanner.
1705 * @coverage dart.engine.parser 1726 * @coverage dart.engine.parser
1706 */ 1727 */
1707 class TokenType { 1728 class TokenType implements Comparable<TokenType> {
1708 /** 1729 /**
1709 * The type of the token that marks the end of the input. 1730 * The type of the token that marks the end of the input.
1710 */ 1731 */
1711 static final TokenType EOF = new TokenType_EOF('EOF', 0, null, ""); 1732 static final TokenType EOF = new TokenType_EOF('EOF', 0, null, "");
1712 static final TokenType DOUBLE = new TokenType.con1('DOUBLE', 1); 1733 static final TokenType DOUBLE = new TokenType.con1('DOUBLE', 1);
1713 static final TokenType HEXADECIMAL = new TokenType.con1('HEXADECIMAL', 2); 1734 static final TokenType HEXADECIMAL = new TokenType.con1('HEXADECIMAL', 2);
1714 static final TokenType IDENTIFIER = new TokenType.con1('IDENTIFIER', 3); 1735 static final TokenType IDENTIFIER = new TokenType.con1('IDENTIFIER', 3);
1715 static final TokenType INT = new TokenType.con1('INT', 4); 1736 static final TokenType INT = new TokenType.con1('INT', 4);
1716 static final TokenType KEYWORD = new TokenType.con1('KEYWORD', 5); 1737 static final TokenType KEYWORD = new TokenType.con1('KEYWORD', 5);
1717 static final TokenType MULTI_LINE_COMMENT = new TokenType.con1('MULTI_LINE_COM MENT', 6); 1738 static final TokenType MULTI_LINE_COMMENT = new TokenType.con1('MULTI_LINE_COM MENT', 6);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 /** 1804 /**
1784 * The class of the token. 1805 * The class of the token.
1785 */ 1806 */
1786 TokenClass _tokenClass; 1807 TokenClass _tokenClass;
1787 /** 1808 /**
1788 * The lexeme that defines this type of token, or {@code null} if there is mor e than one possible 1809 * The lexeme that defines this type of token, or {@code null} if there is mor e than one possible
1789 * lexeme for this type of token. 1810 * lexeme for this type of token.
1790 */ 1811 */
1791 String _lexeme; 1812 String _lexeme;
1792 TokenType.con1(String ___name, int ___ordinal) { 1813 TokenType.con1(String ___name, int ___ordinal) {
1793 _jtd_constructor_294_impl(___name, ___ordinal); 1814 _jtd_constructor_320_impl(___name, ___ordinal);
1794 } 1815 }
1795 _jtd_constructor_294_impl(String ___name, int ___ordinal) { 1816 _jtd_constructor_320_impl(String ___name, int ___ordinal) {
1796 _jtd_constructor_295_impl(___name, ___ordinal, TokenClass.NO_CLASS, null); 1817 _jtd_constructor_321_impl(___name, ___ordinal, TokenClass.NO_CLASS, null);
1797 } 1818 }
1798 TokenType.con2(String ___name, int ___ordinal, TokenClass tokenClass2, String lexeme2) { 1819 TokenType.con2(String ___name, int ___ordinal, TokenClass tokenClass2, String lexeme2) {
1799 _jtd_constructor_295_impl(___name, ___ordinal, tokenClass2, lexeme2); 1820 _jtd_constructor_321_impl(___name, ___ordinal, tokenClass2, lexeme2);
1800 } 1821 }
1801 _jtd_constructor_295_impl(String ___name, int ___ordinal, TokenClass tokenClas s2, String lexeme2) { 1822 _jtd_constructor_321_impl(String ___name, int ___ordinal, TokenClass tokenClas s2, String lexeme2) {
1802 __name = ___name; 1823 __name = ___name;
1803 __ordinal = ___ordinal; 1824 __ordinal = ___ordinal;
1804 this._tokenClass = tokenClass2 == null ? TokenClass.NO_CLASS : tokenClass2; 1825 this._tokenClass = tokenClass2 == null ? TokenClass.NO_CLASS : tokenClass2;
1805 this._lexeme = lexeme2; 1826 this._lexeme = lexeme2;
1806 } 1827 }
1807 /** 1828 /**
1808 * Return the lexeme that defines this type of token, or {@code null} if there is more than one 1829 * Return the lexeme that defines this type of token, or {@code null} if there is more than one
1809 * possible lexeme for this type of token. 1830 * possible lexeme for this type of token.
1810 * @return the lexeme that defines this type of token 1831 * @return the lexeme that defines this type of token
1811 */ 1832 */
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 /** 1895 /**
1875 * Return {@code true} if this type of token represents a unary prefix operato r. 1896 * Return {@code true} if this type of token represents a unary prefix operato r.
1876 * @return {@code true} if this type of token represents a unary prefix operat or 1897 * @return {@code true} if this type of token represents a unary prefix operat or
1877 */ 1898 */
1878 bool isUnaryPrefixOperator() => identical(_tokenClass, TokenClass.UNARY_PREFIX _OPERATOR); 1899 bool isUnaryPrefixOperator() => identical(_tokenClass, TokenClass.UNARY_PREFIX _OPERATOR);
1879 /** 1900 /**
1880 * Return {@code true} if this token type represents an operator that can be d efined by users. 1901 * Return {@code true} if this token type represents an operator that can be d efined by users.
1881 * @return {@code true} if this token type represents an operator that can be defined by users 1902 * @return {@code true} if this token type represents an operator that can be defined by users
1882 */ 1903 */
1883 bool isUserDefinableOperator() => identical(_lexeme, "==") || identical(_lexem e, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(_l exeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical(_ lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identical (_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || ident ical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || ide ntical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|"); 1904 bool isUserDefinableOperator() => identical(_lexeme, "==") || identical(_lexem e, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(_l exeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical(_ lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identical (_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || ident ical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || ide ntical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|");
1905 int compareTo(TokenType other) => __ordinal - other.__ordinal;
1884 String toString() => __name; 1906 String toString() => __name;
1885 } 1907 }
1886 class TokenType_EOF extends TokenType { 1908 class TokenType_EOF extends TokenType {
1887 TokenType_EOF(String ___name, int ___ordinal, TokenClass arg0, String arg1) : super.con2(___name, ___ordinal, arg0, arg1); 1909 TokenType_EOF(String ___name, int ___ordinal, TokenClass arg0, String arg1) : super.con2(___name, ___ordinal, arg0, arg1);
1888 String toString() => "-eof-"; 1910 String toString() => "-eof-";
1889 } 1911 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/resolver.dart ('k') | pkg/analyzer_experimental/lib/src/generated/sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698