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

Unified Diff: dart/frog/leg/tools/mini_parser.dart

Issue 9158001: Better error recovery. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/frog/leg/tools/find_file_to_parse.sh ('k') | dart/tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/tools/mini_parser.dart
diff --git a/dart/frog/leg/tools/mini_parser.dart b/dart/frog/leg/tools/mini_parser.dart
index bd05ae83b071827357afce189604d0c7df9feda3..7cbacae1fc5022f37a81ee95063b686e9001a392 100644
--- a/dart/frog/leg/tools/mini_parser.dart
+++ b/dart/frog/leg/tools/mini_parser.dart
@@ -17,6 +17,7 @@ int charCount = 0;
Stopwatch stopwatch;
void main() {
+ filesWithCrashes = [];
stopwatch = new Stopwatch();
MyOptions options = new MyOptions();
@@ -33,7 +34,7 @@ void main() {
print('Parsed $stats.');
}
if (filesWithCrashes.length !== 0) {
- print('The following files caused a crash:');
+ print('The following ${filesWithCrashes.length} files caused a crash:');
for (String file in filesWithCrashes) {
print(file);
}
@@ -66,7 +67,7 @@ void main() {
return;
}
stopwatch.start();
- charCount += parseFile(argument, options);
+ parseFile(argument, options);
stopwatch.stop();
}
@@ -126,7 +127,6 @@ Token scan(MySourceFile source) {
var filesWithCrashes;
void parseFilesFrom(InputStream input, MyOptions options, Function whenDone) {
- filesWithCrashes = [];
void readLine(String line) {
stopwatch.start();
try {
@@ -190,13 +190,13 @@ class MyListener extends Listener {
}
void error(String message, Token token) {
- ++errorCount;
- throw new ParserError(formatError(message, beginToken, endToken, file));
+ throw new ParserError(formatError(message, token, token, file));
}
}
void formatError(String message, Token beginToken, Token endToken,
SourceFile file) {
+ ++errorCount;
if (beginToken === null) return '${file.filename}: $message';
String tokenString = endToken.toString();
int begin = beginToken.charOffset;
« no previous file with comments | « dart/frog/leg/tools/find_file_to_parse.sh ('k') | dart/tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698