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

Side by Side Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 730533003: Code clean-up and minor bug fix (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.parser; 8 library engine.parser;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 3407 matching lines...) Expand 10 before | Expand all | Expand 10 after
3418 return true; 3418 return true;
3419 } else if (startToken.next != token) { 3419 } else if (startToken.next != token) {
3420 // The type is more than a simple identifier, so it should be assumed to 3420 // The type is more than a simple identifier, so it should be assumed to
3421 // be a type name. 3421 // be a type name.
3422 return true; 3422 return true;
3423 } 3423 }
3424 return false; 3424 return false;
3425 } 3425 }
3426 3426
3427 /** 3427 /**
3428 * Compare the given tokens to find the token that appears first in the source being parsed. That
3429 * is, return the left-most of all of the tokens. The arguments are allowed to be `null`.
3430 * Return the token with the smallest offset, or `null` if there are no argume nts or if all
3431 * of the arguments are `null`.
3432 *
3433 * @param tokens the tokens being compared
3434 * @return the token with the smallest offset
3435 */
3436 Token _lexicallyFirst(List<Token> tokens) {
3437 Token first = null;
3438 int firstOffset = 2147483647;
3439 for (Token token in tokens) {
3440 if (token != null) {
3441 int offset = token.offset;
3442 if (offset < firstOffset) {
3443 first = token;
3444 firstOffset = offset;
3445 }
3446 }
3447 }
3448 return first;
3449 }
3450
3451 /**
3452 * Increments the error reporting lock level. If level is more than `0`, then 3428 * Increments the error reporting lock level. If level is more than `0`, then
3453 * [reportError] wont report any error. 3429 * [reportError] wont report any error.
3454 */ 3430 */
3455 void _lockErrorListener() { 3431 void _lockErrorListener() {
3456 _errorListenerLock++; 3432 _errorListenerLock++;
3457 } 3433 }
3458 3434
3459 /** 3435 /**
3460 * Return `true` if the current token has the given type. Note that the method 3436 * Return `true` if the current token has the given type. Note that the method
3461 * [_matchesGt] should be used if the argument to this method would be 3437 * [_matchesGt] should be used if the argument to this method would be
(...skipping 4217 matching lines...) Expand 10 before | Expand all | Expand 10 after
7679 } else if (finalKeyword != null) { 7655 } else if (finalKeyword != null) {
7680 if (varKeyword != null) { 7656 if (varKeyword != null) {
7681 _reportErrorForToken(ParserErrorCode.FINAL_AND_VAR, varKeyword); 7657 _reportErrorForToken(ParserErrorCode.FINAL_AND_VAR, varKeyword);
7682 } 7658 }
7683 if (staticKeyword != null && finalKeyword.offset < staticKeyword.offset) { 7659 if (staticKeyword != null && finalKeyword.offset < staticKeyword.offset) {
7684 _reportErrorForToken(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword); 7660 _reportErrorForToken(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword);
7685 } 7661 }
7686 } else if (varKeyword != null && staticKeyword != null && varKeyword.offset < staticKeyword.offset) { 7662 } else if (varKeyword != null && staticKeyword != null && varKeyword.offset < staticKeyword.offset) {
7687 _reportErrorForToken(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword); 7663 _reportErrorForToken(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword);
7688 } 7664 }
7689 return _lexicallyFirst([constKeyword, finalKeyword, varKeyword]); 7665 return Token.lexicallyFirst([constKeyword, finalKeyword, varKeyword]);
7690 } 7666 }
7691 7667
7692 /** 7668 /**
7693 * Validate that the given set of modifiers is appropriate for a local functio n. 7669 * Validate that the given set of modifiers is appropriate for a local functio n.
7694 * 7670 *
7695 * @param modifiers the modifiers being validated 7671 * @param modifiers the modifiers being validated
7696 */ 7672 */
7697 void _validateModifiersForFunctionDeclarationStatement(Modifiers modifiers) { 7673 void _validateModifiersForFunctionDeclarationStatement(Modifiers modifiers) {
7698 if (modifiers.abstractKeyword != null || modifiers.constKeyword != null || m odifiers.externalKeyword != null || modifiers.factoryKeyword != null || modifier s.finalKeyword != null || modifiers.staticKeyword != null || modifiers.varKeywor d != null) { 7674 if (modifiers.abstractKeyword != null || modifiers.constKeyword != null || m odifiers.externalKeyword != null || modifiers.factoryKeyword != null || modifier s.finalKeyword != null || modifiers.staticKeyword != null || modifiers.varKeywor d != null) {
7699 _reportErrorForCurrentToken(ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MOD IFIER); 7675 _reportErrorForCurrentToken(ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MOD IFIER);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
7812 _reportErrorForToken(ParserErrorCode.CONST_AND_FINAL, finalKeyword); 7788 _reportErrorForToken(ParserErrorCode.CONST_AND_FINAL, finalKeyword);
7813 } 7789 }
7814 if (varKeyword != null) { 7790 if (varKeyword != null) {
7815 _reportErrorForToken(ParserErrorCode.CONST_AND_VAR, varKeyword); 7791 _reportErrorForToken(ParserErrorCode.CONST_AND_VAR, varKeyword);
7816 } 7792 }
7817 } else if (finalKeyword != null) { 7793 } else if (finalKeyword != null) {
7818 if (varKeyword != null) { 7794 if (varKeyword != null) {
7819 _reportErrorForToken(ParserErrorCode.FINAL_AND_VAR, varKeyword); 7795 _reportErrorForToken(ParserErrorCode.FINAL_AND_VAR, varKeyword);
7820 } 7796 }
7821 } 7797 }
7822 return _lexicallyFirst([constKeyword, finalKeyword, varKeyword]); 7798 return Token.lexicallyFirst([constKeyword, finalKeyword, varKeyword]);
7823 } 7799 }
7824 7800
7825 /** 7801 /**
7826 * Validate that the given set of modifiers is appropriate for a class and ret urn the 'abstract' 7802 * Validate that the given set of modifiers is appropriate for a class and ret urn the 'abstract'
7827 * keyword if there is one. 7803 * keyword if there is one.
7828 * 7804 *
7829 * @param modifiers the modifiers being validated 7805 * @param modifiers the modifiers being validated
7830 */ 7806 */
7831 void _validateModifiersForTypedef(Modifiers modifiers) { 7807 void _validateModifiersForTypedef(Modifiers modifiers) {
7832 _validateModifiersForTopLevelDeclaration(modifiers); 7808 _validateModifiersForTopLevelDeclaration(modifiers);
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
9638 'getEndToken_1': new MethodTrampoline(1, (Parser target, arg0) => target._getE ndToken(arg0)), 9614 'getEndToken_1': new MethodTrampoline(1, (Parser target, arg0) => target._getE ndToken(arg0)),
9639 'injectToken_1': new MethodTrampoline(1, (Parser target, arg0) => target._inje ctToken(arg0)), 9615 'injectToken_1': new MethodTrampoline(1, (Parser target, arg0) => target._inje ctToken(arg0)),
9640 'isFunctionDeclaration_0': new MethodTrampoline(0, (Parser target) => target._ isFunctionDeclaration()), 9616 'isFunctionDeclaration_0': new MethodTrampoline(0, (Parser target) => target._ isFunctionDeclaration()),
9641 'isFunctionExpression_1': new MethodTrampoline(1, (Parser target, arg0) => tar get._isFunctionExpression(arg0)), 9617 'isFunctionExpression_1': new MethodTrampoline(1, (Parser target, arg0) => tar get._isFunctionExpression(arg0)),
9642 'isHexDigit_1': new MethodTrampoline(1, (Parser target, arg0) => target._isHex Digit(arg0)), 9618 'isHexDigit_1': new MethodTrampoline(1, (Parser target, arg0) => target._isHex Digit(arg0)),
9643 'isInitializedVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => target._isInitializedVariableDeclaration()), 9619 'isInitializedVariableDeclaration_0': new MethodTrampoline(0, (Parser target) => target._isInitializedVariableDeclaration()),
9644 'isLinkText_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target. _isLinkText(arg0, arg1)), 9620 'isLinkText_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target. _isLinkText(arg0, arg1)),
9645 'isOperator_1': new MethodTrampoline(1, (Parser target, arg0) => target._isOpe rator(arg0)), 9621 'isOperator_1': new MethodTrampoline(1, (Parser target, arg0) => target._isOpe rator(arg0)),
9646 'isSwitchMember_0': new MethodTrampoline(0, (Parser target) => target._isSwitc hMember()), 9622 'isSwitchMember_0': new MethodTrampoline(0, (Parser target) => target._isSwitc hMember()),
9647 'isTypedIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => target ._isTypedIdentifier(arg0)), 9623 'isTypedIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => target ._isTypedIdentifier(arg0)),
9648 'lexicallyFirst_1': new MethodTrampoline(1, (Parser target, arg0) => target._l exicallyFirst(arg0)),
9649 'lockErrorListener_0': new MethodTrampoline(0, (Parser target) => target._lock ErrorListener()), 9624 'lockErrorListener_0': new MethodTrampoline(0, (Parser target) => target._lock ErrorListener()),
9650 'matches_1': new MethodTrampoline(1, (Parser target, arg0) => target._matches( arg0)), 9625 'matches_1': new MethodTrampoline(1, (Parser target, arg0) => target._matches( arg0)),
9651 'matchesGt_0': new MethodTrampoline(0, (Parser target) => target._matchesGt()) , 9626 'matchesGt_0': new MethodTrampoline(0, (Parser target) => target._matchesGt()) ,
9652 'matchesIdentifier_0': new MethodTrampoline(0, (Parser target) => target._matc hesIdentifier()), 9627 'matchesIdentifier_0': new MethodTrampoline(0, (Parser target) => target._matc hesIdentifier()),
9653 'matchesKeyword_1': new MethodTrampoline(1, (Parser target, arg0) => target._m atchesKeyword(arg0)), 9628 'matchesKeyword_1': new MethodTrampoline(1, (Parser target, arg0) => target._m atchesKeyword(arg0)),
9654 'matchesString_1': new MethodTrampoline(1, (Parser target, arg0) => target._ma tchesString(arg0)), 9629 'matchesString_1': new MethodTrampoline(1, (Parser target, arg0) => target._ma tchesString(arg0)),
9655 'optional_1': new MethodTrampoline(1, (Parser target, arg0) => target._optiona l(arg0)), 9630 'optional_1': new MethodTrampoline(1, (Parser target, arg0) => target._optiona l(arg0)),
9656 'parseAdditiveExpression_0': new MethodTrampoline(0, (Parser target) => target ._parseAdditiveExpression()), 9631 'parseAdditiveExpression_0': new MethodTrampoline(0, (Parser target) => target ._parseAdditiveExpression()),
9657 'parseAssertStatement_0': new MethodTrampoline(0, (Parser target) => target._p arseAssertStatement()), 9632 'parseAssertStatement_0': new MethodTrampoline(0, (Parser target) => target._p arseAssertStatement()),
9658 'parseAssignableExpression_1': new MethodTrampoline(1, (Parser target, arg0) = > target._parseAssignableExpression(arg0)), 9633 'parseAssignableExpression_1': new MethodTrampoline(1, (Parser target, arg0) = > target._parseAssignableExpression(arg0)),
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
9804 return trampoline(target, arguments[0], arguments[1]); 9779 return trampoline(target, arguments[0], arguments[1]);
9805 case 3: 9780 case 3:
9806 return trampoline(target, arguments[0], arguments[1], arguments[2]); 9781 return trampoline(target, arguments[0], arguments[1], arguments[2]);
9807 case 4: 9782 case 4:
9808 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]); 9783 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]);
9809 default: 9784 default:
9810 throw new IllegalArgumentException("Not implemented for > 4 arguments"); 9785 throw new IllegalArgumentException("Not implemented for > 4 arguments");
9811 } 9786 }
9812 } 9787 }
9813 } 9788 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698