[kea-dev] how to unparse token

Francis Dupont fdupont at isc.org
Wed Nov 25 16:40:52 UTC 2015


(the whole topic is about the clasification expression which are parsed
as a vector of Token objects)

We are divided between two ways to provide an "unparse" method which
from a Token gives back its textual input.
In both case we have:
 parse o unparse = identity
which means if you parse again the result of unparse you get the same Token.
Only a solution provides too:
 unparse o parse = identity
Ie., unparse gives back the exact input (there is no miracle: this solution
simply caches the input into the Token object).

I argue we don't need this (expensive to implement) property, i.e.,
we can live with in "substring('foo', 01, all)" the "01" be unparsed
into "1". Opinion? Argument?

Thanks

Francis Dupont <fdupont at isc.org>

PS: I wrote a decompile function too but it requires only a from Token
to string method so works with #4115 or #4124. Of course the same question
can be raise: decompile or simply keep the "to be parsed" sring. And
the day we'll provide a get text config you can guess the question...
(with in this case the two common arguments: keep comments vs. pretty
print the output which shows bad constructs :-).


More information about the kea-dev mailing list