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

Unified Diff: pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart

Issue 2763833002: fasta.CommentToken implement analyzer.CommentToken (Closed)
Patch Set: merge 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/scanner/abstract_scanner.dart
diff --git a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
index 67cd48389331a1b1884b8aff9139300a2c505433..995597f98eb18270a551938e840be36b2986aae5 100644
--- a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
@@ -17,7 +17,7 @@ import 'keyword.dart' show KeywordState, Keyword;
import 'precedence.dart';
-import 'token.dart' show BeginGroupToken, SymbolToken, Token;
+import 'token.dart' show BeginGroupToken, CommentToken, SymbolToken, Token;
import 'token_constants.dart';
@@ -54,7 +54,7 @@ abstract class AbstractScanner implements Scanner {
* before they are assigned to the [Token] precedingComments field
* of a non-comment token. A value of `null` indicates no comment tokens.
*/
- Token comments;
+ CommentToken comments;
/**
* A pointer to the last scanned comment token or `null` if none.
@@ -188,6 +188,9 @@ abstract class AbstractScanner implements Scanner {
/** Documentation in subclass [ArrayBasedScanner]. */
void appendComment(start, PrecedenceInfo info, bool asciiOnly);
+ /** Documentation in subclass [ArrayBasedScanner]. */
+ void appendDartDoc(start, PrecedenceInfo info, bool asciiOnly);
+
/// Append [token] to the token stream.
void appendErrorToken(ErrorToken token);
@@ -722,6 +725,7 @@ abstract class AbstractScanner implements Scanner {
int tokenizeSingleLineComment(int next, int start) {
bool asciiOnly = true;
+ bool dartdoc = identical($SLASH, peek());
while (true) {
next = advance();
if (next > 127) asciiOnly = false;
@@ -729,7 +733,11 @@ abstract class AbstractScanner implements Scanner {
identical($CR, next) ||
identical($EOF, next)) {
if (!asciiOnly) handleUnicode(start);
- appendComment(start, SINGLE_LINE_COMMENT_INFO, asciiOnly);
+ if (dartdoc) {
+ appendDartDoc(start, SINGLE_LINE_COMMENT_INFO, asciiOnly);
+ } else {
+ appendComment(start, SINGLE_LINE_COMMENT_INFO, asciiOnly);
+ }
return next;
}
}
@@ -741,6 +749,7 @@ abstract class AbstractScanner implements Scanner {
int unicodeStart = start;
int nesting = 1;
next = advance();
+ bool dartdoc = identical($STAR, next);
while (true) {
if (identical($EOF, next)) {
if (!asciiOnlyLines) handleUnicode(unicodeStart);
@@ -753,7 +762,11 @@ abstract class AbstractScanner implements Scanner {
if (0 == nesting) {
if (!asciiOnlyLines) handleUnicode(unicodeStart);
next = advance();
- appendComment(start, MULTI_LINE_COMMENT_INFO, asciiOnlyComment);
+ if (dartdoc) {
+ appendDartDoc(start, MULTI_LINE_COMMENT_INFO, asciiOnlyComment);
+ } else {
+ appendComment(start, MULTI_LINE_COMMENT_INFO, asciiOnlyComment);
+ }
break;
} else {
next = advance();
« no previous file with comments | « pkg/analyzer/tool/summary/mini_ast.dart ('k') | pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698