option: /option/i /\w+/ optarg(?) ''

2004-05-20 Thread Alexander Farber
; $parser = Parse::RecDescent-new(q( genfile: chunk(s) /^\Z/ chunk: option | error option: /option/i /\w+/ optarg(?) { push @{$::option{lc $item[2]}}, $item[-2]; } optarg: /\S+/ )) or die 'Bad grammar'; $text .= $_ while (DATA); defined $parser-genfile($text) or die 'Bad text'; print STDERR

Re: option: /option/i /\w+/ optarg(?) ''

2004-05-20 Thread Ted Zlatanov
On Thu, 20 May 2004, [EMAIL PROTECTED] wrote: why doesn't the question mark in the optarg(?) below work as I expect? In the trace I see that optarg consumes the character and then the option rule fails, since the final is missing. Isn't P:RD supposed to backtrack and say ok, the

Re: option: /option/i /\w+/ optarg(?) ''

2004-05-20 Thread Ron D. Smith
); use Data::Dumper; use Parse::RecDescent; $RD_WARN = 1; $RD_HINT = 1; $RD_TRACE = 120; $parser = Parse::RecDescent-new(q( genfile: chunk(s) /^\Z/ chunk: option | error option: /option/i /\w+/ optarg(?) { push @{$::option{lc $item[2]}}, $item[-2]; } optarg: /\S+/ )) or die