From 6045f1d23ad16946fa77243fc3d535257f87a507 Mon Sep 17 00:00:00 2001 From: Lu Guanqun Date: Sun, 1 Mar 2015 20:10:19 -0600 Subject: [PATCH] let the error output take tab into consideration --- libsolidity/SourceReferenceFormatter.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libsolidity/SourceReferenceFormatter.cpp b/libsolidity/SourceReferenceFormatter.cpp index 489a676ed..b5e83b8c9 100644 --- a/libsolidity/SourceReferenceFormatter.cpp +++ b/libsolidity/SourceReferenceFormatter.cpp @@ -44,8 +44,14 @@ void SourceReferenceFormatter::printSourceLocation(ostream& _stream, tie(endLine, endColumn) = _scanner.translatePositionToLineColumn(_location.end); if (startLine == endLine) { - _stream << _scanner.getLineAtPosition(_location.start) << endl - << string(startColumn, ' ') << "^"; + string line = _scanner.getLineAtPosition(_location.start); + _stream << line << endl; + std::for_each(line.cbegin(), line.cbegin() + startColumn, + [&_stream](char const& ch) + { + _stream << (ch == '\t' ? '\t' : ' '); + }); + _stream << "^"; if (endColumn > startColumn + 2) _stream << string(endColumn - startColumn - 2, '-'); if (endColumn > startColumn + 1)