aboutsummaryrefslogtreecommitdiffstats
path: root/SourceReferenceFormatter.cpp
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@gmail.com>2015-03-02 10:10:19 +0800
committerLu Guanqun <guanqun.lu@gmail.com>2015-03-02 12:35:54 +0800
commit3da8b040375a9ff28f5b2c99d4fe95fb9f70f797 (patch)
tree0d3c0e26c8e394ac7628e17df4045e54985550b9 /SourceReferenceFormatter.cpp
parenta5b4f18dd7291e403237061d5f9660db0299601d (diff)
downloaddexon-solidity-3da8b040375a9ff28f5b2c99d4fe95fb9f70f797.tar
dexon-solidity-3da8b040375a9ff28f5b2c99d4fe95fb9f70f797.tar.gz
dexon-solidity-3da8b040375a9ff28f5b2c99d4fe95fb9f70f797.tar.bz2
dexon-solidity-3da8b040375a9ff28f5b2c99d4fe95fb9f70f797.tar.lz
dexon-solidity-3da8b040375a9ff28f5b2c99d4fe95fb9f70f797.tar.xz
dexon-solidity-3da8b040375a9ff28f5b2c99d4fe95fb9f70f797.tar.zst
dexon-solidity-3da8b040375a9ff28f5b2c99d4fe95fb9f70f797.zip
let the error output take tab into consideration
Diffstat (limited to 'SourceReferenceFormatter.cpp')
-rw-r--r--SourceReferenceFormatter.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/SourceReferenceFormatter.cpp b/SourceReferenceFormatter.cpp
index 489a676e..b5e83b8c 100644
--- a/SourceReferenceFormatter.cpp
+++ b/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)