Skip to content

Commit

Permalink
Merge pull request #596 from trueagi-io/escape
Browse files Browse the repository at this point in the history
add escape seq to fast_load
  • Loading branch information
besSveta authored Feb 22, 2024
2 parents 40088e1 + f5de873 commit 02fc0c2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions python/hyperonpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1011,10 +1011,16 @@ PYBIND11_MODULE(hyperonpy, m) {
std::vector<atom_t> children;
std::string str = "";
int depth = 0;
bool isescape = false;
while(f) {
char c = f.get();
bool isspace = std::isspace(c);
if(isspace or c == '(' or c == ')') {
if(isescape) {
str += c;
isescape = false;
continue;
}
if((isspace or c == '(' or c == ')')) {
if(c == ')' and depth == 0) {
// ignore for now --> exception
continue;
Expand Down Expand Up @@ -1066,7 +1072,11 @@ PYBIND11_MODULE(hyperonpy, m) {
}
}
} else {
str += c;
if(c == '\\') {
isescape = true;
} else {
str += c;
}
}
}
return true;
Expand Down

0 comments on commit 02fc0c2

Please sign in to comment.