Skip to content
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

Expression.parse("'\\n'") fails #32

Closed
nighthawk opened this issue Jul 23, 2021 · 2 comments · Fixed by #33
Closed

Expression.parse("'\\n'") fails #32

nighthawk opened this issue Jul 23, 2021 · 2 comments · Fixed by #33

Comments

@nighthawk
Copy link
Contributor

nighthawk commented Jul 23, 2021

I've hit a funny little bug with this excellent library. I'm trying to evaluate an expression such as AnyExpression.parse(var1 + "'\\n'" + var2, ...), but this fails with an unexpectedToken("\\n\'"). If I modify it slightly to ``AnyExpression.parse(var1 + "' \n'" + var2, ...)` it works -- notice the additional space.

The simplest way to reproduce this is Expression.parse("'\\n'").

It seems to be an issue with parseEscapedIdentifier and in particular this line:

while let part = scanCharacters({ $0 != delimiter && $0 != "\\" }) {

Unfortunately this implementation is going a bit over my head, so I haven't yet figured out how to fix this. Any advice would be much appreciated.

@nighthawk nighthawk changed the title Expression.parse("'\\n Expression.parse("'\\n'") fails Jul 23, 2021
@nighthawk
Copy link
Contributor Author

Solved it in the referenced PR.

@nicklockwood
Copy link
Owner

@nighthawk I've included your fix in 0.13.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants