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

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 1536483002: Skip comments code blocks indented with 4 spaces. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/parser.dart
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index a30590015e6d572203c8f1668268a30a0194ade0..7c258761bd5f659ea495b558856961c8f056b0f9 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -3886,6 +3886,16 @@ class Parser {
ranges.add(<int>[index, end]);
index = end;
}
+ } else if (StringUtilities.startsWith5(
+ comment, index, 0x20, 0x20, 0x20, 0x20, 0x20)) {
Brian Wilkerson 2015/12/16 21:23:33 That looks like five spaces to me. (If we only req
scheglov 2015/12/16 21:27:06 According to https://www.dartlang.org/effective-da
Brian Wilkerson 2015/12/16 21:35:02 Given the example you showed me earlier, it's poss
scheglov 2015/12/16 22:28:18 Acknowledged.
+ int end = index + 5;
+ while (end < length &&
+ comment.codeUnitAt(end) != 0xD &&
+ comment.codeUnitAt(end) != 0xA) {
+ end = end + 1;
+ }
+ ranges.add(<int>[index, end]);
+ index = end;
} else if (index + 1 < length &&
currentChar == 0x5B &&
comment.codeUnitAt(index + 1) == 0x3A) {
@@ -5043,7 +5053,7 @@ class Parser {
List<CommentReference> references = new List<CommentReference>();
for (DocumentationCommentToken token in tokens) {
String comment = token.lexeme;
- comment = _removeGitHubCodeBlocks(comment);
+ comment = _removeCodeBlocksGitHub(comment);
int length = comment.length;
List<List<int>> codeBlockRanges = _getCodeBlockRanges(comment);
int leftIndex = comment.indexOf('[');
@@ -8233,7 +8243,7 @@ class Parser {
return token;
}
- String _removeGitHubCodeBlocks(String comment) {
+ String _removeCodeBlocksGitHub(String comment) {
int index = 0;
while (true) {
int beginIndex = comment.indexOf('`', index);
« 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