Fix sexpr_text_length function to handle quotation in string
This commit is contained in:
parent
9516d9f88f
commit
635407ca4a
1 changed files with 6 additions and 1 deletions
|
@ -82,7 +82,12 @@ private:
|
||||||
static inline size_t const sexpr_text_length(sexpr const & s) {
|
static inline size_t const sexpr_text_length(sexpr const & s) {
|
||||||
lean_assert(sexpr_kind(s) == format_kind::TEXT);
|
lean_assert(sexpr_kind(s) == format_kind::TEXT);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << cdr(s);
|
sexpr const & content = cdr(s);
|
||||||
|
if(is_string(content)) {
|
||||||
|
ss << to_string(content);
|
||||||
|
} else {
|
||||||
|
ss << content;
|
||||||
|
}
|
||||||
return ss.str().length();
|
return ss.str().length();
|
||||||
}
|
}
|
||||||
static inline sexpr sexpr_text(std::string const & s) {
|
static inline sexpr sexpr_text(std::string const & s) {
|
||||||
|
|
Loading…
Reference in a new issue