Changeset 6375

Show
Ignore:
Timestamp:
08/20/05 14:21:35 (3 years ago)
Author:
scook0
svk:copy_cache_prev:
8581
Message:

* Haddocks for use/no/require in Parser.hs

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Parser.hs

    r6374 r6375  
    594594        _      -> return $ Pad scope lexDiff rhs 
    595595 
     596{-| 
     597Match a @no@ declaration, i.e. the opposite of @use@ (see 
     598'ruleUseDeclaration'). 
     599 
     600Works by matching \'@no@\', then delegating to 'ruleUsePackage' with the flag 
     601set to @False@. 
     602-} 
    596603ruleNoDeclaration :: RuleParser Exp 
    597604ruleNoDeclaration = rule "no declaration" $ do 
     
    600607    return emptyExp 
    601608 
     609{-| 
     610Match a @use@ declaration. 
     611 
     612Works by matching \'@use@\', then trying each of 'ruleUseVersion', 
     613'ruleUseJSANModule' and 'ruleUsePackage'. 
     614-} 
    602615ruleUseDeclaration :: RuleParser Exp 
    603616ruleUseDeclaration = rule "use declaration" $ do 
     
    621634    return () 
    622635 
    623 ruleUsePackage :: Bool -> RuleParser () 
     636{-| 
     637Match the package-name and import-list part of a @use@ or @no@ declaration. 
     638 
     639The parser itself does not yield a useful value; instead it modifies the 
     640'Pugs.AST.Internals.Env' part of the parser's state to reflect the results 
     641of the declaration.  (If the package is a Perl 5 package, the modification 
     642will be different.) 
     643 
     644It is assumed that the @use@ or @no@ has already been consumed by 
     645'ruleUseDeclaration' or 'ruleNoDeclaration'. 
     646-} 
     647ruleUsePackage :: Bool -- ^ @True@ for @use@; @False@ for @no@ 
     648               -> RuleParser () 
    624649ruleUsePackage use = rule "use package" $ do 
    625650    lang    <- option "pugs" $ try $ do 
     
    655680    return () 
    656681 
     682{-| 
     683Match a JSAN module name, preceded by \'@jsan:@\'.  Returns an appropriate 
     684sub call 'Pugs.AST.Exp' that will load the module using subs defined in 
     685@PIL2JS::Internals@. 
     686 
     687Used by 'ruleUseDeclaration' after matching \'@use@\'. 
     688 
     689More info about JSAN can be found at <http://www.openjsan.org/>. 
     690 
     691(This parser is screaming out to be refactored and merged with 
     692'ruleUseVersion', but that might be a little hairy to actually do.) 
     693-} 
    657694ruleUseJSANModule :: RuleParser Exp 
    658695ruleUseJSANModule = do 
     
    673710        ]  
    674711 
    675 -- | The version part of a full class specification. 
     712-- | The version part of a fully-qualified package name. 
    676713ruleVersionPart :: RuleParser String 
    677714ruleVersionPart = do -- version - XXX 
     
    680717    return ('-':str) 
    681718 
    682 -- | The author part of a full class specification. 
     719-- | The author part of a fully-qualified package name. 
    683720ruleAuthorPart :: RuleParser String 
    684721ruleAuthorPart = do -- author - XXX 
     
    697734        _ -> fail "not yet parsed" 
    698735 
     736{-| 
     737Match a @require@ declaration, returning a sub call 'Pugs.AST.Exp' that will 
     738load the package at runtime. 
     739 
     740(This should probably be merged with 'ruleUseDeclaration' & friends, if 
     741anybody has some tuits.) 
     742-} 
    699743ruleRequireDeclaration :: RuleParser Exp 
    700744ruleRequireDeclaration = tryRule "require declaration" $ do