pest
pest copied to clipboard
grammar path troubling for arbitrary project structures
As seen here, the pest derive macro is assuming that the project using it follows the default cargo file structure. https://github.com/pest-parser/pest/blob/2dc5e40ee190964400efe748bd73f75fcc7c7690/pest_derive/src/lib.rs#L210 I would suggest searching for the grammar in relation to the file where the grammar is automatically implemented.
Unfortunately, this is not currently possible due to the fact that procedural macros do not know which file is currently compiling.
But there is a line!()
macro. Isn't there a file!()
macro?
Unfortunately, no. Even if there was, you wouldn't be able to call it from a procedural macro. What is needed is a more mature procedural macro API.