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

Side by Side Diff: pkg/dart_scanner/lib/src/recover.dart

Issue 2654433009: Skeleton for lexical error recovery. (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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style licenset hat can be found in the LICENSE file.
4
5 library dart_scanner.recover;
6
7 import 'token.dart' show
8 Token;
9
10 /// Recover from errors in [tokens]. The original sources are provided as
11 /// [bytes]. [lineStarts] are the beginning character offsets of lines, and
12 /// must be updated if recovery is performed rewriting the original source
13 /// code.
14 Token defaultRecoveryStrategy(
15 List<int> bytes, Token tokens, List<int> lineStarts) {
16 // See [Parser.reportErrorToken](package:dart_parser/src/parser.dart) for how
17 // it currently handles lexical errors. In addition, notice how the parser
18 // calls [handleInvalidExpression], [handleInvalidFunctionBody], and
19 // [handleInvalidTypeReference] to allow the listener to recover its internal
20 // state. See [package:compiler/src/parser/element_listener.dart] for an
21 // example of how these events are used.
22 //
23 // In addition, the scanner will attempt a bit of recovery when braces don't
24 // match up during brace grouping. See
25 // [ArrayBasedScanner.discardBeginGroupUntil](array_based_scanner.dart). For
26 // more details on brace grouping see
27 // [AbstractScanner.unmatchedBeginGroup](abstract_scanner.dart).
28 return tokens;
29 }
OLDNEW
« pkg/dart_scanner/lib/dart_scanner.dart ('K') | « pkg/dart_scanner/lib/src/array_based_scanner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698