Chromium Code Reviews| Index: pkg/front_end/lib/src/fasta/parser/listener.dart |
| diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart |
| index a9c1ef6b935b6a365405844db319c40aad546af0..b6a05b6ccdf460a09eab03106a113446ce6e2f63 100644 |
| --- a/pkg/front_end/lib/src/fasta/parser/listener.dart |
| +++ b/pkg/front_end/lib/src/fasta/parser/listener.dart |
| @@ -4,11 +4,12 @@ |
| library fasta.parser.listener; |
| -import '../scanner/token.dart' show BeginGroupToken, Token; |
| +import '../scanner/token.dart' show BeginGroupToken, SymbolToken, Token; |
| import '../util/link.dart' show Link; |
| import 'error_kind.dart' show ErrorKind; |
| +import 'package:front_end/src/fasta/scanner/precedence.dart' show EOF_INFO; |
| import 'parser.dart' show FormalParameterType; |
| import 'identifier_context.dart' show IdentifierContext; |
| @@ -959,7 +960,8 @@ class Listener { |
| /// An unrecoverable error is an error that the parser can't recover from |
| /// itself, and recovery is left to the listener. If the listener can |
| - /// recover, it should return a non-null continuation token. Error recovery |
| + /// recover, it should return a non-null continuation token whose `next` |
| + /// pointer is the token the parser should continue from. Error recovery |
| /// is tightly coupled to the parser implementation, so to recover from an |
| /// error, one must carefully examine the code in the parser that generates |
| /// the error. |
| @@ -981,6 +983,14 @@ class Listener { |
| void handleScript(Token token) { |
| logEvent("Script"); |
| } |
| + |
| + /// Creates a new synthetic token whose `next` pointer points to [next]. |
| + /// |
| + /// If [next] is `null`, `null` is returned. |
| + Token newSyntheticToken(Token next) { |
| + if (next == null) return null; |
| + return new SymbolToken(EOF_INFO, next.charOffset)..next = next; |
|
ahe
2017/03/09 12:08:39
Should we add a new kind? I'm worried that if we m
Paul Berry
2017/03/09 21:51:21
Yes, good point. I'll take your advice and addres
|
| + } |
| } |
| class ParserError { |