in reply to Parse::RecDescent--pretending there's a semicolon after a BLOCK

There's no look-behind functionality of the type you want.

But what's wrong with:

BLOCK: '{' statements '}' StatementBlock: BLOCK /(\s*;)*/ { $item[1] }
???
  • Comment on Re: Parse::RecDescent--pretending there's a semicolon after a BLOCK
  • Download Code

Replies are listed 'Best First'.
Re: Re: Parse::RecDescent--pretending there's a semicolon after a BLOCK
by BrentDax (Hermit) on Oct 06, 2001 at 12:30 UTC
    That wasn't really what I needed, but the idea of the wrapper rule was. I wanted if(foo) {bar} to be treated as if(foo) {bar};, but I didn't want to lose the autotree behavior. So here's what I came up with:
    block: BLOCK { $text=';'.$text; $return=$item{BLOCK} } BLOCK: '{' statements '}' | <error>
    Simple and sensible.

    PS: I didn't know you had an account here. Apparently I'm in even better company than I thought. :^)

    =cut
    --Brent Dax
    There is no sig.