softdevteam / grmtools

Rust grammar tool libraries and binaries
Other
517 stars 31 forks source link

Give the parser a variable #469

Closed Lurgrid closed 3 months ago

Lurgrid commented 3 months ago

Hello,

I have a small question: is it possible to send data (such as a parameter to parse()) to the parser so that it can be accessed in the “Yacc” file? After reading the documentation and the book, I don't see any way of doing this “cleanly”. You could use a static variable, but that wouldn't be thread-safe.

If this really isn't possible right now, it might be a good idea to add it, as it would open up a whole new range of possibilities.

ratmice commented 3 months ago

It sounds like the %parse-param directive is what you are looking for, if the data you want to pass is Copy.

Lurgrid commented 3 months ago

I think I'm blind, I didn't see it.

Sorry to have bothered you for nothing