pest icon indicating copy to clipboard operation
pest copied to clipboard

grammar path troubling for arbitrary project structures

Open sphinxc0re opened this issue 6 years ago • 3 comments

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.

sphinxc0re avatar Aug 30 '17 19:08 sphinxc0re

Unfortunately, this is not currently possible due to the fact that procedural macros do not know which file is currently compiling.

dragostis avatar Aug 31 '17 06:08 dragostis

But there is a line!() macro. Isn't there a file!() macro?

sphinxc0re avatar Aug 31 '17 11:08 sphinxc0re

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.

dragostis avatar Sep 03 '17 06:09 dragostis