Changeset 6375
- Timestamp:
- 08/20/05 14:21:35 (3 years ago)
- svk:copy_cache_prev:
- 8581
- Files:
-
- 1 modified
-
src/Pugs/Parser.hs (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Parser.hs
r6374 r6375 594 594 _ -> return $ Pad scope lexDiff rhs 595 595 596 {-| 597 Match a @no@ declaration, i.e. the opposite of @use@ (see 598 'ruleUseDeclaration'). 599 600 Works by matching \'@no@\', then delegating to 'ruleUsePackage' with the flag 601 set to @False@. 602 -} 596 603 ruleNoDeclaration :: RuleParser Exp 597 604 ruleNoDeclaration = rule "no declaration" $ do … … 600 607 return emptyExp 601 608 609 {-| 610 Match a @use@ declaration. 611 612 Works by matching \'@use@\', then trying each of 'ruleUseVersion', 613 'ruleUseJSANModule' and 'ruleUsePackage'. 614 -} 602 615 ruleUseDeclaration :: RuleParser Exp 603 616 ruleUseDeclaration = rule "use declaration" $ do … … 621 634 return () 622 635 623 ruleUsePackage :: Bool -> RuleParser () 636 {-| 637 Match the package-name and import-list part of a @use@ or @no@ declaration. 638 639 The 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 641 of the declaration. (If the package is a Perl 5 package, the modification 642 will be different.) 643 644 It is assumed that the @use@ or @no@ has already been consumed by 645 'ruleUseDeclaration' or 'ruleNoDeclaration'. 646 -} 647 ruleUsePackage :: Bool -- ^ @True@ for @use@; @False@ for @no@ 648 -> RuleParser () 624 649 ruleUsePackage use = rule "use package" $ do 625 650 lang <- option "pugs" $ try $ do … … 655 680 return () 656 681 682 {-| 683 Match a JSAN module name, preceded by \'@jsan:@\'. Returns an appropriate 684 sub call 'Pugs.AST.Exp' that will load the module using subs defined in 685 @PIL2JS::Internals@. 686 687 Used by 'ruleUseDeclaration' after matching \'@use@\'. 688 689 More 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 -} 657 694 ruleUseJSANModule :: RuleParser Exp 658 695 ruleUseJSANModule = do … … 673 710 ] 674 711 675 -- | The version part of a full class specification.712 -- | The version part of a fully-qualified package name. 676 713 ruleVersionPart :: RuleParser String 677 714 ruleVersionPart = do -- version - XXX … … 680 717 return ('-':str) 681 718 682 -- | The author part of a full class specification.719 -- | The author part of a fully-qualified package name. 683 720 ruleAuthorPart :: RuleParser String 684 721 ruleAuthorPart = do -- author - XXX … … 697 734 _ -> fail "not yet parsed" 698 735 736 {-| 737 Match a @require@ declaration, returning a sub call 'Pugs.AST.Exp' that will 738 load the package at runtime. 739 740 (This should probably be merged with 'ruleUseDeclaration' & friends, if 741 anybody has some tuits.) 742 -} 699 743 ruleRequireDeclaration :: RuleParser Exp 700 744 ruleRequireDeclaration = tryRule "require declaration" $ do
