Chromium Code Reviews| Index: pkg/testing/lib/src/analyze.dart |
| diff --git a/pkg/testing/lib/src/analyze.dart b/pkg/testing/lib/src/analyze.dart |
| index 0a41a57ecf186d0d5761f60cc117076eaf2518bc..6d92e07872917399d61034ce469c29248538e04b 100644 |
| --- a/pkg/testing/lib/src/analyze.dart |
| +++ b/pkg/testing/lib/src/analyze.dart |
| @@ -68,19 +68,37 @@ class AnalyzerDiagnostic { |
| final String message; |
| + static final Pattern unescapePattern = new RegExp(r"\\(.)"); |
| + |
| AnalyzerDiagnostic(this.kind, this.detailedKind, this.code, this.uri, |
| this.line, this.startColumn, this.endColumn, this.message); |
| factory AnalyzerDiagnostic.fromLine(String line) { |
| - List<String> parts = line.split("|"); |
| + List<String> parts = <String>[]; |
| + int start = 0; |
| + int index = line.indexOf("|"); |
| + while (index != -1) { |
| + if (index > 0 && line[index - 1] == "\\") { |
|
ahe
2017/04/19 04:05:28
This is not correct for cases like this:
\\|
|
| + index = line.indexOf("|", index + 1); |
| + } else { |
| + parts.add(line |
| + .substring(start, index) |
| + .replaceAllMapped(unescapePattern, (Match m) => m[1])); |
| + start = index + 1; |
| + index = line.indexOf("|", start); |
| + } |
| + } |
| + parts.add(line |
| + .substring(start) |
| + .replaceAllMapped(unescapePattern, (Match m) => m[1])); |
| if (parts.length != 8) { |
| - throw "Malformed output: $line"; |
| + throw "Malformed output: $line $parts"; |
| } |
| return new AnalyzerDiagnostic( |
| parts[0], |
| parts[1], |
| parts[2], |
| - Uri.base.resolve(parts[3]), |
| + Uri.base.resolveUri(new Uri.file(parts[3])), |
| int.parse(parts[4]), |
| int.parse(parts[5]), |
| int.parse(parts[6]), |
| @@ -88,7 +106,7 @@ class AnalyzerDiagnostic { |
| } |
| String toString() { |
| - return "$uri:$line:$startColumn: " |
| + return "${uri.toFilePath()}:$line:$startColumn: " |
| "${kind == 'INFO' ? 'warning: hint' : kind.toLowerCase()}:\n" |
| "[$code] $message"; |
| } |