Replies: 1 comment
-
I've created a repo which replicates your issue and then gives a hint of where to go. https://github.com/rob-mur/pest-521 If you run this code you'll see that it prints out the string node you are trying to parse, which you will see has no inners. This means that string_node.clone().into_inner() is empty and so line 21-26 are essentially not called, leading to the empty string being returned. After you work it out, I recommend using https://crates.io/crates/pest_consume to avoid this kinds of errors in future. Also, reading https://pest.rs/book/grammars/syntax.html to try and simplify your grammar as there is built in functionality to deal with whitespace. Shout if you are still stuck. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm currently playing around with the library, and for testing purposes my grammar only consists of a String.
With the following code:
However, instead of returning
[Str("Hello world")]
when I run my code it returns just an empty Rule:Also, although the code runs, rust-analyzer complains that the proc-macro server crashed, not allowing the Parser macro to expand. Whether or not I enable such feature, the warning as well as the code output is the same. I suspect this might be the root of the problem? Any advice would be deeply appreciated.
Beta Was this translation helpful? Give feedback.
All reactions