develooper Front page | perl.perl5.porters | Postings from July 2001

toke.c attribute weirdness

Thread Next
From:
Simon Cozens
Date:
July 8, 2001 03:18
Subject:
toke.c attribute weirdness
Message ID:
20010708111841.A3934@deep-dark-truthful-mirror
While diving through toke.c, the perfect Sunday morning activity, I found
the above code related to attributes:
    if (isLOWER(*s) && (tmp = keyword(PL_tokenbuf, len))) {
        if (tmp < 0) tmp = -tmp;
        switch (tmp) {
        case KEY_or:
        case KEY_and:
        case KEY_for:
        case KEY_unless:
        case KEY_if:
        case KEY_while:
        case KEY_until:
            goto got_attrs;
        default:
            break;
        }
    }

Why? This means we have:

 % perl -le 'my $foo :next;' 
Invalid SCALAR attribute: next at -e line 1
BEGIN failed--compilation aborted at -e line 1.

 % perl -le 'my $foo :for;' 
syntax error at -e line 1, near "for;"
Execution of -e aborted due to compilation errors.

I can't see any logical reason for this.

-- 
"Though a program be but three lines long,
someday it will have to be maintained."
-- The Tao of Programming

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About