Q: <fail>, and context-aware rules
Vasily Chekalkin
bacek at bacek.com
Mon Aug 3 21:22:53 UTC 2009
Austin Hastings wrote:
>>
>> token typedef_name {
>> <identifier> <?{ is_a_typedef(~$0) }>
>> }
>>
>
> Yeah, except it would be <?{{ ... pir ... }}>, and I'd prefer to code it
> in NQP if possible. That's why I was wondering if there's a "fail from
> within" function available in the Action methods.
It's definitely not possible within Actions. Because actions invoked for
already parsed tree. OTOH you can use
token typedef_name {
<identifier> <.ensure_typedef>
}
and implement Close::Grammar::ensure_typedef in NQP.
--
Bacek
More information about the parrot-dev
mailing list