Changeset 15425
- Timestamp:
- 03/03/07 16:37:34 (21 months ago)
- Files:
-
- 19 modified
-
Makefile.PL (modified) (1 diff)
-
src/Prereqs.hs (modified) (1 diff)
-
src/Pugs.hs (modified) (1 diff)
-
src/Pugs/AST.hs (modified) (1 diff)
-
src/Pugs/AST/CapInternals.hs (modified) (6 diffs)
-
src/Pugs/AST/Internals.hs (modified) (1 diff)
-
src/Pugs/Class.hs (modified) (4 diffs)
-
src/Pugs/Class/C3.hs (modified) (1 diff)
-
src/Pugs/Eval.hs (modified) (2 diffs)
-
src/Pugs/Internals/Cast.hs (modified) (3 diffs)
-
src/Pugs/Lexer.hs (modified) (4 diffs)
-
src/Pugs/Parser.hs (modified) (1 diff)
-
src/Pugs/Parser/Operator.hs (modified) (1 diff)
-
src/Pugs/Parser/Program.hs (modified) (1 diff)
-
src/Pugs/Prim.hs (modified) (1 diff)
-
src/Pugs/Prim/Match.hs (modified) (1 diff)
-
src/Pugs/Types.hs (modified) (2 diffs)
-
src/Pugs/Val/Code.hs (modified) (1 diff)
-
util/munge_haddock.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Makefile.PL
r15392 r15425 57 57 @srcdirs = grep {! m|\b_svn\b|} @srcdirs if $ENV{SVN_ASP_DOT_NET_HACK}; 58 58 59 my @hsfiles = map {glob "$_/ *.hs"} @srcdirs;59 my @hsfiles = map {glob "$_/[A-Z]*.hs"} @srcdirs; 60 60 push @hsfiles, qw<src/Pugs/Config.hs src/Pugs/CodeGen/PIR/Prelude.hs>; 61 61 my @hppfiles = map {my $x=$_; $x=~s/\.hs$/.hpp/; $x} @hsfiles; -
src/Prereqs.hs
r13183 r15425 7 7 -} 8 8 9 module Prereqs where 10 9 11 import Pugs.Compat () 10 12 import Pugs.Embed.Parrot () 11 13 import Pugs.Embed.Perl5 () 14 import Pugs.Meta () 12 15 import Pugs.Run.Perl5 () 13 16 import Pugs.Parser.Charnames () -
src/Pugs.hs
r15297 r15425 260 260 suffixes = 261 261 [ [] 262 , ["perl5", "PIL2JS"] -- $sourcedir/perl5/PIL2JS/jspugs.pl263 , ["perl5", "lib"] -- $pugslibdir/perl5/lib/jspugs.pl264 , ["misc", "pX", "Common", "redsix"] -- $sourcedir/misc/pX/Common/redsix/redsix262 , ["perl5", "PIL2JS"] -- sourcedir/perl5/PIL2JS/jspugs.pl 263 , ["perl5", "lib"] -- pugslibdir/perl5/lib/jspugs.pl 264 , ["misc", "pX", "Common", "redsix"] -- sourcedir/misc/pX/Common/redsix/redsix 265 265 ] 266 266 perl5 = getConfig "perl5path" -
src/Pugs/AST.hs
r15417 r15425 352 352 353 353 {-| 354 Symbols which are reserved for the current interpreter/compiler instance and 355 should not be set from the preamble or other sources. See 356 @Pugs.AST.filterUserDefinedPad@. 354 Symbols which are reserved for the current interpreter or compiler instance and 355 should not be set from the preamble or other sources. See @filterUserDefinedPad@. 357 356 -} 358 357 _reserved :: Set Var -
src/Pugs/AST/CapInternals.hs
r14934 r15425 115 115 | VPure ValPure -- ^ Immutable (or "pure") values 116 116 | VMut ValMut -- ^ Mutable variables (in STM monad) 117 | VIO ValIO -- ^ I /O handles (in IO monad)117 | VIO ValIO -- ^ IO handles (in IO monad) 118 118 deriving (Show, Eq, Ord, Data, Typeable) {-!derive: YAML_Pos, Perl6Class, MooseClass!-} 119 119 … … 129 129 | NNum !NativeNum -- ^ 4.2 130 130 | NCplx !NativeComplex -- ^ (45 - 9i) 131 | NBool !NativeBool -- ^ True (same underlying storage as NBit + True /False)131 | NBool !NativeBool -- ^ True (same underlying storage as NBit + True|False) 132 132 deriving (Show, Eq, Ord, Data, Typeable) {-!derive: YAML_Pos, Perl6Class, MooseClass!-} 133 133 … … 136 136 = UUndef -- ^ e.g., "my $x" with out further assignment 137 137 | UWhatever -- ^ e.g. the * in 1 .. * 138 | UFailure !ObjId -- ^ $!object138 | UFailure !ObjId -- ^ the "$!" object 139 139 deriving (Show, Eq, Ord, Data, Typeable) {-!derive: YAML_Pos, Perl6Class, MooseClass!-} 140 140 … … 534 534 deriving (Show, Eq, Ord, Data, Typeable) {-!derive: YAML_Pos, Perl6Class, MooseClass!-} 535 535 536 -- | Single parameter for a function /method, e.g.:536 -- | Single parameter for a function or method, e.g.: 537 537 -- Elk $m where { $m.antlers ~~ Velvet } 538 538 {-| … … 720 720 = ObjInstance 721 721 { o_id :: !ObjId -- ^ our unique id 722 , o_meta :: !ObjClass -- ^ id of our metaobj /type722 , o_meta :: !ObjClass -- ^ id of our metaobj|type 723 723 , o_slots :: !ObjSlots -- ^ storage for explicit fields 724 724 } 725 725 | MkForeign 726 { o_id :: !ObjId -- ^ our unique id727 , o_meta :: !ObjClass -- ^ id of our metaobj /type726 { o_id :: !ObjId -- ^ our unique id 727 , o_meta :: !ObjClass -- ^ id of our metaobj|type 728 728 , o_payload :: !ObjPayload -- ^ storage for opaque wrapped obj 729 729 } 730 730 | MkPrototype 731 731 { o_id :: !ObjId -- ^ our unique id 732 , o_meta :: !ObjClass -- ^ id of our metaobj /type732 , o_meta :: !ObjClass -- ^ id of our metaobj|type 733 733 } 734 734 deriving (Show, Eq, Ord, Data, Typeable) {-!derive: YAML_Pos, Perl6Class, MooseClass!-} … … 769 769 770 770 data Magic 771 = MOS -- ^ $?OS Which os am I compiled for?772 | MOSVer -- ^ $?OSVER Which os version am I compiled for?773 | MPerlVer -- ^ $?PERLVER Which Perl version am I compiled for?774 | MFile -- ^ $?FILE Which file am I in?775 | MLine -- ^ $?LINE Which line am I at?776 | MScalarPackage -- ^ $?PACKAGE Which package am I in?777 | MArrayPackages -- ^ @?PACKAGE Which packages am I in?778 | MScalarModule -- ^ $?MODULE Which module am I in?779 | MArrayModules -- ^ @?MODULE Which modules am I in?780 | MScalarClass -- ^ $?CLASS Which class am I in? (as variable)781 | MArrayClasses -- ^ @?CLASS Which classes am I in?782 | MScalarRole -- ^ $?ROLE Which role am I in? (as variable)783 | MArrayRoles -- ^ @?ROLE Which roles am I in?784 | MScalarGrammar -- ^ $?GRAMMAR Which grammar am I in?785 | MArrayGrammars -- ^ @?GRAMMAR Which grammars am I in?786 | MParser -- ^ $?PARSER Which Perl grammar was used to771 = MOS -- ^ \$?OS Which os am I compiled for? 772 | MOSVer -- ^ \$?OSVER Which os version am I compiled for? 773 | MPerlVer -- ^ \$?PERLVER Which Perl version am I compiled for? 774 | MFile -- ^ \$?FILE Which file am I in? 775 | MLine -- ^ \$?LINE Which line am I at? 776 | MScalarPackage -- ^ \$?PACKAGE Which package am I in? 777 | MArrayPackages -- ^ \@?PACKAGE Which packages am I in? 778 | MScalarModule -- ^ \$?MODULE Which module am I in? 779 | MArrayModules -- ^ \@?MODULE Which modules am I in? 780 | MScalarClass -- ^ \$?CLASS Which class am I in? (as variable) 781 | MArrayClasses -- ^ \@?CLASS Which classes am I in? 782 | MScalarRole -- ^ \$?ROLE Which role am I in? (as variable) 783 | MArrayRoles -- ^ \@?ROLE Which roles am I in? 784 | MScalarGrammar -- ^ \$?GRAMMAR Which grammar am I in? 785 | MArrayGrammars -- ^ \@?GRAMMAR Which grammars am I in? 786 | MParser -- ^ \$?PARSER Which Perl grammar was used to 787 787 -- ^ parse this statement? 788 | MScalarRoutine -- ^ &?ROUTINE Which routine am I in?789 | MArrayRoutines -- ^ @?ROUTINE Which routines am I in?790 | MScalarBlock -- ^ &?BLOCK Which block am I in?791 | MArrayBlocks -- ^ @?BLOCK Which blocks am I in?788 | MScalarRoutine -- ^ \&?ROUTINE Which routine am I in? 789 | MArrayRoutines -- ^ \@?ROUTINE Which routines am I in? 790 | MScalarBlock -- ^ \&?BLOCK Which block am I in? 791 | MArrayBlocks -- ^ \@?BLOCK Which blocks am I in? 792 792 deriving (Show, Eq, Ord, Data, Typeable) {-!derive: YAML_Pos, Perl6Class, MooseClass!-} 793 793 -
src/Pugs/AST/Internals.hs
r15396 r15425 224 224 castV x = VOpaque (MkOpaque x) -- error $ "Cannot cast into Val" 225 225 226 #ifndef HADDOCK 226 227 data VOpaque where 227 228 MkOpaque :: Value a => !a -> VOpaque 229 #endif 228 230 229 231 fromVal' :: (Value a) => Val -> Eval a -
src/Pugs/Class.hs
r15424 r15425 57 57 return $ MkInvocant x' (class_interface (classOf x')) 58 58 59 mkBoxClass :: forall t (m :: * -> *) (m1 :: * -> *).59 mkBoxClass :: 60 60 ( Method m1 (AnyMethod m1) 61 61 , Codeable m1 (HsCode m) … … 75 75 } 76 76 77 -- variant of @mkBoxClass@ meant to be called with the fixed-point77 -- | Variant of @mkBoxClass@ meant to be called with the fixed-point 78 78 -- combinator, that adds the standard HOW and WHICH methods. E.g.: 79 79 -- _StrClass = fix $ mkBoxPureClass "Str" [Str methods] 80 mkBoxPureClass :: forall a1 (m :: * -> *) a (m1 :: * -> *).80 mkBoxPureClass :: 81 81 ( Boxable m a1 82 82 , Boxable m a … … 96 96 raiseWhatError = error 97 97 98 mkBoxMethod :: forall t (m1 :: * -> *) (m :: * -> *).98 mkBoxMethod :: 99 99 ( Method m (SimpleMethod m) 100 100 , Codeable m (HsCode m1) … … 115 115 type PureClass = MI Eval 116 116 117 instance Boxable Eval a => Boxable Eval [a] where117 instance Boxable Eval a => Boxable Eval [a] 118 118 instance Boxable Eval ID 119 119 instance Boxable Eval PureClass where -
src/Pugs/Class/C3.hs
r15406 r15425 1 -- #prune2 3 1 -- | 4 2 -- -
src/Pugs/Eval.hs
r15421 r15425 289 289 else name 290 290 | isGlobalVar var || pkg `notElem` [emptyPkg, callerPkg, outerPkg, contextPkg] -> do 291 -- $Qualified::Varis not found. Vivify at lvalue context.291 -- '$Qualified::Var' is not found. Vivify at lvalue context. 292 292 lv <- asks envLValue 293 293 if lv then evalExp (Sym SGlobal var (Var var)) else retEmpty 294 294 | otherwise -> do 295 295 s <- isStrict 296 if s then retError "Undeclared variable" var296 if s then do retError "Undeclared variable" var 297 297 else do lv <- asks envLValue 298 298 if lv then evalExp (Sym SGlobal var (Var var)) else retEmpty … … 659 659 Just tvar -> return (tvar, ref) 660 660 _ | isGlobalVar var || v_package var `notElem` [emptyPkg, callerPkg, outerPkg, contextPkg] -> do 661 -- $Qualified::Varis not found. Vivify at lvalue context.661 -- '$Qualified::Var' is not found. Vivify at lvalue context. 662 662 evalExp (Sym SGlobal var Noop) 663 663 rv' <- findVarRef var -
src/Pugs/Internals/Cast.hs
r15379 r15425 1 {-# OPTIONS_GHC -fglasgow-exts -fno-warn-orphans -fno-full-laziness -fno-cse -fno-warn-deprecations -fallow-undecidable-instances -fallow-overlapping-instances -funbox-strict-fields #-}1 {-# OPTIONS_GHC -fglasgow-exts -fno-warn-orphans -fno-full-laziness -fno-cse -fno-warn-deprecations -fallow-undecidable-instances -fallow-overlapping-instances -funbox-strict-fields -cpp #-} 2 2 3 #ifndef HADDOCK 3 4 module Pugs.Internals.Cast ( 4 5 (:>:)(..), … … 19 20 import qualified Data.Typeable as Typeable 20 21 import qualified UTF8 22 21 23 22 24 -- … … 79 81 castBack = UTF8.pack 80 82 83 #endif -
src/Pugs/Lexer.hs
r15327 r15425 1 {-# OPTIONS_GHC -fglasgow-exts -fvia-C -optc-w #-}1 {-# OPTIONS_GHC -fglasgow-exts -fvia-C -optc-w -cpp #-} 2 2 3 3 {-| … … 67 67 balancedDelim c = case c of 68 68 '\x0028' -> '\x0029'; '\x003C' -> '\x003E'; '\x005B' -> '\x005D'; 69 #ifndef HADDOCK 69 70 '\x007B' -> '\x007D'; '\x00AB' -> '\x00BB'; '\x0F3A' -> '\x0F3B'; 70 71 '\x0F3C' -> '\x0F3D'; '\x169B' -> '\x169C'; '\x2039' -> '\x203A'; … … 128 129 '\xFF1C' -> '\xFF1E'; '\xFF3B' -> '\xFF3D'; '\xFF5B' -> '\xFF5D'; 129 130 '\xFF5F' -> '\xFF60'; '\xFF62' -> '\xFF63'; other -> other 131 #endif 130 132 131 133 -- balanced: parses an open/close delimited expression of any non-alphanumeric character … … 295 297 -- "\08..." and "\09..." are treated as "\0" and then "8..." or "9...". 296 298 ('0':xs@(x:_)) | x == '8' || x == '9' -> return (0:map (toInteger . ord) xs) 297 _ -> error ("Error: Invalid escape sequence \\" ++ ds ++ "; write as decimal \\d" ++ ds ++ " or octal \\o" ++ ds ++ " instead") -- $return [read ds]299 _ -> error ("Error: Invalid escape sequence \\" ++ ds ++ "; write as decimal \\d" ++ ds ++ " or octal \\o" ++ ds ++ " instead") -- return [read ds] 298 300 , based 'o' 8 octDigit 299 301 , based 'x' 16 hexDigit -
src/Pugs/Parser.hs
r15422 r15425 1752 1752 return $ \x -> case name of 1753 1753 ('&':rest) -> case quant of 1754 Just q -> Syn "CCallDyn" ((Val (castV [q])):Val (VStr rest):x:args) -- $x.*meth1755 _ -> App (_Var name) (Just x) args -- $x.meth1756 _ -> Syn "CCallDyn" (Val (castV (maybeToList quant)):_Var name:x:args) -- $x.$meth1754 Just q -> Syn "CCallDyn" ((Val (castV [q])):Val (VStr rest):x:args) -- '$x.*meth' 1755 _ -> App (_Var name) (Just x) args -- '$x.meth' 1756 _ -> Syn "CCallDyn" (Val (castV (maybeToList quant)):_Var name:x:args) -- '$x.$meth' 1757 1757 1758 1758 ruleArraySubscript :: RuleParser (Exp -> Exp) -
src/Pugs/Parser/Operator.hs
r15364 r15425 33 33 = compare (Buf.length y) (Buf.length x) `mappend` compare b a 34 34 35 -- Not yet transcribed into a full optable parser with dynamic precedence --35 -- Not yet transcribed into a full optable parser with dynamic precedence 36 36 37 37 tightOperators :: RuleParser (TightFunctions, RuleOperatorTable Exp) -
src/Pugs/Parser/Program.hs
r15368 r15425 23 23 | otherwise = prog ++ "\n" 24 24 25 -- Based on: http://hackage.haskell.org/trac/haskell-prime/wiki/SourceEncodingDetection25 -- Based on: <http://hackage.haskell.org/trac/haskell-prime/wiki/SourceEncodingDetection> 26 26 data EncodedSource 27 27 = UTF8 !String 28 28 | UTF16 !Endian !String 29 29 | UTF32 !Endian !String 30 -- | UserDefined ...30 -- ... | UserDefined ... 31 31 32 32 data Endian = LittleEndian | BigEndian -
src/Pugs/Prim.hs
r15422 r15425 1593 1593 triggering the failure. Just zipping with [1 ..] may not be 1594 1594 enough because our caller may not be passing through its own 1595 input args in the same order /position to us.1595 input args in the same order and position to us. 1596 1596 1597 1597 -} -
src/Pugs/Prim/Match.hs
r15324 r15425 161 161 op2Match x (VType (mkType name)) 162 162 163 -- $x ~~ tr/x/y/==> $x = ~$x.trans('x' => 'y')163 -- '$x ~~ tr/x/y/' ==> $x = ~$x.trans('x' => 'y') 164 164 op2Match x (VSubst (MkTrans from to)) = do 165 165 str <- fromVal x -
src/Pugs/Types.hs
r15297 r15425 35 35 36 36 data Type 37 = MkType !ID -- ^ A regular type38 | TypeOr !Type !Type -- ^ The disjunction (|) of two types39 | TypeAnd !Type !Type -- ^ The conjunction (&) of two types37 = MkType !ID -- ^ A regular type 38 | TypeOr !Type !Type -- ^ The disjunction (|) of two types 39 | TypeAnd !Type !Type -- ^ The conjunction (&) of two types 40 40 deriving (Eq, Ord, Typeable, Data) 41 41 … … 429 429 Just idx1 -> case Buf.findSubstring (__"::") str of 430 430 Nothing -> ([], (cast (Buf.take idx1 str), Buf.drop (succ idx1) str)) 431 Just 0 -> tokenPkg (Buf.drop 2 str) -- $::xis the same as $x431 Just 0 -> tokenPkg (Buf.drop 2 str) -- '$::x' is the same as $x 432 432 Just idx 433 433 | idx == idx1 -> case cast (Buf.take idx1 str) of -
src/Pugs/Val/Code.hs
r15412 r15425 98 98 type PureSig = Sig 99 99 100 -- | Single parameter for a function /method, e.g.:100 -- | Single parameter for a function or method, e.g.: 101 101 -- Elk $m where { $m.antlers ~~ Velvet } 102 102 {-| -
util/munge_haddock.pl
r15423 r15425 10 10 s/^#(.*)/{- $1 -}/; 11 11 12 # Recursive imports 13 s/import \{-# SOURCE #-\}.*//; 14 15 # Symbolic Classes 16 s/\(\(:>:\) (.+?)\) /CastTo $1 /; 17 s/(, )?\(:>:\) (\w+)//g; 18 s/(, )?\(:<:\) (\w+)//g; 19 12 20 # Parallel arrays 13 21 s/\[:/[/g;
