-
Notifications
You must be signed in to change notification settings - Fork 109
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
Cannot include #
character in a "raw string"
#234
Comments
While doing more tests I found that adding a newline after the hash character avoids the failure which suggests the issue is with the parser confusing this with a So, this fails:
But this doesn't, yet it returns an empty string as a result which validates my assumption:
|
Using https://pest.rs I tried validating my assumption but according to the latest pest file even adding a newline should fail. The case of an empty raw string Now when adding Adding the newline does not change the tool result Hope this helps. Unfortuntely I am not very good with Rust yet and not familiar with pest at all to find a solution to contribute. |
LINE_COMMENT rule was changes to match the SOI first, otherwise any raw string containing `#` will be considered a LINE_COMMENT
I've extracted the related rules into a fiddle that shows how this fails. |
So I managed to fix the issue at the PEG level. The change consists in making the A fiddle here showing that it works. I made the change in my fork. However, when I am pulling it from another project (my cozo binding for Erlang) , I still get the same error when running I check Rust is compiling my fork and latest commit as shown below
Could it be the case that the pest file has not produced any change on the parser? I am new to RUST and @zh217 Any ideas here? |
Sorry, I'm not entirely sure, but that's included here: cozo/cozo-core/src/parse/mod.rs Line 39 in 8b1b60c
It's a derive macro, which gets automatically run during normal complication. It looks like pest_derive also accounts for external files changing (per pest-parser/pest#789). So basically there should be no extra work required aside from changing that file. And that log looks pretty clear, but you might be able to use (And thanks to this issue for teaching me that cozo supports comments! It doesn't appear to be documented when I looked) |
The only solution in the meantime is to pass the values separately and not interpolate anything. But still, this needs fixing. |
The presence of a single
#
character in any raw string will casue the query parser to fail.The following example fails with reason
The query parser has encountered unexpected input / end of input at 17..17
Just removing the
#
char makes it work.I am using Cozo Rust library version
0.7.5
The text was updated successfully, but these errors were encountered: