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

Unified Diff: runtime/vm/scanner.cc

Issue 8586052: Better error handling when scanning library tags (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month 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 | « runtime/vm/scanner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scanner.cc
===================================================================
--- runtime/vm/scanner.cc (revision 1660)
+++ runtime/vm/scanner.cc (working copy)
@@ -313,17 +313,27 @@
}
+void Scanner::SkipLine() {
+ while (c0_ != '\n' && c0_ != '\0') {
+ ReadChar();
+ }
+}
+
+
void Scanner::ScanLibraryTag() {
ReadChar();
if (c0_ == '!') {
+ Recognize(Token::kSCRIPTTAG);
// The script tag extends to the end of the line. Just treat this
// similar to a line comment.
- while (c0_ != '\n' && c0_ != '\0') {
- ReadChar();
- }
- Recognize(Token::kSCRIPTTAG);
+ SkipLine();
return;
}
+ if (!IsIdentStartChar(c0_)) {
+ ErrorMsg("Unrecognized library tag");
+ SkipLine();
+ return;
+ }
const String& kLibrary = String::Handle(String::NewSymbol("library"));
const String& kImport = String::Handle(String::NewSymbol("import"));
const String& kSource = String::Handle(String::NewSymbol("source"));
@@ -341,6 +351,7 @@
return;
}
ErrorMsg("Unrecognized library token");
+ SkipLine();
}
« no previous file with comments | « runtime/vm/scanner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698