Q: <fail>, and context-aware rules
Patrick R. Michaud
pmichaud at pobox.com
Fri Aug 14 17:30:24 UTC 2009
On Mon, Aug 03, 2009 at 12:48:34PM -0400, Austin Hastings wrote:
> Vasily Chekalkin wrote:
>> Austin Hastings wrote:
>>
>>> I'm trying to solve "the typedef problem" in Close. Specifically, a
>>> variable declaration may include a "typedef" as part of the type
>>> specifier. But I need to know what's a typedef, and what's not a
>>> typedef, because the only rule for typedef is that it's a valid name.
>>>
>> [[ ... ]]
>>
>> So, you probably need something like
>>
>> 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.
My expectation is that NQP will be embeddable within regexes in the
very near future. Then it would be
<?{ is_a_typedef(~$0) }>
Beyond that, I'm not aware of any way for an action method to easily
signal a <fail> to the outer regex.
Pm
More information about the parrot-dev
mailing list