liblangutil: refactor SourceReferenceFormatter, splitting out retrieval and making use of new SourceLocation's CharStream knowledge

This commit is contained in:
Christian Parpart
2018-12-06 14:01:01 +01:00
committed by chriseth
parent 6efe2a5266
commit 073b03d90c
16 changed files with 234 additions and 126 deletions
+4 -4
View File
@@ -67,9 +67,9 @@ namespace po = boost::program_options;
class YulOpti
{
public:
void printErrors(Scanner const& _scanner)
void printErrors()
{
SourceReferenceFormatter formatter(cout, [&](string const&) -> Scanner const& { return _scanner; });
SourceReferenceFormatter formatter(cout);
for (auto const& error: m_errors)
formatter.printExceptionInformation(
@@ -86,7 +86,7 @@ public:
if (!m_ast || !errorReporter.errors().empty())
{
cout << "Error parsing source." << endl;
printErrors(*scanner);
printErrors();
return false;
}
m_analysisInfo = make_shared<yul::AsmAnalysisInfo>();
@@ -100,7 +100,7 @@ public:
if (!analyzer.analyze(*m_ast) || !errorReporter.errors().empty())
{
cout << "Error analyzing source." << endl;
printErrors(*scanner);
printErrors();
return false;
}
return true;