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

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

Issue 2777153002: move synthetic fasta closers into the token stream (Closed)
Patch Set: rebase Created 3 years, 9 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 | pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart » ('j') | 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 f98242cda29804f83b275aafc50dd5767b6e0a78..5e4f34518739517d5d057bd244bcaad369932c36 100644
--- a/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart
@@ -11,7 +11,7 @@ import 'dart:typed_data' show Uint16List, Uint32List;
import '../scanner.dart'
show ErrorToken, Scanner, buildUnexpectedCharacterToken;
-import 'error_token.dart' show UnmatchedToken, UnterminatedToken;
+import 'error_token.dart' show UnterminatedToken;
import 'keyword.dart' show KeywordState, Keyword;
@@ -1116,57 +1116,6 @@ abstract class AbstractScanner implements Scanner {
return -1;
}
}
-
- void unmatchedBeginGroup(BeginGroupToken begin) {
- // We want to ensure that unmatched BeginGroupTokens are reported as
- // errors. However, the diet parser assumes that groups are well-balanced
- // and will never look at the endGroup token. This is a nice property that
- // allows us to skip quickly over correct code. By inserting an additional
- // synthetic token in the stream, we can keep ignoring endGroup tokens.
- //
- // [begin] --next--> [tail]
- // [begin] --endG--> [synthetic] --next--> [next] --next--> [tail]
- //
- // This allows the diet parser to skip from [begin] via endGroup to
- // [synthetic] and ignore the [synthetic] token (assuming it's correct),
- // then the error will be reported when parsing the [next] token.
- //
- // For example, tokenize("{[1};") produces:
- //
- // SymbolToken({) --endGroup-----+
- // | |
- // next |
- // v |
- // SymbolToken([) --endGroup--+ |
- // | | |
- // next | |
- // v | |
- // StringToken(1) | |
- // | v |
- // next SymbolToken(]) | <- Synthetic token.
- // | | |
- // | next |
- // v | |
- // UnmatchedToken([)<---------+ |
- // | |
- // next |
- // v |
- // SymbolToken(})<---------------+
- // |
- // next
- // v
- // SymbolToken(;)
- // |
- // next
- // v
- // EOF
- Token synthetic =
- new SymbolToken(closeBraceInfoFor(begin), begin.charOffset);
- UnmatchedToken next = new UnmatchedToken(begin);
- begin.endGroup = synthetic;
- synthetic.next = next;
- appendErrorToken(next);
- }
}
PrecedenceInfo closeBraceInfoFor(BeginGroupToken begin) {
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698