Changeset 12176 for src/Pugs/Lexer.hs

Show
Ignore:
Timestamp:
08/12/06 19:55:50 (2 years ago)
Author:
audreyt
Message:

* First cut at proper compile-time role mixin support, based on

discussion on #perl6 about the semantics of "does".

class C {};
class D does C {};
D.isa(C); # False
D.does(C); # True

Composition works, and overriding role methods should work as well,
but concrete class/package names is not yet renamed, and role conflicts
is not yet validated. Still, a step toward the right direction.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Lexer.hs

    r11870 r12176  
    375375    return rv 
    376376 
    377 ruleTrait :: RuleParser String 
    378 ruleTrait = rule "trait" $ do 
    379     symbol "is" <|> symbol "does" 
     377ruleTrait :: [String] -> RuleParser (String, String) 
     378ruleTrait auxs = rule "trait" $ do 
     379    aux <- choice $ map symbol auxs 
    380380    trait <- do 
    381381        optional $ string "::" -- XXX Bad Hack 
     
    387387    --             change it all once the proper behaviour is implemented. 
    388388    optional $ verbatimParens $ many $ satisfy (/= ')') 
    389     return trait 
     389    return (aux, trait) 
    390390 
    391391ruleTraitName :: String -> RuleParser String