Adding a grammar rule with conditional compilation

Ondrej Zajicek santiago at crfreenet.org
Tue Feb 28 01:41:13 CET 2017


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 at 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."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20170228/80b222e3/attachment.asc>


More information about the Bird-users mailing list