Fix command error line/column reporting
This commit is contained in:
parent
ac28f2b47b
commit
62b4780e07
|
@ -92,11 +92,25 @@ Reader& Reader::operator++()
|
||||||
{
|
{
|
||||||
kak_assert(pos < str.end());
|
kak_assert(pos < str.end());
|
||||||
if (*pos == '\n')
|
if (*pos == '\n')
|
||||||
|
{
|
||||||
++line;
|
++line;
|
||||||
|
line_start = ++pos;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
utf8::to_next(pos, str.end());
|
utf8::to_next(pos, str.end());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Reader::next_byte()
|
||||||
|
{
|
||||||
|
kak_assert(pos < str.end());
|
||||||
|
if (*pos++ == '\n')
|
||||||
|
{
|
||||||
|
++line;
|
||||||
|
line_start = pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -152,10 +166,10 @@ QuotedResult parse_quoted_balanced(Reader& reader, char opening_delimiter,
|
||||||
else if (c == closing_delimiter and level-- == 0)
|
else if (c == closing_delimiter and level-- == 0)
|
||||||
{
|
{
|
||||||
auto content = reader.substr_from(start);
|
auto content = reader.substr_from(start);
|
||||||
++reader.pos;
|
reader.next_byte();
|
||||||
return {String{String::NoCopy{}, content}, true};
|
return {String{String::NoCopy{}, content}, true};
|
||||||
}
|
}
|
||||||
++reader.pos;
|
reader.next_byte();
|
||||||
}
|
}
|
||||||
return {String{String::NoCopy{}, reader.substr_from(start)}, false};
|
return {String{String::NoCopy{}, reader.substr_from(start)}, false};
|
||||||
}
|
}
|
||||||
|
@ -179,7 +193,7 @@ String parse_unquoted(Reader& reader)
|
||||||
else
|
else
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
++reader.pos;
|
reader.next_byte();
|
||||||
}
|
}
|
||||||
if (beg < reader.str.end())
|
if (beg < reader.str.end())
|
||||||
str += reader.substr_from(beg);
|
str += reader.substr_from(beg);
|
||||||
|
|
|
@ -69,6 +69,7 @@ public:
|
||||||
Codepoint operator*() const;
|
Codepoint operator*() const;
|
||||||
Codepoint peek_next() const;
|
Codepoint peek_next() const;
|
||||||
Reader& operator++();
|
Reader& operator++();
|
||||||
|
void next_byte();
|
||||||
|
|
||||||
explicit operator bool() const { return pos < str.end(); }
|
explicit operator bool() const { return pos < str.end(); }
|
||||||
StringView substr_from(const char* start) const { return {start, pos}; }
|
StringView substr_from(const char* start) const { return {start, pos}; }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user