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

Unified Diff: pkg/front_end/lib/src/fasta/analyzer/token_utils.dart

Issue 2732363002: Add support for documentation comments to most of AstBuilder. (Closed)
Patch Set: Created 3 years, 9 months 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
Index: pkg/front_end/lib/src/fasta/analyzer/token_utils.dart
diff --git a/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart b/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart
index 7df6a6e3e397fffed04af3fe4081f9a22cd5c2d6..302accc17ceb11103a17604727f8e1d462fb6236 100644
--- a/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart
+++ b/pkg/front_end/lib/src/fasta/analyzer/token_utils.dart
@@ -110,22 +110,13 @@ class ToAnalyzerTokenStreamConverter {
/// Translates a sequence of fasta comment tokens to the corresponding
/// analyzer tokens.
analyzer.CommentToken translateCommentTokens(Token token) {
- analyzer.CommentToken translateOneComment(Token token) {
- // TODO(paulberry,ahe): It would be nice if the scanner gave us an
- // easier way to distinguish between the two types of comment.
- var type = token.value.startsWith('/*')
- ? TokenType.MULTI_LINE_COMMENT
- : TokenType.SINGLE_LINE_COMMENT;
- return new analyzer.CommentToken(type, token.value, token.charOffset);
- }
-
analyzer.CommentToken head;
if (token != null) {
- head = translateOneComment(token);
+ head = toAnalyzerCommentToken(token);
analyzer.CommentToken tail = head;
token = token.next;
while (token != null) {
- tail = tail.setNext(translateOneComment(token));
+ tail = tail.setNext(toAnalyzerCommentToken(token));
token = token.next;
}
}
@@ -221,6 +212,16 @@ class ToAnalyzerTokenStreamConverter {
}
}
+/// Converts a single Fasta comment token to an analyzer comment token.
+analyzer.CommentToken toAnalyzerCommentToken(Token token) {
+ // TODO(paulberry,ahe): It would be nice if the scanner gave us an
+ // easier way to distinguish between the two types of comment.
+ var type = token.value.startsWith('/*')
+ ? TokenType.MULTI_LINE_COMMENT
+ : TokenType.SINGLE_LINE_COMMENT;
+ return new analyzer.CommentToken(type, token.value, token.charOffset);
+}
+
/// Converts a stream of Analyzer tokens (starting with [token] and continuing
/// to EOF) to a stream of Fasta tokens.
///

Powered by Google App Engine
This is Rietveld 408576698