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

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

Issue 2712383004: Revert "Record shebangs as comments." (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c49b5fb8d4b4f1dcf926041ec07aa2d9c14220c9..c621efde27fd4a0dd770fd9c7780f3b9ee5d3eba 100644
--- a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
@@ -37,7 +37,6 @@ import 'token_constants.dart';
import 'characters.dart';
abstract class AbstractScanner implements Scanner {
- /// If true, include comments in the token stream.
final bool includeComments;
/**
@@ -409,9 +408,20 @@ abstract class AbstractScanner implements Scanner {
}
int tokenizeTag(int next) {
- // #!.*[\n\r]
- if (scanOffset == 0 && identical(peek(), $BANG)) {
- tokenizeSingleLineComment(next, scanOffset);
+ // # or #!.*[\n\r]
+ if (scanOffset == 0) {
+ if (identical(peek(), $BANG)) {
+ int start = scanOffset + 1;
+ bool asciiOnly = true;
+ do {
+ next = advance();
+ if (next > 127) asciiOnly = false;
+ } while (!identical(next, $LF) &&
+ !identical(next, $CR) &&
+ !identical(next, $EOF));
+ if (!asciiOnly) handleUnicode(start);
+ return next;
+ }
}
appendPrecedenceToken(HASH_INFO);
return advance();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698