Skip to content

Commit

Permalink
minor improvement for parsing of backslash in lexemes
Browse files Browse the repository at this point in the history
  • Loading branch information
ldn-softdev committed May 11, 2020
1 parent 5e3c030 commit a56d2b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jtc.cpp
Expand Up @@ -2646,7 +2646,7 @@ void Jtc::walk_interleaved_(wlk_subscr Jtc::* subscriber) {
}
hwlk_ = move(ARY{STR{}}); // reset hwlk_ to init value
// json.ns() may hold now the latest updated namespace while wns_ might not even have been
// updated (e.g. when walk has ended as <>F, or out of iterations), thus require syncing
// updated (e.g.: when walk has ended as <>F, or out of iterations), thus require syncing
wns_[last_dwi_ptr_].sync_in(json().ns(), map_jnse::NsOpType::NsUpdate);

is_multi_walk_ = opt()[CHR(OPT_WLK)].hits() > 1 or // i.e. -w.. -w.., else (one -w..)
Expand Down
3 changes: 2 additions & 1 deletion lib/Json.hpp
Expand Up @@ -3529,7 +3529,8 @@ std::string Json::extract_lexeme_(std::string::const_iterator &si, char closing)
std::string quoted{"\\"}; // replace quoted closing bracket
quoted += closing;
for(size_t p = lexeme.find(quoted); p != std::string::npos; p = lexeme.find(quoted, p))
lexeme.replace(p, 2, 1, closing);
if(p + quoted.size() >= lexeme.size()) break; // replace only if it's not last
else lexeme.replace(p, 2, 1, closing);
DBG(1) DOUT() << "parsed lexeme: " << lexeme << std::endl;
return lexeme;
}
Expand Down

0 comments on commit a56d2b7

Please sign in to comment.