We can simply change the lexer state externally from the parser as soon as the hex( prefix is seen, and provide the result directly from the lexer.

This way, we can allow all the syntaxes like hex(de-ad-be-ef), hex(de:ad:be:ef), hex(de ad be ef) or even hex(dea:db-eef) just by ignoring nonalnum characters altogether.

Here I'd strongly prefer nicer user experience over setting the syntax to best fit our needs. I don't think any user really cares about the lexer/parser difference.

Maria


On 12 June 2023 15:07:16 CEST, Ondrej Zajicek <santiago@crfreenet.org> wrote:
On Mon, Jun 12, 2023 at 02:40:42PM +0200, Maria Matejka via Bird-users wrote:
Hello!

I think using hex() and base64() with adding these two tokens to the
"kw_sym:" non-terminal. This way, no current config should break.

I would prefer hex:XX:YY:... to hex(XX:YY:...) to emphasize it is lexer
and not parser thing and avoid special cases.

--
Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.