Q: <fail>, and context-aware rules

Austin Hastings Austin_Hastings at Yahoo.com
Mon Aug 3 14:13:35 UTC 2009


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> {*}
}

and then:

method typedef_name($/) {
    if is_a_typedef(~$<identifier>) {
         make get_typedef_past(~$<identifier>);
    }
    else {
       FAIL_SOMEHOW();
    }
}

But I don't know how to fail. Is there an "official right way" to do 
this? Is there a "working way"? I could set a variable, and then check 
it in a predicate PIR closure, but ugh.

=Austin


More information about the parrot-dev mailing list