Chromium Code Reviews| 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; |