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

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

Issue 2097233002: Fix for parsing not closed comment reference. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 5117 matching lines...) Expand 10 before | Expand all | Expand 10 after
5128 comment.substring(leftIndex + 1, rightIndex), nameOffset); 5128 comment.substring(leftIndex + 1, rightIndex), nameOffset);
5129 if (reference != null) { 5129 if (reference != null) {
5130 references.add(reference); 5130 references.add(reference);
5131 token.references.add(reference.beginToken); 5131 token.references.add(reference.beginToken);
5132 } 5132 }
5133 } 5133 }
5134 } 5134 }
5135 } else { 5135 } else {
5136 // terminating ']' is not typed yet 5136 // terminating ']' is not typed yet
5137 int charAfterLeft = comment.codeUnitAt(leftIndex + 1); 5137 int charAfterLeft = comment.codeUnitAt(leftIndex + 1);
5138 Token nameToken;
5138 if (Character.isLetterOrDigit(charAfterLeft)) { 5139 if (Character.isLetterOrDigit(charAfterLeft)) {
5139 int nameEnd = StringUtilities.indexOfFirstNotLetterDigit( 5140 int nameEnd = StringUtilities.indexOfFirstNotLetterDigit(
5140 comment, leftIndex + 1); 5141 comment, leftIndex + 1);
5141 String name = comment.substring(leftIndex + 1, nameEnd); 5142 String name = comment.substring(leftIndex + 1, nameEnd);
5142 Token nameToken = 5143 nameToken =
5143 new StringToken(TokenType.IDENTIFIER, name, nameOffset); 5144 new StringToken(TokenType.IDENTIFIER, name, nameOffset);
5144 references.add(
5145 new CommentReference(null, new SimpleIdentifier(nameToken)));
5146 } else { 5145 } else {
5147 Token nameToken = new SyntheticStringToken( 5146 nameToken = new SyntheticStringToken(
5148 TokenType.IDENTIFIER, "", nameOffset); 5147 TokenType.IDENTIFIER, '', nameOffset);
5149 references.add(
5150 new CommentReference(null, new SimpleIdentifier(nameToken)));
5151 } 5148 }
5149 nameToken.setNext(new SimpleToken(TokenType.EOF, nameToken.end));
5150 references.add(
5151 new CommentReference(null, new SimpleIdentifier(nameToken)));
5152 token.references.add(nameToken);
5152 // next character 5153 // next character
5153 rightIndex = leftIndex + 1; 5154 rightIndex = leftIndex + 1;
5154 } 5155 }
5155 leftIndex = JavaString.indexOf(comment, '[', rightIndex); 5156 leftIndex = JavaString.indexOf(comment, '[', rightIndex);
5156 } else { 5157 } else {
5157 leftIndex = JavaString.indexOf(comment, '[', range[1] + 1); 5158 leftIndex = JavaString.indexOf(comment, '[', range[1] + 1);
5158 } 5159 }
5159 } 5160 }
5160 } 5161 }
5161 return references; 5162 return references;
(...skipping 5291 matching lines...) Expand 10 before | Expand all | Expand 10 after
10453 */ 10454 */
10454 const ParserErrorCode(String name, String message, [String correction]) 10455 const ParserErrorCode(String name, String message, [String correction])
10455 : super(name, message, correction); 10456 : super(name, message, correction);
10456 10457
10457 @override 10458 @override
10458 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; 10459 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
10459 10460
10460 @override 10461 @override
10461 ErrorType get type => ErrorType.SYNTACTIC_ERROR; 10462 ErrorType get type => ErrorType.SYNTACTIC_ERROR;
10462 } 10463 }
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