mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 13:00:17 +00:00
a small fix
This commit is contained in:
parent
fa3e46bc46
commit
4c27b5210b
@ -44,7 +44,9 @@ struct SourceMetadata {
|
|||||||
_Str snapshot(int lineno){
|
_Str snapshot(int lineno){
|
||||||
_StrStream ss;
|
_StrStream ss;
|
||||||
ss << " " << "File \"" << filename << "\", line " << lineno << '\n';
|
ss << " " << "File \"" << filename << "\", line " << lineno << '\n';
|
||||||
ss << " " << getLine(lineno) << '\n';
|
_Str line = getLine(lineno).__lstrip();
|
||||||
|
if(line.empty()) line = "<?>";
|
||||||
|
ss << " " << line << '\n';
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -121,6 +121,14 @@ public:
|
|||||||
operator const char*() const {
|
operator const char*() const {
|
||||||
return _s.c_str();
|
return _s.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Str __lstrip() const {
|
||||||
|
std::string copy(_s);
|
||||||
|
copy.erase(copy.begin(), std::find_if(copy.begin(), copy.end(), [](char c) {
|
||||||
|
return !std::isspace(c);
|
||||||
|
}));
|
||||||
|
return _Str(copy);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user