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 b15a92ebe857e0be863faa56d532bcefec8053ee..a30590015e6d572203c8f1668268a30a0194ade0 100644 |
--- a/pkg/analyzer/lib/src/generated/parser.dart |
+++ b/pkg/analyzer/lib/src/generated/parser.dart |
@@ -4052,7 +4052,8 @@ class Parser { |
/** |
* Return `true` if the given [character] is a valid hexadecimal digit. |
*/ |
- bool _isHexDigit(int character) => (0x30 <= character && character <= 0x39) || |
+ bool _isHexDigit(int character) => |
+ (0x30 <= character && character <= 0x39) || |
(0x41 <= character && character <= 0x46) || |
(0x61 <= character && character <= 0x66); |
@@ -4326,7 +4327,7 @@ class Parser { |
*/ |
bool _matchesString(String identifier) => |
_currentToken.type == TokenType.IDENTIFIER && |
- _currentToken.lexeme == identifier; |
+ _currentToken.lexeme == identifier; |
/** |
* If the current token has the given [type], then advance to the next token |
@@ -5042,6 +5043,7 @@ class Parser { |
List<CommentReference> references = new List<CommentReference>(); |
for (DocumentationCommentToken token in tokens) { |
String comment = token.lexeme; |
+ comment = _removeGitHubCodeBlocks(comment); |
int length = comment.length; |
List<List<int>> codeBlockRanges = _getCodeBlockRanges(comment); |
int leftIndex = comment.indexOf('['); |
@@ -8008,7 +8010,8 @@ class Parser { |
* was parsed. |
*/ |
StringLiteral _parseUri() { |
- bool iskeywordAfterUri(Token token) => token.lexeme == Keyword.AS.syntax || |
+ bool iskeywordAfterUri(Token token) => |
+ token.lexeme == Keyword.AS.syntax || |
token.lexeme == _HIDE || |
token.lexeme == _SHOW; |
if (!_matches(TokenType.STRING) && |
@@ -8230,6 +8233,25 @@ class Parser { |
return token; |
} |
+ String _removeGitHubCodeBlocks(String comment) { |
+ int index = 0; |
+ while (true) { |
+ int beginIndex = comment.indexOf('`', index); |
+ if (beginIndex == -1) { |
+ break; |
+ } |
+ int endIndex = comment.indexOf('`', beginIndex + 1); |
+ if (endIndex == -1) { |
+ break; |
+ } |
+ comment = comment.substring(0, beginIndex + 1) + |
+ ' ' * (endIndex - beginIndex - 1) + |
+ comment.substring(endIndex); |
+ index = endIndex + 1; |
+ } |
+ return comment; |
+ } |
+ |
/** |
* Report the given [error]. |
*/ |
@@ -8741,21 +8763,21 @@ class Parser { |
*/ |
bool _tokenMatchesIdentifier(Token token) => |
_tokenMatches(token, TokenType.IDENTIFIER) || |
- _tokenMatchesPseudoKeyword(token); |
+ _tokenMatchesPseudoKeyword(token); |
/** |
* Return `true` if the given [token] matches the given [keyword]. |
*/ |
bool _tokenMatchesKeyword(Token token, Keyword keyword) => |
token.type == TokenType.KEYWORD && |
- (token as KeywordToken).keyword == keyword; |
+ (token as KeywordToken).keyword == keyword; |
/** |
* Return `true` if the given [token] matches a pseudo keyword. |
*/ |
bool _tokenMatchesPseudoKeyword(Token token) => |
_tokenMatches(token, TokenType.KEYWORD) && |
- (token as KeywordToken).keyword.isPseudoKeyword; |
+ (token as KeywordToken).keyword.isPseudoKeyword; |
/** |
* Return `true` if the given [token] matches the given [identifier]. |