Ethereal-dev: Re: [Ethereal-dev] Display filter engine questions

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxxxxxxx>
Date: Tue, 4 May 2004 23:08:51 -0500
On Sunday 02 May 2004 05:05, Olivier Biot wrote:

> For instance, if I wan to add an 'in' display filter operation, I need
> to define several things. This can happen in different ways. For
> instance, every value from the "in" value collection will result in a
> test. There are 2 options here, either a test for a single value (x in
> {a b c}), or a test for a value in a given range (x in {a ... z}). The
> former can be reduced to "((x == a) or (x == b) or (x == c))" while
> the latter can be reduced to "((x >= MIN(a, z)) and (x <= MAX(a,
> z)))".
>
> I understand that I can replace "x in {" with the following steps:
> first store x in the "in" test buffer, then add "(" to the display
> filter expression internally.
>
> Similarly I can replace the closing brace "}" with the following
> steps: release x from the "in" test buffer and then add ")" to the
> display filter expression internally.
>
> How could I do this?

This could be done in grammar.lemon. The grammar would produce syntax tree 
nodes, combining them with "or", when given tokens that represent the "in" 
syntax.

It could also be done later in the process, maybe in semcheck.c. But if you 
can do it earlier, in grammar.lemon, then you shouldn't have to worry about 
modifying anything in semcheck.c, as the syntax tree that is passed to 
semcheck.c won't contiain any new type of operators... just lots of nodes 
combined with "or".

I hope this helps,

--gilbert