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

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

Issue 1847093002: Issue 26146. Get next token after '{' or '}' while skipping interpolations. (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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.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 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 8616 matching lines...) Expand 10 before | Expand all | Expand 10 after
8627 // Rather than verify that the following tokens represent a valid 8627 // Rather than verify that the following tokens represent a valid
8628 // expression, we simply skip tokens until we reach the end of the 8628 // expression, we simply skip tokens until we reach the end of the
8629 // interpolation, being careful to handle nested string literals. 8629 // interpolation, being careful to handle nested string literals.
8630 // 8630 //
8631 int bracketNestingLevel = 1; 8631 int bracketNestingLevel = 1;
8632 while (bracketNestingLevel > 0) { 8632 while (bracketNestingLevel > 0) {
8633 if (type == TokenType.EOF) { 8633 if (type == TokenType.EOF) {
8634 return null; 8634 return null;
8635 } else if (type == TokenType.OPEN_CURLY_BRACKET) { 8635 } else if (type == TokenType.OPEN_CURLY_BRACKET) {
8636 bracketNestingLevel++; 8636 bracketNestingLevel++;
8637 token = token.next;
8637 } else if (type == TokenType.CLOSE_CURLY_BRACKET) { 8638 } else if (type == TokenType.CLOSE_CURLY_BRACKET) {
8638 bracketNestingLevel--; 8639 bracketNestingLevel--;
8640 token = token.next;
8639 } else if (type == TokenType.STRING) { 8641 } else if (type == TokenType.STRING) {
8640 token = _skipStringLiteral(token); 8642 token = _skipStringLiteral(token);
8641 if (token == null) { 8643 if (token == null) {
8642 return null; 8644 return null;
8643 } 8645 }
8644 } else { 8646 } else {
8645 token = token.next; 8647 token = token.next;
8646 } 8648 }
8647 type = token.type; 8649 type = token.type;
8648 } 8650 }
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
9957 */ 9959 */
9958 const ParserErrorCode(String name, String message, [String correction]) 9960 const ParserErrorCode(String name, String message, [String correction])
9959 : super(name, message, correction); 9961 : super(name, message, correction);
9960 9962
9961 @override 9963 @override
9962 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; 9964 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
9963 9965
9964 @override 9966 @override
9965 ErrorType get type => ErrorType.SYNTACTIC_ERROR; 9967 ErrorType get type => ErrorType.SYNTACTIC_ERROR;
9966 } 9968 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698