Permalink
Browse files

Merge branch 'nom' of https://github.com/rakudo/rakudo into nom

  • Loading branch information...
2 parents a2da68c + 57eaaad commit 7f7abfab91d025a5a01dbb693d5d1d416b1acca8 @ajscogo ajscogo committed Jul 6, 2012
Showing with 87 additions and 62 deletions.
  1. +1 −0 docs/ChangeLog
  2. 0 lib/{lib.pm → lib.pm6}
  3. +1 −1 src/Perl6/Grammar.pm
  4. +6 −4 src/core/Cool.pm
  5. +29 −6 src/core/IO.pm
  6. +1 −1 src/core/Main.pm
  7. +40 −42 src/core/Pod.pm
  8. +2 −1 src/core/terms.pm
  9. +7 −7 tools/build/Makefile.in
View
@@ -6,6 +6,7 @@ New in 2012.07
+ Exception.fail
+ Changed &dir to return IO::File and IO::Dir objects, not strings
+ anonymous subset types with subset :: where ...;
++ Deprecated .bytes, .ucfirst, and .lcfirst
New in 2012.06
+ Rakudo is now compiled with the same regex engine as user-space regexes use
File renamed without changes.
@@ -1998,9 +1998,9 @@ grammar Perl6::Grammar is HLL::Grammar {
token term:sym<rand> {
<sym> »
- <.end_keyword>
[ <?before '('? \h* [\d|'$']> <.obs('rand(N)', 'N.rand or (1..N).pick')> ]?
[ <?before '()'> <.obs('rand()', 'rand')> ]?
+ <.end_keyword>
}
token term:sym<...> { <sym> <args> }
View
@@ -82,12 +82,12 @@ my class Cool {
nqp::p6box_s(nqp::lc(nqp::unbox_s(self.Str)))
}
- method ucfirst() {
+ method ucfirst() is DEPRECATED {
my $self-str = self.Str;
$self-str eq '' ?? '' !! $self-str.substr(0, 1).uc ~ $self-str.substr(1)
}
- method lcfirst() {
+ method lcfirst() is DEPRECATED {
my $self-str = self.Str;
$self-str eq '' ?? '' !! $self-str.substr(0, 1).lc ~ $self-str.substr(1)
}
@@ -199,11 +199,13 @@ sub chomp(Cool $s) { $s.chomp }
sub flip(Cool $s) { $s.flip }
sub index(Cool $s,$needle,$pos=0) { $s.index($needle,$pos) }
sub lc(Cool $s) { $s.lc }
-sub lcfirst(Cool $s) { $s.lcfirst }
sub ord(Cool $s) { $s.ord }
sub substr(Cool $s,$pos,$chars?) { $s.substr($pos,$chars) }
sub uc(Cool $s) { $s.uc }
-sub ucfirst(Cool $s) { $s.ucfirst }
+
+sub lcfirst(Cool $s) is DEPRECATED { $s.lcfirst }
+sub ucfirst(Cool $s) is DEPRECATED { $s.ucfirst }
+
proto sub rindex(|$) { * };
multi sub rindex(Cool $s, Cool $needle, Cool $pos) { $s.rindex($needle, $pos) };
multi sub rindex(Cool $s, Cool $needle) { $s.rindex($needle) };
View
@@ -51,11 +51,8 @@ my role IO::FileTestable {
method s() {
self.e
- && nqp::p6bool(
- nqp::isgt_i(
- nqp::stat(nqp::unbox_s($.path),
- pir::const::STAT_FILESIZE),
- 0))
+ && nqp::p6box_i( nqp::stat(nqp::unbox_s($.path),
+ pir::const::STAT_FILESIZE) );
}
method w() {
@@ -91,8 +88,9 @@ class IO does IO::FileTestable {
has $.path;
proto method open(|$) { * }
- multi method open($path, :$r, :$w, :$a, :$bin, :$chomp = Bool::True,
+ multi method open($path? is copy, :$r, :$w, :$a, :$bin, :$chomp = Bool::True,
:enc(:$encoding) = 'utf8') {
+ $path //= $.path;
my $mode = $w ?? 'w' !! ($a ?? 'wa' !! 'r');
# TODO: catch error, and fail()
nqp::bindattr(self, IO, '$!PIO',
@@ -394,6 +392,31 @@ multi sub slurp(IO $io = $*ARGFILES) {
$io.slurp;
}
+proto sub spurt(|$) { * }
+multi sub spurt(Cool $filename,
+ Cool $contents,
+ :encoding(:$enc) = 'utf8',
+ :$new,
+ :$append) {
+ fail("File '$filename' already exists, but :new was give to spurt")
+ if $new && $filename.IO.e;
+ my $mode = $append ?? :a !! :w;
+ my $fh = open($filename.Str, :$enc, |$mode);
+ $fh.print($contents);
+ $fh.close;
+}
+multi sub spurt(Cool $filename,
+ Buf $contents,
+ :$new,
+ :$append) {
+ fail("File '$filename' already exists, but :new was give to spurt")
+ if $new && $filename.IO.e;
+ my $mode = $append ?? :a !! :w;
+ my $fh = open($filename.Str, :bin, |$mode);
+ $fh.write($contents);
+ $fh.close;
+}
+
my class X::IO::Cwd { ... }
proto sub cwd(|$) { * }
multi sub cwd() {
View
@@ -101,7 +101,7 @@ my sub MAIN_HELPER($retval = 0) is hidden_from_backtrace {
last;
}
}
-
+ $PROCESS::ARGFILES = IO::ArgFiles.new(:args(@args));
return @positional-arguments, %named-arguments;
}
View
@@ -1,56 +1,54 @@
-my package Pod {
- class Block {
- has %.config;
- has @.content;
- }
+my class Pod::Block {
+ has %.config;
+ has @.content;
+}
- class Block::Para is Block {
- }
+my class Pod::Block::Para is Pod::Block {
+}
- class Block::Named is Block {
- has $.name;
- }
+my class Pod::Block::Named is Pod::Block {
+ has $.name;
+}
- class Block::Comment is Block { }
+my class Pod::Block::Comment is Pod::Block { }
- class Block::Code is Block {
- has @.allowed;
- }
+my class Pod::Block::Code is Pod::Block {
+ has @.allowed;
+}
- class Block::Declarator is Block {
- has $.WHEREFORE;
- method set_docee($d) {
- $!WHEREFORE = $d
- }
- method Str {
- ~@.content
- }
- method gist {
- self.Stringy
- }
+my class Pod::Block::Declarator is Pod::Block {
+ has $.WHEREFORE;
+ method set_docee($d) {
+ $!WHEREFORE = $d
}
-
- class Block::Table is Block {
- has $.caption;
- has @.headers; # optional, may be empty
+ method Str {
+ ~@.content
}
-
- class FormattingCode is Block {
- has $.type;
+ method gist {
+ self.Stringy
}
+}
- class Heading is Block {
- has $.level;
- }
+my class Pod::Block::Table is Pod::Block {
+ has $.caption;
+ has @.headers; # optional, may be empty
+}
- class Item is Block {
- has $.level;
- }
+my class Pod::FormattingCode is Pod::Block {
+ has $.type;
+}
- class Config {
- has $.type;
- has %.config;
- }
+my class Pod::Heading is Pod::Block {
+ has $.level;
+}
+
+my class Pod::Item is Pod::Block {
+ has $.level;
+}
+
+class Pod::Config {
+ has $.type;
+ has %.config;
}
# vim: ft=perl6
View
@@ -27,7 +27,8 @@ sub term:<time>() { nqp::p6box_i(nqp::time_i()) }
}
},
STORE => -> $, $v {
- nqp::bindkey($env, nqp::unbox_s($k), nqp::unbox_s($v))
+ nqp::bindkey($env, nqp::unbox_s($k),
+ nqp::unbox_s(($v // '').Str))
}
)
}
@@ -309,7 +309,7 @@ install: all
$(CP) $(S_SETTING_PBC) $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(CP) lib/Test.pm $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(CP) lib/Test.pir $(DESTDIR)$(PERL6_LANG_DIR)/lib
- $(CP) lib/lib.pm $(DESTDIR)$(PERL6_LANG_DIR)/lib
+ $(CP) lib/lib.pm6 $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(CP) lib/lib.pir $(DESTDIR)$(PERL6_LANG_DIR)/lib
$(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/lib/Pod/To
$(CP) lib/Pod/To/Text.pm $(DESTDIR)$(PERL6_LANG_DIR)/lib/Pod/To
@@ -318,10 +318,10 @@ install: all
$(MKPATH) $(DESTDIR)$(PARROT_BIN_DIR)
$(CP) $(PERL6_EXE) $(DESTDIR)$(PARROT_BIN_DIR)
$(CHMOD) 755 $(DESTDIR)$(PARROT_BIN_DIR)/$(PERL6_EXE)
- $(MKPATH) $(DESTDIR)$(DOCDIR)/rakudo
- $(MKPATH) $(DESTDIR)$(DOCDIR)/rakudo/announce
- $(CP) $(DOCS) $(DESTDIR)$(DOCDIR)/rakudo
- $(CP) $(DOCS)/announce $(DESTDIR)$(DOCDIR)/rakudo/announce
+ $(MKPATH) $(DESTDIR)$(DOCDIR)/rakudo
+ $(MKPATH) $(DESTDIR)$(DOCDIR)/rakudo/announce
+ -$(CP) $(DOCS) $(DESTDIR)$(DOCDIR)/rakudo
+ $(CP) docs/announce/* $(DESTDIR)$(DOCDIR)/rakudo/announce
$(MKPATH) $(DESTDIR)$(MANDIR)/man1
-$(POD2MAN) docs/running.pod --name=perl6 > $(DESTDIR)$(MANDIR)/man1/perl6.1
-$(POD2MAN) docs/running.pod --name=rakudo > $(DESTDIR)$(MANDIR)/man1/rakudo.1
@@ -411,8 +411,8 @@ $(S_SETTING_PBC): $(PERL6_B_PBC) $(PERL6_EXE) $(SETTING_PBC) $(S_SETTING_SRC)
lib/Test.pir: lib/Test.pm $(PERL6_EXE) $(SETTING_PBC)
./$(PERL6_EXE) --target=pir --output=lib/Test.pir lib/Test.pm
-lib/lib.pir: lib/lib.pm $(PERL6_EXE) $(SETTING_PBC)
- ./$(PERL6_EXE) --target=pir --output=lib/lib.pir lib/lib.pm
+lib/lib.pir: lib/lib.pm6 $(PERL6_EXE) $(SETTING_PBC)
+ ./$(PERL6_EXE) --target=pir --output=lib/lib.pir lib/lib.pm6
lib/Pod/To/Text.pir: lib/Pod/To/Text.pm $(PERL6_EXE) $(SETTING_PBC)
./$(PERL6_EXE) --target=pir --output=lib/Pod/To/Text.pir lib/Pod/To/Text.pm

0 comments on commit 7f7abfa

Please sign in to comment.