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

Unified Diff: pkg/compiler/lib/src/scanner/string_scanner.dart

Issue 2644843006: Use packages dart_parser, dart_scanner, and compiler_util. (Closed)
Patch Set: Created 3 years, 11 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/compiler/lib/src/scanner/string_scanner.dart
diff --git a/pkg/compiler/lib/src/scanner/string_scanner.dart b/pkg/compiler/lib/src/scanner/string_scanner.dart
deleted file mode 100644
index 7e1f995d8252332cbf1e5213ee1197536aa1dbb4..0000000000000000000000000000000000000000
--- a/pkg/compiler/lib/src/scanner/string_scanner.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dart2js.scanner.string;
-
-import '../io/source_file.dart' show SourceFile;
-import '../tokens/precedence.dart' show PrecedenceInfo;
-import '../tokens/token.dart' show StringToken, Token;
-import 'array_based_scanner.dart' show ArrayBasedScanner;
-
-/**
- * Scanner that reads from a String and creates tokens that points to
- * substrings.
- */
-class StringScanner extends ArrayBasedScanner {
- /** The file content. */
- String string;
-
- /** The current offset in [string]. */
- int scanOffset = -1;
-
- StringScanner(SourceFile file, {bool includeComments: false})
- : string = file.slowText(),
- super(file, includeComments) {
- ensureZeroTermination();
- }
-
- StringScanner.fromString(this.string, {bool includeComments: false})
- : super(null, includeComments) {
- ensureZeroTermination();
- }
-
- void ensureZeroTermination() {
- if (string.isEmpty || string.codeUnitAt(string.length - 1) != 0) {
- // TODO(lry): abort instead of copying the array, or warn?
- string = string + '\x00';
- }
- }
-
- int advance() => string.codeUnitAt(++scanOffset);
- int peek() => string.codeUnitAt(scanOffset + 1);
-
- int get stringOffset => scanOffset;
-
- int currentAsUnicode(int next) => next;
-
- void handleUnicode(int startScanOffset) {}
-
- Token firstToken() => tokens.next;
- Token previousToken() => tail;
-
- void appendSubstringToken(PrecedenceInfo info, int start, bool asciiOnly,
- [int extraOffset = 0]) {
- tail.next = new StringToken.fromSubstring(
- info, string, start, scanOffset + extraOffset, tokenStart,
- canonicalize: true);
- tail = tail.next;
- }
-
- bool atEndOfFile() => scanOffset >= string.length - 1;
-}

Powered by Google App Engine
This is Rietveld 408576698