Erwan Velu wrote:> I've been submitting a patch t o add a com32 module able to parse the
> DMI table.
>
> I'm starting now the next step : having a way to boot some different
> menu regarding the dmi structures. I've been looking for some ideas
with
> the ethersel syntax :
> DEV [DID xxxx:yyyy[/mask]] [RID zz-zz] [SID uuuu:vvvv[/mask]] commandline
>
> In other hand, a nice implementation must allow to do :
> "if my bios is from this_manufacturer and the bios release = 3.4 so I
> must start the bios update.
> I think that many configuration will request to test several parameters
> for choosing the label to start.
>
> Does some of you have an idea on how to have an easy to use syntax ?
>
> I was thinking about something like :
> DMI [<handle>.<parameter> = <value>] and|or
[<handle>.<parameter> =
> <value>] commandline
>
> I think two parameters is enough else config file will become too complex.
>
> What does some potential futur users of this think about that ?
>
Actually, you can use yacc to generate a grammar which can handle
arbitrarily complex descriptions with ease. Since COM32 is just C, a
yacc-generated grammar should do just fine.
Otherwise, a recursive descent parser can deal with logical expressions
of this type easily enough.
If there are numerical values, you may need to also support numerical
comparisons, such as > >= < <=. In order to keep the lexer/grammar
sane, I suggest you start from the very beginning with requiring that
string arguments are enclosed in quotes, so that:
foo.bar = "3"
... is a string comparison, and ...
foo.bar = 3
... is a numeric comparison. This is easily done by having the lexer
produce a STRING and a NUMERIC token.
Alternatively, you can adopt the Perl convention of having "eq"
"ne" etc
for strings, and "==", "!=" etc for numbers.
-hpa