Index: pkg/analyzer/lib/src/generated/scanner.dart |
diff --git a/pkg/analyzer/lib/src/generated/scanner.dart b/pkg/analyzer/lib/src/generated/scanner.dart |
index 413cf3b789bd9b1d3da66fd2f9b5ebd8886980d2..88ff4b045dd2d6dd75f9f3912d84f76c6ba8595b 100644 |
--- a/pkg/analyzer/lib/src/generated/scanner.dart |
+++ b/pkg/analyzer/lib/src/generated/scanner.dart |
@@ -728,6 +728,11 @@ class Scanner { |
AnalysisErrorListener _errorListener; |
/** |
+ * The flag specifying if documentation comments should be parsed. |
+ */ |
+ bool _preserveComments = true; |
+ |
+ /** |
* The token pointing to the head of the linked list of tokens. |
*/ |
Token _tokens; |
@@ -806,6 +811,15 @@ class Scanner { |
bool hasUnmatchedGroups() => _hasUnmatchedGroups2; |
/** |
+ * Set whether documentation tokens should be scanned. |
+ * |
+ * @param preserveComments `true` if documentation tokens should be scanned |
+ */ |
+ void set preserveComments(bool preserveComments) { |
+ this._preserveComments = preserveComments; |
+ } |
+ |
+ /** |
* Record that the source begins on the given line and column at the current offset as given by |
* the reader. The line starts for lines before the given line will not be correct. |
* |
@@ -1030,6 +1044,9 @@ class Scanner { |
} |
void appendCommentToken(TokenType type, String value) { |
+ if (!_preserveComments) { |
+ return; |
+ } |
if (_firstComment == null) { |
_firstComment = new StringToken(type, value, _tokenStart); |
_lastComment = _firstComment; |