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

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

Issue 768233002: Extract DocumentationCommentToken with field. (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<CommentToken> tokens) { 5461 List<CommentReference>
5462 _parseCommentReferences(List<DocumentationCommentToken> tokens) {
5462 List<CommentReference> references = new List<CommentReference>(); 5463 List<CommentReference> references = new List<CommentReference>();
5463 for (CommentToken token in tokens) { 5464 for (DocumentationCommentToken token in tokens) {
5464 String comment = token.lexeme; 5465 String comment = token.lexeme;
5465 int length = comment.length; 5466 int length = comment.length;
5466 List<List<int>> codeBlockRanges = _getCodeBlockRanges(comment); 5467 List<List<int>> codeBlockRanges = _getCodeBlockRanges(comment);
5467 int leftIndex = comment.indexOf('['); 5468 int leftIndex = comment.indexOf('[');
5468 while (leftIndex >= 0 && leftIndex + 1 < length) { 5469 while (leftIndex >= 0 && leftIndex + 1 < length) {
5469 List<int> range = _findRange(codeBlockRanges, leftIndex); 5470 List<int> range = _findRange(codeBlockRanges, leftIndex);
5470 if (range == null) { 5471 if (range == null) {
5471 int nameOffset = token.offset + leftIndex + 1; 5472 int nameOffset = token.offset + leftIndex + 1;
5472 int rightIndex = JavaString.indexOf(comment, ']', leftIndex); 5473 int rightIndex = JavaString.indexOf(comment, ']', leftIndex);
5473 if (rightIndex >= 0) { 5474 if (rightIndex >= 0) {
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
6010 * 6011 *
6011 * <pre> 6012 * <pre>
6012 * documentationComment ::= 6013 * documentationComment ::=
6013 * multiLineComment? 6014 * multiLineComment?
6014 * | singleLineComment* 6015 * | singleLineComment*
6015 * </pre> 6016 * </pre>
6016 * 6017 *
6017 * @return the documentation comment that was parsed, or `null` if there was n o comment 6018 * @return the documentation comment that was parsed, or `null` if there was n o comment
6018 */ 6019 */
6019 Comment _parseDocumentationComment() { 6020 Comment _parseDocumentationComment() {
6020 List<CommentToken> commentTokens = <CommentToken>[]; 6021 List<DocumentationCommentToken> documentationTokens =
6022 <DocumentationCommentToken>[
6023 ];
6021 CommentToken commentToken = _currentToken.precedingComments; 6024 CommentToken commentToken = _currentToken.precedingComments;
6022 while (commentToken != null) { 6025 while (commentToken != null) {
6023 if (commentToken.type == TokenType.SINGLE_LINE_COMMENT) { 6026 if (commentToken is DocumentationCommentToken) {
6024 if (StringUtilities.startsWith3( 6027 documentationTokens.add(commentToken);
Brian Wilkerson 2014/12/01 23:08:43 This doesn't give us the semantics we want (obviou
scheglov 2014/12/01 23:27:53 Done.
6025 commentToken.lexeme,
6026 0,
6027 0x2F,
6028 0x2F,
6029 0x2F)) {
6030 if (commentTokens.length == 1 &&
6031 StringUtilities.startsWith3(commentTokens[0].lexeme, 0, 0x2F, 0x2A , 0x2A)) {
6032 commentTokens.clear();
6033 }
6034 commentTokens.add(commentToken);
6035 }
6036 } else {
6037 if (StringUtilities.startsWith3(
6038 commentToken.lexeme,
6039 0,
6040 0x2F,
6041 0x2A,
6042 0x2A)) {
6043 commentTokens.clear();
6044 commentTokens.add(commentToken);
6045 }
6046 } 6028 }
6047 commentToken = commentToken.next; 6029 commentToken = commentToken.next;
6048 } 6030 }
6049 if (commentTokens.isEmpty) { 6031 if (documentationTokens.isEmpty) {
6050 return null; 6032 return null;
6051 } 6033 }
6052 List<CommentReference> references = _parseCommentReferences(commentTokens); 6034 List<CommentReference> references =
6035 _parseCommentReferences(documentationTokens);
6053 return Comment.createDocumentationCommentWithReferences( 6036 return Comment.createDocumentationCommentWithReferences(
6054 commentTokens, 6037 documentationTokens,
6055 references); 6038 references);
6056 } 6039 }
6057 6040
6058 /** 6041 /**
6059 * Parse a do statement. 6042 * Parse a do statement.
6060 * 6043 *
6061 * <pre> 6044 * <pre>
6062 * doStatement ::= 6045 * doStatement ::=
6063 * 'do' statement 'while' '(' expression ')' ';' 6046 * 'do' statement 'while' '(' expression ')' ';'
6064 * </pre> 6047 * </pre>
(...skipping 5979 matching lines...) Expand 10 before | Expand all | Expand 10 after
12044 * Copy resolution data from one node to another. 12027 * Copy resolution data from one node to another.
12045 * 12028 *
12046 * @param fromNode the node from which resolution information will be copied 12029 * @param fromNode the node from which resolution information will be copied
12047 * @param toNode the node to which resolution information will be copied 12030 * @param toNode the node to which resolution information will be copied
12048 */ 12031 */
12049 static void copyResolutionData(AstNode fromNode, AstNode toNode) { 12032 static void copyResolutionData(AstNode fromNode, AstNode toNode) {
12050 ResolutionCopier copier = new ResolutionCopier(); 12033 ResolutionCopier copier = new ResolutionCopier();
12051 copier._isEqualNodes(fromNode, toNode); 12034 copier._isEqualNodes(fromNode, toNode);
12052 } 12035 }
12053 } 12036 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698