Q: <fail>, and context-aware rules

Vasily Chekalkin bacek at bacek.com
Mon Aug 3 15:03:56 UTC 2009


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 I want some kind of rule like:
> 
> token typedef_name {
>    <identifier> {*}
> }

This is quote from S05.

A leading ?{ or !{ indicates a code assertion:
- Show t/spec/S05-metasyntax/assertions.t lines 5–21 (no results) -

Highlighted: small|full
      / (\d**1..3) <?{ $0 < 256 }> /


So, you probably need something like

token typedef_name {
     <identifier> <?{ is_a_typedef(~$0) }>
}


-- 
Bacek


More information about the parrot-dev mailing list