[PATCH] Add symbol support for various string options

Frederik Kriewitz frederik at kriewitz.eu
Tue Jun 3 10:35:01 CEST 2014


Hello Ondrej,

On Thu, May 29, 2014 at 11:13 PM, Ondrej Zajicek <santiago at 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



More information about the Bird-users mailing list