| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 if (documentationTokens.isNotEmpty) { |
| 6025 commentToken.lexeme, | 6028 if (commentToken.type == TokenType.SINGLE_LINE_COMMENT) { |
| 6026 0, | 6029 if (documentationTokens[0].type != TokenType.SINGLE_LINE_COMMENT) { |
| 6027 0x2F, | 6030 documentationTokens.clear(); |
| 6028 0x2F, | 6031 } |
| 6029 0x2F)) { | 6032 } else { |
| 6030 if (commentTokens.length == 1 && | 6033 documentationTokens.clear(); |
| 6031 StringUtilities.startsWith3(commentTokens[0].lexeme, 0, 0x2F, 0x2A
, 0x2A)) { | |
| 6032 commentTokens.clear(); | |
| 6033 } | 6034 } |
| 6034 commentTokens.add(commentToken); | |
| 6035 } | 6035 } |
| 6036 } else { | 6036 documentationTokens.add(commentToken); |
| 6037 if (StringUtilities.startsWith3( | |
| 6038 commentToken.lexeme, | |
| 6039 0, | |
| 6040 0x2F, | |
| 6041 0x2A, | |
| 6042 0x2A)) { | |
| 6043 commentTokens.clear(); | |
| 6044 commentTokens.add(commentToken); | |
| 6045 } | |
| 6046 } | 6037 } |
| 6047 commentToken = commentToken.next; | 6038 commentToken = commentToken.next; |
| 6048 } | 6039 } |
| 6049 if (commentTokens.isEmpty) { | 6040 if (documentationTokens.isEmpty) { |
| 6050 return null; | 6041 return null; |
| 6051 } | 6042 } |
| 6052 List<CommentReference> references = _parseCommentReferences(commentTokens); | 6043 List<CommentReference> references = |
| 6044 _parseCommentReferences(documentationTokens); |
| 6053 return Comment.createDocumentationCommentWithReferences( | 6045 return Comment.createDocumentationCommentWithReferences( |
| 6054 commentTokens, | 6046 documentationTokens, |
| 6055 references); | 6047 references); |
| 6056 } | 6048 } |
| 6057 | 6049 |
| 6058 /** | 6050 /** |
| 6059 * Parse a do statement. | 6051 * Parse a do statement. |
| 6060 * | 6052 * |
| 6061 * <pre> | 6053 * <pre> |
| 6062 * doStatement ::= | 6054 * doStatement ::= |
| 6063 * 'do' statement 'while' '(' expression ')' ';' | 6055 * 'do' statement 'while' '(' expression ')' ';' |
| 6064 * </pre> | 6056 * </pre> |
| (...skipping 5979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12044 * Copy resolution data from one node to another. | 12036 * Copy resolution data from one node to another. |
| 12045 * | 12037 * |
| 12046 * @param fromNode the node from which resolution information will be copied | 12038 * @param fromNode the node from which resolution information will be copied |
| 12047 * @param toNode the node to which resolution information will be copied | 12039 * @param toNode the node to which resolution information will be copied |
| 12048 */ | 12040 */ |
| 12049 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 12041 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
| 12050 ResolutionCopier copier = new ResolutionCopier(); | 12042 ResolutionCopier copier = new ResolutionCopier(); |
| 12051 copier._isEqualNodes(fromNode, toNode); | 12043 copier._isEqualNodes(fromNode, toNode); |
| 12052 } | 12044 } |
| 12053 } | 12045 } |
| OLD | NEW |