New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing Escaped Strings in the Sparql Parser #300
Conversation
…class and started testing it.
TODO: The method is not the most efficient, so we can as well make it safe.
TODO: test that illegal inputs always throw and never segfault.
…for the regex engine.
const std::string SparqlLexer::WS = "(\\x20|\\x09|\\x0D|\\x0A)"; | ||
const std::string SparqlLexer::ECHAR = "\\\\[tbnrf\"']"; | ||
const std::string SparqlLexer::WS = R"((\x20|\x09|\x0D|\x0A))"; | ||
const std::string SparqlLexer::ECHAR = R"(\\[tbnrf\\"'])"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first of those lines is just a reformatting.
In the second line their were two backslashes missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for this, I'm betting this caused quite a headache to figure out
Previously, Regex Filters that contained Escape Sequences were neither handled correct
by the Lexer nor by the Parser (see #296). This PR fixes these bugs.
It implements a function to unify the different ways to specify Strings in Sparql/Turtle (" with escapes versus """ without escapes) to a form, that performs unescaping of
\t \n \\\"
...Currently, the handling of strings that contain escaped characters is also wrong in the turtle Parser.
However to fix this, we require some more changes since the serialization of the vocabulary has to be changed as soon as the vocabulary elements may contain
\n
characters. So I would recommend first merging this and then using it as a base for the other fix.