Changeset 10103 for src/Pugs/Lexer.hs

Show
Ignore:
Timestamp:
04/28/06 07:01:21 (3 years ago)
Author:
audreyt
Message:

* Lexer/Parser: drop all mention of tryRule and tryChoice;

next step is to take out all the unneccessary explicit "try".

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Lexer.hs

    r10092 r10103  
    217217     
    218218    stringList :: Int -> RuleParser [Exp] 
    219     stringList i = tryChoice 
     219    stringList i = choice 
    220220        [ do 
    221221            parse <- interpolator 
     
    315315 
    316316rule :: String -> RuleParser a -> RuleParser a 
    317 rule name action = (<?> name) $ lexeme $ action 
     317rule name = (<?> name) . lexeme 
    318318 
    319319verbatimRule :: String -> RuleParser a -> RuleParser a 
    320 verbatimRule name action = (<?> name) $ action 
     320verbatimRule name = (<?> name) 
    321321 
    322322literalRule :: String -> RuleParser a -> RuleParser a 
    323 literalRule name action = (<?> name) $ postSpace $ action 
     323literalRule name = (<?> name) . postSpace 
    324324 
    325325tryRule :: String -> RuleParser a -> RuleParser a 
    326 tryRule name action = (<?> name) $ lexeme $ action 
     326tryRule name = (<?> name) . lexeme . try 
    327327 
    328328tryVerbatimRule :: String -> RuleParser a -> RuleParser a 
    329 tryVerbatimRule name action = (<?> name) $ action 
     329tryVerbatimRule name = (<?> name) 
    330330 
    331331ruleScope :: RuleParser Scope 
    332 ruleScope = tryRule "scope" $ do 
     332ruleScope = rule "scope" $ do 
    333333    scope <- ruleScopeName 
    334334    return $ readScope scope 
     
    397397tryChoice :: [RuleParser a] -- ^ List of candidate parsers 
    398398          -> RuleParser a 
    399 tryChoice = choice 
     399tryChoice = choice . map try 
    400400 
    401401{-|