liblangutil: refactors SourceReferenceFormatter error formatting for pretty and colored output.

* Refactors output format in a way it is (or should at least be) more readable.
  (NB.: As source of inspiration, I chose the rustc compiler output.)
* Adds color support to the stream output.
* Also improves multiline source formatting
  (i.e. truncating too long lines, like done with single lines already)
* solc: adds flags --color (force terminal colors) and --no-color (disable autodetection)
* solc: adds --new-reporter to give output in *new* formatting (colored or not)
* Changelog adapted accordingly.
This commit is contained in:
Christian Parpart
2019-02-07 12:55:14 +01:00
committed by chriseth
parent ef6a76ce67
commit 3d4b0f45da
7 changed files with 264 additions and 12 deletions
+8 -5
View File
@@ -44,11 +44,14 @@ public:
m_stream(_stream)
{}
virtual ~SourceReferenceFormatter() = default;
/// Prints source location if it is given.
void printSourceLocation(SourceLocation const* _location);
void printSourceLocation(SourceReference const& _ref);
void printExceptionInformation(dev::Exception const& _error, std::string const& _category);
void printExceptionInformation(SourceReferenceExtractor::Message const& _msg);
virtual void printSourceLocation(SourceReference const& _ref);
virtual void printExceptionInformation(SourceReferenceExtractor::Message const& _msg);
virtual void printSourceLocation(SourceLocation const* _location);
virtual void printExceptionInformation(dev::Exception const& _error, std::string const& _category);
static std::string formatExceptionInformation(
dev::Exception const& _exception,
@@ -62,7 +65,7 @@ public:
return errorOutput.str();
}
private:
protected:
/// Prints source name if location is given.
void printSourceName(SourceReference const& _ref);