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

Unified Diff: compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java

Issue 9479034: Update test.dart for detection output of machine formatted errors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update test.dart for detection output of machine formatted errors Created 8 years, 10 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
Index: compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
diff --git a/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java b/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
index f8ac492f35abbe98ae49f486d2b6f5f70df25eae..e964e4327511ba50df346db4d13e728ea8464b5b 100644
--- a/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
+++ b/compiler/java/com/google/dart/compiler/PrettyErrorFormatter.java
@@ -87,15 +87,15 @@ public class PrettyErrorFormatter extends DefaultErrorFormatter {
}
if (errorFormat == ErrorFormat.MACHINE) {
buf.append(String.format(
- "%s:%s:%s:%s:%d:%d:%d: %s",
- event.getErrorCode().getErrorSeverity(),
- event.getErrorCode().getSubSystem(),
- event.getErrorCode(),
- sourceFile.getName(),
+ "%s|%s|%s|%s|%d|%d|%d|%s",
+ escapePipe(event.getErrorCode().getErrorSeverity().toString()),
+ escapePipe(event.getErrorCode().getSubSystem().toString()),
+ escapePipe(event.getErrorCode().toString()),
+ escapePipe(sourceFile.getName()),
event.getLineNumber(),
1 + col,
length,
- event.getMessage()));
+ escapePipe(event.getMessage())));
} else {
String sourceName = sourceFile.getUri().toString();
String includeFrom = getImportString(sourceFile);
@@ -154,6 +154,17 @@ public class PrettyErrorFormatter extends DefaultErrorFormatter {
}
}
+ private String escapePipe(String input) {
+ StringBuffer result = new StringBuffer();
scheglov 2012/02/28 23:59:29 AFAIK it is better to use StringBuilder if only on
zundel 2012/02/29 08:11:40 Done.
+ for (char c : input.toCharArray()) {
+ if (c == '\\' || c == '|') {
+ result.append('\\');
+ }
+ result.append(c);
+ }
+ return result.toString();
+ }
+
private String getLineAt(BufferedReader reader, int line) throws IOException {
if (line <= 0) {
return null;

Powered by Google App Engine
This is Rietveld 408576698