Perl6-Pugs

 view release on metacpan or  search on metacpan

docs/summaries/2006/03-31.pod  view on Meta::CPAN

and requested that someone write a Perl version at some point.

=head3 L<why no negative (auto reversed) ranges?|http://groups.google.com/group/perl.perl6.language/browse_frm/thread/2bc40adc2da06803/f7abefdbc439c909#f7abefdbc439c909>

TSa noted that S03 explicitly disallows auto-reversed ranges and asked
why that was the case.  Larry Wall noted that to date, nobody wanted it.

=head3 L<where will we die to?|http://groups.google.com/group/perl.perl6.language/browse_frm/thread/7607e99b31ede3a3/cac325353528d842#cac325353528d842>

Yuval Kogman brought up a Catalyst problem debugging the eventual
location of a die within a cascade of evals.  He suggested that Perl
6 should make it easier to trace an exception.  Larry Wall asked how
this could be done without impacting performance, and Yuval clarified
his request.

=head3 L<UNIX commands: chmod|http://groups.google.com/group/perl.perl6.language/browse_frm/thread/cac2611cbfad8517/5efb19535e64cbd5#5efb19535e64cbd5>

Gabor Szabo had a proposal for some alterations to C<chmod>.  There was
discussion on his suggestions.

=head2 Acknowledgments

examples/qotw/009r/words.spel  view on Meta::CPAN

carton
cartoon
cartridge
cartwheel
Caruso
carve
carven
caryatid
Casanova
casbah
cascade
cascara
case
casebook
casein
casework
Casey
cash
cashew
cashier
cashmere

misc/pX/Common/xquery/grammar.dtd  view on Meta::CPAN

         action -> State stack action.
-->
<!ELEMENT g:transition (g:description?, (g:tref | g:transition-default)+)>
<!ATTLIST g:transition
  if IDREFS #IMPLIED
  next-state IDREF #IMPLIED
  action CDATA #IMPLIED
>

<!--=================== Parser Production Specifications ===============-->
<!-- A production that defines a "cascade" of productions that define 
     operator precedence.
         name -> the ID of the production. 
         if -> space separated list of tokens for conditional processing.
-->
<!ELEMENT g:exprProduction (g:level+)>
<!ATTLIST g:exprProduction
  name ID #REQUIRED
  if IDREFS #IMPLIED
  node-type CDATA #IMPLIED
  condition CDATA #IMPLIED

src/Pugs/Prim.hs  view on Meta::CPAN

op1 "log10" = op1Cast (VNum . logBase 10)
op1 "from"  = op1Cast (castV . matchFrom)
op1 "to"    = op1Cast (castV . matchTo)
op1 "matches" = op1Cast (VList . matchSubPos)
op1 "gather" = \v -> do
    evl <- asks envEval
    evl (Syn "gather" [Val v])
op1 "Thread::yield" = const $ do
    guardSTM . unsafeIOToSTM $ yield
    return $ VBool True
op1 "DESTROYALL" = \x -> cascadeMethod id "DESTROY" x VUndef
-- [,] is a noop -- It simply returns the input list
op1 "prefix:[,]" = return
op1 "prefix:$<<" = op1SigilHyper SScalar
op1 "prefix:@<<" = op1SigilHyper SArray
op1 "prefix:%<<" = op1SigilHyper SHash
op1 "prefix:&<<" = op1SigilHyper SCode
op1 "Code::assoc" = op1CodeAssoc
op1 "Code::name"  = op1CodeName
op1 "Code::arity" = op1CodeArity
op1 "Code::body"  = op1CodeBody

src/Pugs/Prim.hs  view on Meta::CPAN


handleExitCode :: ExitCode -> Eval Val
handleExitCode exitCode = do
    glob    <- askGlobal
    errSV   <- findSymRef (cast "$!") glob
    writeRef errSV $ case exitCode of
        ExitFailure x   -> VInt $ toInteger x
        ExitSuccess     -> VUndef
    return (VBool $ exitCode == ExitSuccess)

cascadeMethod :: ([VStr] -> [VStr]) -> VStr -> Val -> Val -> Eval Val
cascadeMethod f meth v args = do
    typ     <- evalValType v
    pkgs    <- fmap f (pkgParents $ showType typ)
    named   <- case args of
        VUndef -> return Map.empty
        VType{}-> return Map.empty
        _      -> join $ doHash args hash_fetch

    -- Here syms is a list of (sym, tvar) tuples where tvar is the physical coderef
    -- The monad in the "do" below is List.
    syms <- forM pkgs $ \pkg -> do

src/Pugs/Prim.hs  view on Meta::CPAN

    sz          <- fetchSize
    let len = if len' < 0 then if sz > 0 then (len' `mod` sz) else 0 else len'
    op4 "splice" x y (castV (sz - len)) (VList [])
op2 "sort" = \x y -> do
    xs <- fromVals x
    ys <- fromVals y
    op1 "sort" . VList $ xs ++ ys
op2 "IO::say" = op2Print hPutStrLn
op2 "IO::print" = op2Print hPutStr
op2 "printf" = op3 "IO::printf" (VHandle stdout)
op2 "BUILDALL" = cascadeMethod reverse "BUILD"
op2 "Pugs::Internals::install_pragma_value" = \x y -> do
    name <- fromVal x
    val  <- fromVal y
    idat <- asks envInitDat
    idatval <- liftSTM $ readTVar idat
    --trace ("installing " ++ name ++ "/" ++ (show val)) $ return ()
    let prag = initPragmas idatval
    liftSTM $ writeTVar idat idatval{initPragmas = 
        MkPrag{ pragName=name, pragDat=val } : prag }
    return (VBool True)

t/operators/filetest.t  view on Meta::CPAN

close $fh;
#if $*OS eq any <MSWin32 mingw msys cygwin> {
#  skip 1, "-z is not working on Win32 yet"
#}
#else {
  ok -z "empty_file",      "-z returns true for an empty file";
#}
unlink "empty_file";

# Stacked filetests
# L<S03/Changes to Perl 5 operators/"just cascade tests">
ok -e -d -r "t",               "stacking of filetest operators (1)";
ok -e -f -r $*PROGRAM_NAME, "stacking of filetest operators (2)";
ok not -e -f -r "doesnotexist.t", "stacking of filetest operators (3)";
# This one should return false *all the time* (-f and -d are mutually
# exclusive):
ok not -e -f -d "t",              "stacking of filetest operators (4-1)";
ok not -e -f -d "doesnotexist.t", "stacking of filetest operators (4-2)";
ok not -e -f -d "pugs",           "stacking of filetest operators (4-3)";
# L<S03/Changes to Perl 5 operators/"put the value in a variable">
my $sb = -e "t";

t/syntax/interpolation/strings.t  view on Meta::CPAN

is("Wont you take me to &func()", 'Wont you take me to func-y town', 'closure interpolation');
is("2 + 2 = { 2+2 }", '2 + 2 = 4', 'double quoted closure interpolation works');
is("&func() is where I live", 'func-y town is where I live', "make sure function interpolation doesn't eat all trailing whitespace");

# L<S02/Names and Variables /except when interpolating/>
is("&func. () is where I live", '&func. () is where I live', '"&func. ()" should not interpolate');
is("&func_w_args("foo","bar"))", '[foo][bar])', '"&func_w_args(...)" should interpolate');
# L<S02/"Literals" /"In order to interpolate the result of a method call">
is("$world.chars()", '5', 'method calls with parens should interpolate');
is("$world.chars", 'World.chars', 'method calls without parens should not interpolate');
is("$world.reverse.chars()", '5', 'cascade of argumentless methods, last ending in paren');
is("$world.substr(0,1)", 'W', 'method calls with parens and args should interpolate');

# Single quotes
# XXX the next tests will always succeed even if '' interpolation is buggy
is('Hello $world', 'Hello $world', 'single quoted string interpolation does not work (which is correct)');
is('2 + 2 = { 2+2 }', '2 + 2 = { 2+2 }', 'single quoted closure interpolation does not work (which is correct)');
is('$world @list[] %hash{} &func()', '$world @list[] %hash{} &func()', 'single quoted string interpolation does not work (which is correct)');

# Corner-cases
is("Hello $world!", "Hello World!", "! is not a part of var names");



( run in 0.600 second using v1.01-cache-2.11-cpan-e5176c747c2 )