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

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

Issue 764243003: Updated detached tokens of references in documentation comments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 // 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:math" as math; 10 import "dart:math" as math;
(...skipping 5440 matching lines...) Expand 10 before | Expand all | Expand 10 after
5451 * commentReference ::= 5451 * commentReference ::=
5452 * '[' 'new'? qualified ']' libraryReference? 5452 * '[' 'new'? qualified ']' libraryReference?
5453 * 5453 *
5454 * libraryReference ::= 5454 * libraryReference ::=
5455 * '(' stringLiteral ')' 5455 * '(' stringLiteral ')'
5456 * </pre> 5456 * </pre>
5457 * 5457 *
5458 * @param tokens the comment tokens representing the documentation comments to be parsed 5458 * @param tokens the comment tokens representing the documentation comments to be parsed
5459 * @return the comment references that were parsed 5459 * @return the comment references that were parsed
5460 */ 5460 */
5461 List<CommentReference> _parseCommentReferences(List<Token> tokens) { 5461 List<CommentReference> _parseCommentReferences(List<CommentToken> tokens) {
5462 List<CommentReference> references = new List<CommentReference>(); 5462 List<CommentReference> references = new List<CommentReference>();
5463 for (Token token in tokens) { 5463 for (CommentToken token in tokens) {
5464 String comment = token.lexeme; 5464 String comment = token.lexeme;
5465 int length = comment.length; 5465 int length = comment.length;
5466 List<List<int>> codeBlockRanges = _getCodeBlockRanges(comment); 5466 List<List<int>> codeBlockRanges = _getCodeBlockRanges(comment);
5467 int leftIndex = comment.indexOf('['); 5467 int leftIndex = comment.indexOf('[');
5468 while (leftIndex >= 0 && leftIndex + 1 < length) { 5468 while (leftIndex >= 0 && leftIndex + 1 < length) {
5469 List<int> range = _findRange(codeBlockRanges, leftIndex); 5469 List<int> range = _findRange(codeBlockRanges, leftIndex);
5470 if (range == null) { 5470 if (range == null) {
5471 int nameOffset = token.offset + leftIndex + 1; 5471 int nameOffset = token.offset + leftIndex + 1;
5472 int rightIndex = JavaString.indexOf(comment, ']', leftIndex); 5472 int rightIndex = JavaString.indexOf(comment, ']', leftIndex);
5473 if (rightIndex >= 0) { 5473 if (rightIndex >= 0) {
5474 int firstChar = comment.codeUnitAt(leftIndex + 1); 5474 int firstChar = comment.codeUnitAt(leftIndex + 1);
5475 if (firstChar != 0x27 && firstChar != 0x22) { 5475 if (firstChar != 0x27 && firstChar != 0x22) {
5476 if (_isLinkText(comment, rightIndex)) { 5476 if (_isLinkText(comment, rightIndex)) {
5477 // TODO(brianwilkerson) Handle the case where there's a library 5477 // TODO(brianwilkerson) Handle the case where there's a library
5478 // URI in the link text. 5478 // URI in the link text.
5479 } else { 5479 } else {
5480 CommentReference reference = _parseCommentReference( 5480 CommentReference reference = _parseCommentReference(
5481 comment.substring(leftIndex + 1, rightIndex), 5481 comment.substring(leftIndex + 1, rightIndex),
5482 nameOffset); 5482 nameOffset);
5483 if (reference != null) { 5483 if (reference != null) {
5484 references.add(reference); 5484 references.add(reference);
5485 token.references.add(reference.beginToken);
5485 } 5486 }
5486 } 5487 }
5487 } 5488 }
5488 } else { 5489 } else {
5489 // terminating ']' is not typed yet 5490 // terminating ']' is not typed yet
5490 int charAfterLeft = comment.codeUnitAt(leftIndex + 1); 5491 int charAfterLeft = comment.codeUnitAt(leftIndex + 1);
5491 if (Character.isLetterOrDigit(charAfterLeft)) { 5492 if (Character.isLetterOrDigit(charAfterLeft)) {
5492 int nameEnd = 5493 int nameEnd =
5493 StringUtilities.indexOfFirstNotLetterDigit(comment, leftIndex + 1); 5494 StringUtilities.indexOfFirstNotLetterDigit(comment, leftIndex + 1);
5494 String name = comment.substring(leftIndex + 1, nameEnd); 5495 String name = comment.substring(leftIndex + 1, nameEnd);
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
6009 * 6010 *
6010 * <pre> 6011 * <pre>
6011 * documentationComment ::= 6012 * documentationComment ::=
6012 * multiLineComment? 6013 * multiLineComment?
6013 * | singleLineComment* 6014 * | singleLineComment*
6014 * </pre> 6015 * </pre>
6015 * 6016 *
6016 * @return the documentation comment that was parsed, or `null` if there was n o comment 6017 * @return the documentation comment that was parsed, or `null` if there was n o comment
6017 */ 6018 */
6018 Comment _parseDocumentationComment() { 6019 Comment _parseDocumentationComment() {
6019 List<Token> commentTokens = new List<Token>(); 6020 List<CommentToken> commentTokens = <CommentToken>[];
6020 Token commentToken = _currentToken.precedingComments; 6021 CommentToken commentToken = _currentToken.precedingComments;
6021 while (commentToken != null) { 6022 while (commentToken != null) {
6022 if (commentToken.type == TokenType.SINGLE_LINE_COMMENT) { 6023 if (commentToken.type == TokenType.SINGLE_LINE_COMMENT) {
6023 if (StringUtilities.startsWith3( 6024 if (StringUtilities.startsWith3(
6024 commentToken.lexeme, 6025 commentToken.lexeme,
6025 0, 6026 0,
6026 0x2F, 6027 0x2F,
6027 0x2F, 6028 0x2F,
6028 0x2F)) { 6029 0x2F)) {
6029 if (commentTokens.length == 1 && 6030 if (commentTokens.length == 1 &&
6030 StringUtilities.startsWith3(commentTokens[0].lexeme, 0, 0x2F, 0x2A , 0x2A)) { 6031 StringUtilities.startsWith3(commentTokens[0].lexeme, 0, 0x2F, 0x2A , 0x2A)) {
(...skipping 6012 matching lines...) Expand 10 before | Expand all | Expand 10 after
12043 * Copy resolution data from one node to another. 12044 * Copy resolution data from one node to another.
12044 * 12045 *
12045 * @param fromNode the node from which resolution information will be copied 12046 * @param fromNode the node from which resolution information will be copied
12046 * @param toNode the node to which resolution information will be copied 12047 * @param toNode the node to which resolution information will be copied
12047 */ 12048 */
12048 static void copyResolutionData(AstNode fromNode, AstNode toNode) { 12049 static void copyResolutionData(AstNode fromNode, AstNode toNode) {
12049 ResolutionCopier copier = new ResolutionCopier(); 12050 ResolutionCopier copier = new ResolutionCopier();
12050 copier._isEqualNodes(fromNode, toNode); 12051 copier._isEqualNodes(fromNode, toNode);
12051 } 12052 }
12052 } 12053 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698