Allow spaces and special chars in SCSR fullname attrs by tadhurst-cdd · Pull Request #8982 · rdkit/rdkit (original) (raw)

Change suggestions were added. I added an explicit test for new template attributes including FULLNAME. This required exposing the SCSRMol, since the new attributes are not used in production of a fully atomistic mol block from an SCSR file/block. SCSRMol is also exposed in the PR for SCSRWriter.

On Mon, Dec 15, 2025 at 8:35 AM Greg Landrum ***@***.***> wrote: ***@***.**** requested changes on this pull request. Mostly trivial stuff aside from the request to add a test for the new functionality. ------------------------------ On Code/GraphMol/FileParsers/test_data/macromols/RiboseFullname.mol <#8982 (comment)>: I'd like to see a test that checks that this information is being parsed and interpreted correctly ------------------------------ In Code/GraphMol/FileParsers/SCSRMolFileParser.cpp <#8982 (comment)>: > + } + std::string res(linePtr, charCount); + linePtr += charCount; + if (*linePtr == delim) { + ++linePtr; // skip delim + } + return res; +} + +std::string getQuotedToken(const char *&linePtr) { + skipSpaces(linePtr); + std::string res; + if (*linePtr != '"') { + return res; + } + linePtr++; // skip opening quote it's like you put this in here to check to see if I was paying attention. ;-) ⬇️ Suggested change - linePtr++; // skip opening quote + ++linePtr; // skip opening quote ------------------------------ In Code/GraphMol/FileParsers/SCSRMolFileParser.cpp <#8982 (comment)>: > + linePtr++; // skip opening quote + while (*linePtr && *linePtr != '"') { + if (*linePtr == '\\') { + // escaped char + ++linePtr; + if (*linePtr == '\0') { + break; + } + } + + res += *linePtr++; + } + if (*linePtr != '"') { + res = ""; // error: no closing quote + } else { + linePtr++; // skip closing quote ⬇️ Suggested change - linePtr++; // skip closing quote + ++linePtr; // skip closing quote ------------------------------ In Code/GraphMol/FileParsers/SCSRMolFileParser.cpp <#8982 (comment)>: > + std::vectorstd::string subTokens; + + // get the class and template names from the token + + boost::algorithm::split(subTokens, token, boost::algorithm::is_any_of("/")); ⬇️ Suggested change - std::vectorstd::string subTokens; - - // get the class and template names from the token - - boost::algorithm::split(subTokens, token, boost::algorithm::is_any_of("/")); + // get the class and template names from the token + std::vectorstd::string subTokens; + boost::algorithm::split(subTokens, token, boost::algorithm::is_any_of("/")); ------------------------------ In Code/GraphMol/FileParsers/SCSRMolFileParser.cpp <#8982 (comment)>: > + const char *linePtr = lineStr.c_str() + 9; + + std::string token = getToken(linePtr, ' '); // Template ID ⬇️ Suggested change - const char *linePtr = lineStr.c_str() + 9; - - std::string token = getToken(linePtr, ' '); // Template ID + const char *linePtr = lineStr.c_str() + 9; + std::string token = getToken(linePtr, ' '); // Template ID ------------------------------ In Code/GraphMol/FileParsers/SCSRMolFileParser.cpp <#8982 (comment)>: > + std::vectorstd::string templateNames; + + for (unsigned int i = 1; i < subTokens.size(); ++i) { ⬇️ Suggested change - std::vectorstd::string templateNames; - - for (unsigned int i = 1; i < subTokens.size(); ++i) { + std::vectorstd::string templateNames; + for (unsigned int i = 1; i < subTokens.size(); ++i) { — Reply to this email directly, view it on GitHub <#8982 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/A22KQE4WL4XSQY7BDBQZGWL4B3BKTAVCNFSM6AAAAACNV4XX7CVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKNZYGQZDSNJUHA> . You are receiving this because you authored the thread.Message ID: ***@***.***> ------------------------------ This email has been scanned for spam and viruses by Proofpoint Essentials. Click here <https://us5.proofpointessentials.com/app/report_spam.php?mod_id=11&mod_option=logitem&report=1&type=easyspam&k=k1&payload=53616c7465645f5f5efb009115252f17296c1d1746f41e1fbf05a2de6e2411c3f1ba8a2f3f2733be95edd77952be0988d18facc9ef2a9ab2fcd85bcf1aff8198eeabc328b5bdcc7a6921c9ccccd698b98f2c8fe328c556b04b72da56b8b910b3f5d7488e96bb836648eeb90cb1562c6b75d8fb1bcba284be29d76858398b3c32349d15a41fccd9657eff404ca59f6bfc5b1e38cfabda0f5b90ae7662ad2174e6> to report this email as spam.