Use endl instead of "\n".

This commit is contained in:
Christian 2014-10-24 16:47:10 +02:00
parent f8038792ca
commit 33babb0c6f
2 changed files with 7 additions and 7 deletions

View File

@ -406,7 +406,7 @@ void ASTPrinter::printSourcePart(ASTNode const& _node)
{ {
Location const& location(_node.getLocation()); Location const& location(_node.getLocation());
*m_ostream << getIndentation() << " Source: |" *m_ostream << getIndentation() << " Source: |"
<< m_source.substr(location.start, location.end - location.start) << "|\n"; << m_source.substr(location.start, location.end - location.start) << "|" << std::endl;
} }
} }
@ -417,7 +417,7 @@ std::string ASTPrinter::getIndentation() const
void ASTPrinter::writeLine(std::string const& _line) void ASTPrinter::writeLine(std::string const& _line)
{ {
*m_ostream << getIndentation() << _line << '\n'; *m_ostream << getIndentation() << _line << std::endl;
} }
} }

View File

@ -42,16 +42,16 @@ void SourceReferenceFormatter::printSourceLocation(std::ostream& _stream,
std::tie(endLine, endColumn) = _scanner.translatePositionToLineColumn(_location.end); std::tie(endLine, endColumn) = _scanner.translatePositionToLineColumn(_location.end);
if (startLine == endLine) if (startLine == endLine)
{ {
_stream << _scanner.getLineAtPosition(_location.start) << "\n" _stream << _scanner.getLineAtPosition(_location.start) << std::endl
<< std::string(startColumn, ' ') << "^"; << std::string(startColumn, ' ') << "^";
if (endColumn > startColumn + 2) if (endColumn > startColumn + 2)
_stream << std::string(endColumn - startColumn - 2, '-'); _stream << std::string(endColumn - startColumn - 2, '-');
if (endColumn > startColumn + 1) if (endColumn > startColumn + 1)
_stream << "^"; _stream << "^";
_stream << "\n"; _stream << std::endl;
} }
else else
_stream << _scanner.getLineAtPosition(_location.start) << "\n" _stream << _scanner.getLineAtPosition(_location.start) << std::endl
<< std::string(startColumn, ' ') << "^\n" << std::string(startColumn, ' ') << "^\n"
<< "Spanning multiple lines.\n"; << "Spanning multiple lines.\n";
} }
@ -63,8 +63,8 @@ void SourceReferenceFormatter::printSourcePosition(std::ostream& _stream,
int line; int line;
int column; int column;
std::tie(line, column) = _scanner.translatePositionToLineColumn(_position); std::tie(line, column) = _scanner.translatePositionToLineColumn(_position);
_stream << "at line " << (line + 1) << ", column " << (column + 1) << "\n" _stream << "at line " << (line + 1) << ", column " << (column + 1) << std::endl
<< _scanner.getLineAtPosition(_position) << "\n" << _scanner.getLineAtPosition(_position) << std::endl
<< std::string(column, ' ') << "^" << std::endl; << std::string(column, ' ') << "^" << std::endl;
} }