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

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

Issue 1851623002: Issue 26148. Don't use a current token if it does not match - create a new synthetic. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
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 library analyzer.src.generated.parser; 5 library analyzer.src.generated.parser;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 3798 matching lines...) Expand 10 before | Expand all | Expand 10 after
3809 _reportErrorForCurrentToken( 3809 _reportErrorForCurrentToken(
3810 ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken.lexeme]); 3810 ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken.lexeme]);
3811 _advance(); 3811 _advance();
3812 return getAndAdvance(); 3812 return getAndAdvance();
3813 } 3813 }
3814 _reportErrorForToken(ParserErrorCode.EXPECTED_TOKEN, 3814 _reportErrorForToken(ParserErrorCode.EXPECTED_TOKEN,
3815 _currentToken.previous, [type.lexeme]); 3815 _currentToken.previous, [type.lexeme]);
3816 return _createSyntheticToken(TokenType.SEMICOLON); 3816 return _createSyntheticToken(TokenType.SEMICOLON);
3817 } 3817 }
3818 _reportErrorForCurrentToken(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]); 3818 _reportErrorForCurrentToken(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]);
3819 return _currentToken; 3819 return _createSyntheticToken(type);
3820 } 3820 }
3821 3821
3822 /** 3822 /**
3823 * If the current token has the type [TokenType.GT], return it after advancing 3823 * If the current token has the type [TokenType.GT], return it after advancing
3824 * to the next token. Otherwise report an error and create a synthetic token. 3824 * to the next token. Otherwise report an error and create a synthetic token.
3825 */ 3825 */
3826 Token _expectGt() { 3826 Token _expectGt() {
3827 if (_matchesGt()) { 3827 if (_matchesGt()) {
3828 return getAndAdvance(); 3828 return getAndAdvance();
3829 } 3829 }
(...skipping 6129 matching lines...) Expand 10 before | Expand all | Expand 10 after
9959 */ 9959 */
9960 const ParserErrorCode(String name, String message, [String correction]) 9960 const ParserErrorCode(String name, String message, [String correction])
9961 : super(name, message, correction); 9961 : super(name, message, correction);
9962 9962
9963 @override 9963 @override
9964 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; 9964 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
9965 9965
9966 @override 9966 @override
9967 ErrorType get type => ErrorType.SYNTACTIC_ERROR; 9967 ErrorType get type => ErrorType.SYNTACTIC_ERROR;
9968 } 9968 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698