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

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

Issue 27278004: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 */ 420 */
421 List<int> _lineStarts = new List<int>(); 421 List<int> _lineStarts = new List<int>();
422 422
423 /** 423 /**
424 * A list, treated something like a stack, of tokens representing the beginnin g of a matched pair. 424 * A list, treated something like a stack, of tokens representing the beginnin g of a matched pair.
425 * It is used to pair the end tokens with the begin tokens. 425 * It is used to pair the end tokens with the begin tokens.
426 */ 426 */
427 List<BeginToken> _groupingStack = new List<BeginToken>(); 427 List<BeginToken> _groupingStack = new List<BeginToken>();
428 428
429 /** 429 /**
430 * The index of the last item in the [groupingStack], or `-1` if the stack is empty.
431 */
432 int _stackEnd = -1;
433
434 /**
430 * A flag indicating whether any unmatched groups were found during the parse. 435 * A flag indicating whether any unmatched groups were found during the parse.
431 */ 436 */
432 bool _hasUnmatchedGroups2 = false; 437 bool _hasUnmatchedGroups2 = false;
433 438
434 /** 439 /**
435 * Initialize a newly created scanner. 440 * Initialize a newly created scanner.
436 * 441 *
437 * @param source the source being scanned 442 * @param source the source being scanned
438 * @param errorListener the error listener that will be informed of any errors that are found 443 * @param errorListener the error listener that will be informed of any errors that are found
439 */ 444 */
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 BeginToken token; 533 BeginToken token;
529 if (_firstComment == null) { 534 if (_firstComment == null) {
530 token = new BeginToken(type, _tokenStart); 535 token = new BeginToken(type, _tokenStart);
531 } else { 536 } else {
532 token = new BeginTokenWithComment(type, _tokenStart, _firstComment); 537 token = new BeginTokenWithComment(type, _tokenStart, _firstComment);
533 _firstComment = null; 538 _firstComment = null;
534 _lastComment = null; 539 _lastComment = null;
535 } 540 }
536 _tail = _tail.setNext(token); 541 _tail = _tail.setNext(token);
537 _groupingStack.add(token); 542 _groupingStack.add(token);
543 _stackEnd++;
538 } 544 }
539 void appendCommentToken(TokenType type, String value) { 545 void appendCommentToken(TokenType type, String value) {
540 if (_firstComment == null) { 546 if (_firstComment == null) {
541 _firstComment = new StringToken(type, value, _tokenStart); 547 _firstComment = new StringToken(type, value, _tokenStart);
542 _lastComment = _firstComment; 548 _lastComment = _firstComment;
543 } else { 549 } else {
544 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta rt)); 550 _lastComment = _lastComment.setNext(new StringToken(type, value, _tokenSta rt));
545 } 551 }
546 } 552 }
547 void appendEndToken(TokenType type, TokenType beginType) { 553 void appendEndToken(TokenType type, TokenType beginType) {
548 Token token; 554 Token token;
549 if (_firstComment == null) { 555 if (_firstComment == null) {
550 token = new Token(type, _tokenStart); 556 token = new Token(type, _tokenStart);
551 } else { 557 } else {
552 token = new TokenWithComment(type, _tokenStart, _firstComment); 558 token = new TokenWithComment(type, _tokenStart, _firstComment);
553 _firstComment = null; 559 _firstComment = null;
554 _lastComment = null; 560 _lastComment = null;
555 } 561 }
556 _tail = _tail.setNext(token); 562 _tail = _tail.setNext(token);
557 int last = _groupingStack.length - 1; 563 if (_stackEnd >= 0) {
558 if (last >= 0) { 564 BeginToken begin = _groupingStack[_stackEnd];
559 BeginToken begin = _groupingStack[last];
560 if (identical(begin.type, beginType)) { 565 if (identical(begin.type, beginType)) {
561 begin.endToken = token; 566 begin.endToken = token;
562 _groupingStack.removeAt(last); 567 _groupingStack.removeAt(_stackEnd--);
563 } 568 }
564 } 569 }
565 } 570 }
566 void appendEofToken() { 571 void appendEofToken() {
567 Token eofToken; 572 Token eofToken;
568 if (_firstComment == null) { 573 if (_firstComment == null) {
569 eofToken = new Token(TokenType.EOF, offset + 1); 574 eofToken = new Token(TokenType.EOF, offset + 1);
570 } else { 575 } else {
571 eofToken = new TokenWithComment(TokenType.EOF, offset + 1, _firstComment); 576 eofToken = new TokenWithComment(TokenType.EOF, offset + 1, _firstComment);
572 _firstComment = null; 577 _firstComment = null;
573 _lastComment = null; 578 _lastComment = null;
574 } 579 }
575 eofToken.setNext(eofToken); 580 eofToken.setNext(eofToken);
576 _tail = _tail.setNext(eofToken); 581 _tail = _tail.setNext(eofToken);
577 if (!_groupingStack.isEmpty) { 582 if (_stackEnd >= 0) {
578 _hasUnmatchedGroups2 = true; 583 _hasUnmatchedGroups2 = true;
579 } 584 }
580 } 585 }
581 void appendKeywordToken(Keyword keyword) { 586 void appendKeywordToken(Keyword keyword) {
582 if (_firstComment == null) { 587 if (_firstComment == null) {
583 _tail = _tail.setNext(new KeywordToken(keyword, _tokenStart)); 588 _tail = _tail.setNext(new KeywordToken(keyword, _tokenStart));
584 } else { 589 } else {
585 _tail = _tail.setNext(new KeywordTokenWithComment(keyword, _tokenStart, _f irstComment)); 590 _tail = _tail.setNext(new KeywordTokenWithComment(keyword, _tokenStart, _f irstComment));
586 _firstComment = null; 591 _firstComment = null;
587 _lastComment = null; 592 _lastComment = null;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 } 773 }
769 774
770 /** 775 /**
771 * Return the beginning token corresponding to a closing brace that was found while scanning 776 * Return the beginning token corresponding to a closing brace that was found while scanning
772 * inside a string interpolation expression. Tokens that cannot be matched wit h the closing brace 777 * inside a string interpolation expression. Tokens that cannot be matched wit h the closing brace
773 * will be dropped from the stack. 778 * will be dropped from the stack.
774 * 779 *
775 * @return the token to be paired with the closing brace 780 * @return the token to be paired with the closing brace
776 */ 781 */
777 BeginToken findTokenMatchingClosingBraceInInterpolationExpression() { 782 BeginToken findTokenMatchingClosingBraceInInterpolationExpression() {
778 int last = _groupingStack.length - 1; 783 while (_stackEnd >= 0) {
779 while (last >= 0) { 784 BeginToken begin = _groupingStack[_stackEnd];
780 BeginToken begin = _groupingStack[last];
781 if (identical(begin.type, TokenType.OPEN_CURLY_BRACKET) || identical(begin .type, TokenType.STRING_INTERPOLATION_EXPRESSION)) { 785 if (identical(begin.type, TokenType.OPEN_CURLY_BRACKET) || identical(begin .type, TokenType.STRING_INTERPOLATION_EXPRESSION)) {
782 return begin; 786 return begin;
783 } 787 }
784 _hasUnmatchedGroups2 = true; 788 _hasUnmatchedGroups2 = true;
785 _groupingStack.removeAt(last); 789 _groupingStack.removeAt(_stackEnd--);
786 last--;
787 } 790 }
788 return null; 791 return null;
789 } 792 }
790 Token firstToken() => _tokens.next; 793 Token firstToken() => _tokens.next;
791 794
792 /** 795 /**
793 * Report an error at the current offset. 796 * Report an error at the current offset.
794 * 797 *
795 * @param errorCode the error code indicating the nature of the error 798 * @param errorCode the error code indicating the nature of the error
796 * @param arguments any arguments needed to complete the error message 799 * @param arguments any arguments needed to complete the error message
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 * Return `true` if this token type represents an operator that can be defined by users. 2137 * Return `true` if this token type represents an operator that can be defined by users.
2135 * 2138 *
2136 * @return `true` if this token type represents an operator that can be define d by users 2139 * @return `true` if this token type represents an operator that can be define d by users
2137 */ 2140 */
2138 bool get isUserDefinableOperator => identical(lexeme, "==") || identical(lexem e, "~") || identical(lexeme, "[]") || identical(lexeme, "[]=") || identical(lexe me, "*") || 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, "|"); 2141 bool get isUserDefinableOperator => identical(lexeme, "==") || identical(lexem e, "~") || identical(lexeme, "[]") || identical(lexeme, "[]=") || identical(lexe me, "*") || 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, "|");
2139 } 2142 }
2140 class TokenType_EOF extends TokenType { 2143 class TokenType_EOF extends TokenType {
2141 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super. con2(name, ordinal, arg0, arg1); 2144 TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super. con2(name, ordinal, arg0, arg1);
2142 String toString() => "-eof-"; 2145 String toString() => "-eof-";
2143 } 2146 }
OLDNEW
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/resolver.dart ('k') | pkg/analyzer_experimental/test/generated/ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698