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

Unified Diff: dart/lib/compiler/implementation/scanner/scanner.dart

Issue 10544173: Update partial parser and scanner to be able to skip expressions like "new Map<S, T>()". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments and add comments Created 8 years, 6 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 | « dart/lib/compiler/implementation/scanner/partial_parser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/implementation/scanner/scanner.dart
diff --git a/dart/lib/compiler/implementation/scanner/scanner.dart b/dart/lib/compiler/implementation/scanner/scanner.dart
index 2dd4d38891b8ceed534189afce0409ad42be88c2..c6c5f2fd28af96c0540e3d974f7e5432a49d47a5 100644
--- a/dart/lib/compiler/implementation/scanner/scanner.dart
+++ b/dart/lib/compiler/implementation/scanner/scanner.dart
@@ -33,6 +33,13 @@ class AbstractScanner<T extends SourceString> implements Scanner {
abstract void appendGt(PrecedenceInfo info, String value);
abstract void appendGtGt(PrecedenceInfo info, String value);
abstract void appendGtGtGt(PrecedenceInfo info, String value);
+
+ /**
+ * We call this method to discard '<' from the "grouping" stack
+ * (maintained by subclasses). That we don't create groups for stuff
+ * like "a = b < c, d = e > f" is used by
+ * [PartialParser.skipExpression].
+ */
Lasse Reichstein Nielsen 2012/06/15 13:59:14 So you call this when you recognize something that
ahe 2012/06/19 11:02:42 Done.
abstract void discardOpenLt();
// TODO(ahe): Move this class to implementation.
@@ -143,6 +150,7 @@ class AbstractScanner<T extends SourceString> implements Scanner {
if (next === $SEMICOLON) {
appendPrecedenceToken(SEMICOLON_INFO);
+ // Type parameters and arguments cannot contain semicolon.
discardOpenLt();
return advance();
}
@@ -341,6 +349,11 @@ class AbstractScanner<T extends SourceString> implements Scanner {
int tokenizeEquals(int next) {
// = == ===
+
+ // Type parameters and arguments cannot contain any token that
+ // starts with '='.
+ discardOpenLt();
+
next = advance();
if (next === $EQ) {
return select($EQ, EQ_EQ_EQ_INFO, EQ_EQ_INFO);
« no previous file with comments | « dart/lib/compiler/implementation/scanner/partial_parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698