Adding a grammar rule with conditional compilation
Hello, I'm modifying some parts of the code, and I've added a new grammar rule for creating static routes in the config.Y file. However, I would like this rule to only be enabled based on a preprocessor definition, with an #ifdef, or throw a syntax error otherwise. I can't figure out a way to do this? Any suggestions? Thank you.
On Sat, Feb 25, 2017 at 09:59:30PM +0100, Dean wrote:
Hello,
I'm modifying some parts of the code, and I've added a new grammar rule for creating static routes in the config.Y file.
However, I would like this rule to only be enabled based on a preprocessor definition, with an #ifdef, or throw a syntax error otherwise.
I can't figure out a way to do this? Any suggestions?
Hello Well, probably simplest way is to keep the rule enabled always, but fail it using cf_error() when not enabled by ifdef: RULE { #ifdef XXX action(...); #else cf_error(...); #endif } -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Dean -
Ondrej Zajicek