Dear Damian, dear P::RD Lovers,

I love P::RD but I would be happy if the next version has additional
modifiers for alternations. See the following problem(s):

I've an alternation where some subrules are mandatory but others are
optional (Subrule statement). 

$grammar = << 'EOGRAMMAR';
    contact   : statement(s)
    statement : email | name |  phone | fax
    email     : 'email' '=' value  # mandatory
    name      : 'name' '=' value   # mandatory
    phone     : 'phone' '=' value  # optional
    fax       : 'fax' '=' value    # optional
    value     : /".*?"/
EOGRAMMAR

for example email and name will be required and phone or fax are optional.
In the moment I have to deal with action code working with sets. That means
I have an additional layer of grammar in the action code.

(here it's just a simple example, in reality I have a complex config file
for managing network devices, with for example required parameters like
snmp readcommunity or IP address and optional parameters like location
or description).

It would be very, very helpful to get rid of the extra
'grammar' action code if we could write the alternations
perhaps in the following manner:

  statement : email! | name! | phone | fax

with the semantik, that email and name is required and phone or fax
is optional. Don't know how difficult it would be for Damian to 
have an additional layer of state to handle inside the parser or wether
this is by principle not possible, but if it is possible it would
help for clarity, because the grammar stay's in the grammar part and
not in the action part.

And the following would also be sometimes useful: 

  exor : Mr ^ Mrs ^ hybrid

similar things are also best handled with sets in the action code in
the moment.

Best Regards
        Charly
-- 
Karl Gaissmaier          Computing Center,University of Ulm,Germany
Email:[EMAIL PROTECTED]          Network Administration
Tel.: ++49 731 50-22499

Reply via email to