[PATCH] Add symbol support for various string options
Hello, during some bird config optimizations (redundancy reductions) we noticed that various string options doesn't accept symbols as value. Attached you find a patch which fixes that. Best Regards, Frederik Kriewitz
On Wed, May 28, 2014 at 04:43:31PM +0200, Frederik Kriewitz wrote:
Hello,
during some bird config optimizations (redundancy reductions) we noticed that various string options doesn't accept symbols as value. Attached you find a patch which fixes that.
Thanks, merged. Strictly speaking they should not accept symbols as value, but string constants denoted by symbols. -- 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."
Hello Ondrej, On Thu, May 29, 2014 at 11:13 PM, Ondrej Zajicek <santiago@crfreenet.org> wrote:
Thanks, merged. Strictly speaking they should not accept symbols as value, but string constants denoted by symbols.
Thank you. I missed one option, in interface patterns string constants denoted by symbols aren't allowed yet. But it's a little more complicated. The relevant grammar: iface_patt_node_body: TEXT { this_ipn->pattern = $1; this_ipn->prefix = IPA_NONE; this_ipn->pxlen = 0; } | prefix_or_ipa { this_ipn->pattern = NULL; this_ipn->prefix = $1.addr; this_ipn->pxlen = $1.len; } | TEXT prefix_or_ipa { this_ipn->pattern = $1; this_ipn->prefix = $2.addr; this_ipn->pxlen = $2.len; } The last alternative "TEXT prefix_or_ipa" can be eaily converted to "text prefix_or_ipa". But simply changing the first alternative (just "TEXT") to "text" causes a conflict as both "text" and "prefix_or_ipa" might be a symbol. I've never worked with bison grammars before but to me it looks like the only way to fix this is to create a new SYM alternative and handle the different types of it in the actions part of it. Can you think of an easier way? Best Regards, Freddy
On Tue, Jun 03, 2014 at 10:35:01AM +0200, Frederik Kriewitz wrote:
Hello Ondrej,
On Thu, May 29, 2014 at 11:13 PM, Ondrej Zajicek <santiago@crfreenet.org> wrote:
Thanks, merged. Strictly speaking they should not accept symbols as value, but string constants denoted by symbols.
Thank you.
I missed one option, in interface patterns string constants denoted by symbols aren't allowed yet. But it's a little more complicated.
The relevant grammar: iface_patt_node_body: TEXT { this_ipn->pattern = $1; this_ipn->prefix = IPA_NONE; this_ipn->pxlen = 0; } | prefix_or_ipa { this_ipn->pattern = NULL; this_ipn->prefix = $1.addr; this_ipn->pxlen = $1.len; } | TEXT prefix_or_ipa { this_ipn->pattern = $1; this_ipn->prefix = $2.addr; this_ipn->pxlen = $2.len; }
The last alternative "TEXT prefix_or_ipa" can be eaily converted to "text prefix_or_ipa". But simply changing the first alternative (just "TEXT") to "text" causes a conflict as both "text" and "prefix_or_ipa" might be a symbol.
Yes, i also noticed that. But it seems that whole prefix_or_ipa is a bit problematic (you could use symbol for ipa but not for prefix, although we support prefix constants) and it would need some further changes to fix it. I will look at that. -- 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)
-
Frederik Kriewitz -
Ondrej Zajicek