| Index: pkg/front_end/lib/src/scanner/scanner.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/scanner/scanner.dart b/pkg/front_end/lib/src/scanner/scanner.dart
|
| similarity index 97%
|
| copy from pkg/analyzer/lib/src/dart/scanner/scanner.dart
|
| copy to pkg/front_end/lib/src/scanner/scanner.dart
|
| index 3c74e78ba79590e9d4d57504e90ae8e755bc6f60..6ef1fdb49cddc2730aed846930f754eda5bd7cef 100644
|
| --- a/pkg/analyzer/lib/src/dart/scanner/scanner.dart
|
| +++ b/pkg/front_end/lib/src/scanner/scanner.dart
|
| @@ -1,20 +1,14 @@
|
| -// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2016, 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 analyzer.src.dart.scanner.scanner;
|
| +library front_end.src.scanner.scanner;
|
|
|
| -import 'package:analyzer/dart/ast/token.dart';
|
| -import 'package:analyzer/error/error.dart';
|
| -import 'package:analyzer/error/listener.dart';
|
| -import 'package:analyzer/src/dart/ast/token.dart';
|
| -import 'package:analyzer/src/dart/error/syntactic_errors.dart';
|
| -import 'package:analyzer/src/dart/scanner/reader.dart';
|
| -import 'package:analyzer/src/generated/java_engine.dart';
|
| -import 'package:analyzer/src/generated/source.dart';
|
| import 'package:charcode/ascii.dart';
|
| -
|
| -export 'package:analyzer/src/dart/error/syntactic_errors.dart';
|
| +import 'package:front_end/src/scanner/errors.dart';
|
| +import 'package:front_end/src/scanner/reader.dart';
|
| +import 'package:front_end/src/scanner/string_utilities.dart';
|
| +import 'package:front_end/src/scanner/token.dart';
|
|
|
| /**
|
| * A state in a state machine used to scan keywords.
|
| @@ -132,24 +126,13 @@ class KeywordState {
|
| * any context, so it always resolves such conflicts by scanning the longest
|
| * possible token.
|
| */
|
| -class Scanner {
|
| - /**
|
| - * The source being scanned.
|
| - */
|
| - final Source source;
|
| -
|
| +abstract class Scanner {
|
| /**
|
| * The reader used to access the characters in the source.
|
| */
|
| final CharacterReader _reader;
|
|
|
| /**
|
| - * The error listener that will be informed of any errors that are found
|
| - * during the scan.
|
| - */
|
| - final AnalysisErrorListener _errorListener;
|
| -
|
| - /**
|
| * The flag specifying whether documentation comments should be parsed.
|
| */
|
| bool _preserveComments = true;
|
| @@ -219,11 +202,9 @@ class Scanner {
|
|
|
| /**
|
| * Initialize a newly created scanner to scan characters from the given
|
| - * [source]. The given character [_reader] will be used to read the characters
|
| - * in the source. The given [_errorListener] will be informed of any errors
|
| - * that are found.
|
| + * character [_reader].
|
| */
|
| - Scanner(this.source, this._reader, this._errorListener) {
|
| + Scanner(this._reader) {
|
| _tokens = new Token(TokenType.EOF, -1);
|
| _tokens.setNext(_tokens);
|
| _tail = _tokens;
|
| @@ -459,6 +440,14 @@ class Scanner {
|
| }
|
|
|
| /**
|
| + * Report an error at the given offset. The [errorCode] is the error code
|
| + * indicating the nature of the error. The [arguments] are any arguments
|
| + * needed to complete the error message
|
| + */
|
| + void reportError(
|
| + ScannerErrorCode errorCode, int offset, List<Object> arguments);
|
| +
|
| + /**
|
| * Record that the source begins on the given [line] and [column] at the
|
| * current offset as given by the reader. Both the line and the column are
|
| * one-based indexes. The line starts for lines before the given line will not
|
| @@ -677,8 +666,7 @@ class Scanner {
|
| * needed to complete the error message
|
| */
|
| void _reportError(ScannerErrorCode errorCode, [List<Object> arguments]) {
|
| - _errorListener.onError(
|
| - new AnalysisError(source, _reader.offset, 1, errorCode, arguments));
|
| + reportError(errorCode, _reader.offset, arguments);
|
| }
|
|
|
| int _select(int choice, TokenType yesType, TokenType noType) {
|
|
|