[Petal] TALES augmented parser - first draft

Fergal Daly fergal at esatclear.ie
Wed Jun 11 17:03:11 BST 2003


On Wednesday 11 June 2003 3:30 pm, Jean-Michel Hiver wrote:
> Here's a first version of a TALES parser I'd like to build...
> 
> At the moment it only builds a parsed tree but I indent to make it
> output Perl code soon :)
> 
> Tell me what you think,

You can reduce some of the rules, for example

string_argument :
    '--' /\S+/          { bless \ do { $item[2] }, 
'Petal::TALES::argument_string' } |
    '"' /[^"]*/ '"'     { bless \ do { $item[2] }, 
'Petal::TALES::argument_string' } |
    "'" /[^']*/ "'"     { bless \ do { $item[2] }, 
'Petal::TALES::argument_string' }

string_argument :
    '--' /\S+/ | '"' /[^"]*/ '" | "'" /[^']*/ "'" {
        bless \ do { $item[2] }, 'Petal::TALES::argument_string'
    }

There's an incompatibility between Parse::RD 1.80 and 1.9x in how (s?) is 
handled. Changing 

@{$item{'argument(s?)'}}

to 

@{$item[3]}}

in minimal expression will hide the imcompatibility at the expense of some 
readaibilty. 1.80 was released Jan 2001, 1.90 was Mar 2003 which means there 
are lots of 1.80 users out there who probably can't upgrade,

F



More information about the Petal mailing list