Fix ShowCodeFragment column numbers.

Refs #5893
This commit is contained in:
Gunnar Beutner 2014-03-31 12:44:18 +02:00
parent 79a7a0be92
commit b924941488
2 changed files with 5 additions and 2 deletions

View File

@ -34,8 +34,6 @@ using namespace icinga;
do { \ do { \
yylloc->Path = yyextra->GetPath(); \ yylloc->Path = yyextra->GetPath(); \
yylloc->FirstLine = yylineno; \ yylloc->FirstLine = yylineno; \
if (yycolumn < 1) \
yycolumn = 1; \
yylloc->FirstColumn = yycolumn; \ yylloc->FirstColumn = yycolumn; \
yylloc->LastLine = yylineno; \ yylloc->LastLine = yylineno; \
yylloc->LastColumn = yycolumn + yyleng - 1; \ yylloc->LastColumn = yycolumn + yyleng - 1; \

View File

@ -94,6 +94,11 @@ void icinga::ShowCodeFragment(std::ostream& out, const DebugInfo& di, bool verbo
if (lineno == di.LastLine) if (lineno == di.LastLine)
end = di.LastColumn; end = di.LastColumn;
if (start < 0) {
end -= start;
start = 0;
}
out << String(pathInfo.GetLength(), ' '); out << String(pathInfo.GetLength(), ' ');
out << String(start, ' '); out << String(start, ' ');
out << String(end - start, '^'); out << String(end - start, '^');