Open nalvarezdiaz opened 6 months ago
This is not a supported feature according to https://nearley.js.org/docs/grammar#macros
Macros are expanded at compile time and inserted in places they are used. They are not “real” rules. Therefore, macros cannot be recursive (
nearleyc
will go into an infinite loop trying to expand the macro-loop).
Hello,
I'm creating a grammar which includes 2 expressions for creating unions and intersections. Initially, I've created a static version of these joins but I'm using the same strategy for multiple "primitives". So, I've checked docs and macros are key to avoid duplicating all that code.
The code below is the reproduction of the issue and not my real use case which is bigger and difficult to follow.
I'll expect from that grammar above be able to write expressions like:
foo test bar test bar test
foo help foo help
However, it does not compile because it is trying to solve macros recursively. This is the error
I'm interested in know if it is a not supported featured. In that case, it could be great to support them.
Thanks in advance.