Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rakudo/rakudo
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Jul 24, 2010
2 parents 83e0bdd + a9db7c0 commit d1f2e59
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 40 deletions.
57 changes: 41 additions & 16 deletions README
Expand Up @@ -23,9 +23,9 @@ or the spectest suite you may also need a subversion (svn) client.
In order to fully support Unicode, you'll also want to have the
ICU library installed (L<http://site.icu-project.org/>).
Rakudo can run without ICU, but some Unicode-related features
may not work properly.
do not work properly.

As an example, on Debian GNU/Linux or Ubuntu Linux the necessary
As an example, on Debian GNU/Linux or Ubuntu Linux, the necessary
components for building Rakudo can be installed via the command

aptitude install build-essential libicu-dev subversion
Expand All @@ -43,10 +43,16 @@ downloading Rakudo directly from github and building from there:
$ git clone git://github.com/rakudo/rakudo.git

If you don't have git installed, you can get a tarball or zip of Rakudo
from github by visiting http://github.com/rakudo/rakudo/tree/master
and clicking "Download". Then unpack the tarball or zip.
from L<http://github.com/rakudo/rakudo/downloads>.
Then unpack the tarball or zip.

Once you have a copy of Rakudo, build it as follows:
If you already have cloned Rakudo from github, you can get (pull) the
most recent version from github like this:

$ cd rakudo
$ git pull

Once you have an updated copy of Rakudo, build it as follows:

$ cd rakudo
$ perl Configure.pl --gen-parrot
Expand All @@ -70,7 +76,7 @@ privileges necessary.
The C<--gen-parrot> above option tells Configure.pl to automatically
download and build the most appropriate version of Parrot into
a local "parrot/" subdirectory, install that Parrot into
the "parrot_install/" subdirectory, and use that for building
the C<parrot_install/> subdirectory, and use that for building
Rakudo. It's okay to use the C<--gen-parrot> option on later
invocations of Configure.pl; the configure system will re-build
Parrot only if a newer version is needed for whatever version
Expand Down Expand Up @@ -98,9 +104,26 @@ the Parrot installation that was used to create it remains intact).

If the Rakudo compiler is invoked without an explicit script to
run, it enters a small interactive mode that allows Perl 6 statements
to be executed from the command line. Each line entered is treated
as a separate compilation unit, however (which means that subroutines
are preserved after they are defined, but variables are not).
to be executed from the command line.

=head3 Build/install problems

Occasionally, there may be problems when building/installing Rakudo.
Make sure you have a backup of any custom changes you have done to the
source tree before performing the following steps:

Try to remove the C<parrot_install> subdirectory:

$ cd rakudo
$ rm -r parrot_install
$ git pull
$ perl Configure.pl --gen-parrot
$ make

Or, in case you are really stuck, start with a fresh source tree:

$ rm -r rakudo
$ git clone git://github.com/rakudo/rakudo.git

=head2 Running the test suite

Expand Down Expand Up @@ -168,7 +191,7 @@ Rakudo's official web site is L<http://rakudo.org/>, where you can
find useful information for developers and users alike. There's also
a Parrot blog at L<http://parrotblog.org/>, most Perl 6 related news is
assembled at L<http://planetsix.perl.org/>. Links to many other
resources can be found on L<http://perl6-projects.org/>.
resources can be found on L<http://perl6.org/>.

=head2 Reporting bugs

Expand All @@ -177,8 +200,9 @@ Bug reports should be sent to C<rakudobug@perl.org> with the moniker
it gets appropriately tagged in the RT system (https://rt.perl.org/rt3/).
Please include or attach any sample source code that exhibits the
bug, and include either the release name/date or the git commit
identifier. You find that identifier in the first output line of
the C<git log> command. There's no need to cc: the perl6-compiler
identifier. You find that information in the output from
C<perl6 --version> (or in the first line of C<git log>, if Rakudo
fails to build). There's no need to cc: the perl6-compiler
mailing list, as the RT system will handle this on its own.

=head2 Submitting patches
Expand All @@ -188,17 +212,17 @@ submit it to C<rakudobug@perl.org> with the moniker [PATCH]
(including the brackets) at the start of the subject line. We'll
generally accept patches in any form if we can get them to work,
but unified diff from the C<git> command is greatly preferred. In
general this means that in the C<languages/rakudo/> directory you make your
general this means that in the C<rakudo> directory you make your
changes, and then type

git commit -m 'Your commit message'
git commit -m 'Your commit message' changed/filename.pm
git format-patch HEAD^

This will generate a file called C<001-your-commit-message.patch>, or more of
them if you made multiple commits; please attach these to your email.

(Note to the maintainers: you can apply these patches with the
C<git-am> command; it preserves meta information like author).
C<git-am -s> command; it preserves meta information like author).

Other ways to create and submit patches are discussed here:
L<http://wiki.github.com/rakudo/rakudo/steps-to-create-a-patch>.
Expand All @@ -210,7 +234,8 @@ See F<docs/compiler_overview.pod>.
=head1 AUTHOR

Patrick Michaud C<pmichaud@pobox.com> is the primary author and
maintainer for Rakudo Perl 6 on Parrot.
maintainer for Rakudo Perl 6 on Parrot. See F<CREDITS> for further
authors.

=cut

Expand Down
3 changes: 2 additions & 1 deletion build/Makefile.in
Expand Up @@ -252,6 +252,7 @@ CLEANUPS = \
$(PERL6_EXE) \
perl6.c \
perl6$(O) \
perl6_group.* \
Test.pir \
$(DYNEXT_DIR)/*$(LOAD_EXT) \
src/gen/core.pm \
Expand All @@ -273,7 +274,7 @@ CLEANUPS = \
$(OPS_DIR)/*.c \
$(OPS_DIR)/*$(O) \
$(OPS_DIR)/*$(LOAD_EXT) \
binder/*$(O) \
src/binder/*$(O) \

# NOTE: eventually, we should remove --keep-exit-code and --fudge
# as the goal is that all tests must pass without fudge
Expand Down
1 change: 1 addition & 0 deletions src/Perl6/Grammar.pm
Expand Up @@ -528,6 +528,7 @@ token term:sym<multi_declarator> { <?before 'multi'|'proto'|'only'> <multi_dec
token term:sym<regex_declarator> { <regex_declarator> }
token term:sym<circumfix> { <circumfix> }
token term:sym<statement_prefix> { <statement_prefix> }
token term:sym<**> { <sym> <.panic('HyperWhatever (**) not yet implemented')> }
token term:sym<*> { <sym> }
token term:sym<lambda> { <?lambda> <pblock> }
# token term:sym<sigterm> { <sigterm> } # see colonpair instead
Expand Down
30 changes: 25 additions & 5 deletions src/Perl6/Module/Loader.pm
Expand Up @@ -129,10 +129,22 @@ method stub_lexical_imports($name, $block_ast) {
pir::die("Can't import symbol " ~ $_.key
~ " because it already exists in this lexical scope\n");
} else {
$block_ast[0].push(PAST::Var.new(
:name($_.key), :scope('lexical'), :isdecl(1),
:viviself(PAST::Op.new( :pirop('null P')) )
));
if pir::isa($_.value, 'Perl6MultiSub') {
$block_ast[0].push(PAST::Var.new(
:name($_.key), :scope('lexical'), :isdecl(1),
:viviself(PAST::Op.new(
:pasttype<callmethod>, :name<incorporate_candidates>,
PAST::Op.new( :pirop<new__Ps>, 'Perl6MultiSub'),
PAST::Op.new( :pirop<find_lex_skip_current__Ps>, $_.key )
))
));
}
else {
$block_ast[0].push(PAST::Var.new(
:name($_.key), :scope('lexical'), :isdecl(1),
:viviself(PAST::Op.new( :pirop('null P')) )
));
}
$block_ast.symbol($_.key, :scope('lexical'));
}
}
Expand All @@ -151,7 +163,15 @@ method import($name) {
my %imports := self.get_imports($name);
unless pir::isnull__IP(%imports) {
for %imports {
$targetns{$_.key} := $_.value;
# If the symbol is a multi-sub, then we need to incorporate
# these new candidates into it. Otherwise, just install the
# symbol.
if pir::isa($_.value, 'Perl6MultiSub') {
$targetns{$_.key}.incorporate_candidates($_.value);
}
else {
$targetns{$_.key} := $_.value;
}
}
}

Expand Down
45 changes: 28 additions & 17 deletions src/core/operators.pm
Expand Up @@ -368,9 +368,13 @@ our multi sub infix:<...>(@lhs is copy, $rhs) {
}
}

my sub is-on-the-wrong-side($first , $before_last , $last , $limit) {
my sub is-on-the-wrong-side($first , $second , $third , $limit , $is-geometric-switching-sign) {
return Bool::False if $limit ~~ Whatever;
($before_last > $last && $limit > $first) || ($before_last < $last && $limit < $first);
if $is-geometric-switching-sign {
($second.abs >= $third.abs && $limit.abs > $first.abs) || ($second.abs <= $third.abs && $limit.abs < $first.abs);
} else {
($second >= $third && $limit > $first) || ($second <= $third && $limit < $first);
}
}

my $limit;
Expand All @@ -391,11 +395,11 @@ our multi sub infix:<...>(@lhs is copy, $rhs) {
if $diff == 0 {
$next = succ-or-pred2(@lhs[*-2], @lhs[*-1], $rhs)
} elsif @lhs.elems == 2 || @lhs[*-2] - @lhs[*-3] == $diff {
return Nil if is-on-the-wrong-side(@lhs[0] , @lhs[*-2] , @lhs[*-1] , $rhs);
return Nil if is-on-the-wrong-side(@lhs[0] , @lhs[*-2] , @lhs[*-1] , $rhs , Bool::False);
$next = { $_ + $diff };
} elsif @lhs[*-2] / @lhs[*-3] == @lhs[*-1] / @lhs[*-2] {
$is-geometric-switching-sign = (@lhs[*-2] * @lhs[*-1] < 0);
return Nil if is-on-the-wrong-side(@lhs[0] , @lhs[*-2] , @lhs[*-1] , $rhs) && !$is-geometric-switching-sign;
return Nil if is-on-the-wrong-side(@lhs[*-3] , @lhs[*-2] , @lhs[*-1] , $rhs , $is-geometric-switching-sign) ;
my $factor = @lhs[*-2] / @lhs[*-3];
if $factor ~~ ::Rat && $factor.denominator == 1 {
$factor = $factor.Int;
Expand All @@ -412,28 +416,35 @@ our multi sub infix:<...>(@lhs is copy, $rhs) {

gather {
my @args;
my $j;
my $previous;
my $top = $arity min @lhs.elems;
for @lhs.kv -> $i, $v {
$j = $v;
take $v;
@args.push($v) if $i >= @lhs.elems - $top;
}
my $lhs-orig-count = @lhs.elems ;
my $count=0;

if !$limit.defined || $limit cmp $j != 0 {
if @lhs || !$limit.defined || $limit cmp $previous != 0 {
loop {
my $i = $next.(|@args) // last;
my $j = $i;
@args.push(@lhs[0]) if @lhs && $count >= $lhs-orig-count - $top;
my $current = @lhs.shift() // $next.(|@args) // last;

my $cur_cmp = 1;
if $limit.defined {
$cur_cmp = $limit cmp $j;
last if (@args[*-1] cmp $limit) == $cur_cmp && !$is-geometric-switching-sign;
$cur_cmp = $limit cmp $current;
if $previous.defined {
my $previous_cmp = $previous cmp $limit;
if ($is-geometric-switching-sign) {
$cur_cmp = $limit.abs cmp $current.abs;
$previous_cmp = $previous.abs cmp $limit.abs;
}
last if @args && $previous_cmp == $cur_cmp ;
}
}
take $j;
$previous = $current;
take $current ;
$count++;

last if $cur_cmp == 0;

@args.push($j);
@args.push($previous) if $count > $lhs-orig-count;
while @args.elems > $arity {
@args.shift;
}
Expand Down
4 changes: 3 additions & 1 deletion t/spectest.data
Expand Up @@ -451,7 +451,7 @@ S12-methods/syntax.t
S12-methods/topic.t
S12-methods/typed-attributes.t
S12-methods/what.t
# S12-subset/multi-dispatch.t
S12-subset/multi-dispatch.t
# S12-subset/subtypes.t
S13-type-casting/methods.t
S13-overloading/typecasting-long.t
Expand Down Expand Up @@ -512,6 +512,7 @@ S32-array/rotate.t
S32-array/shift.t
S32-array/splice.t
S32-array/unshift.t
S32-basics/warn.t
# S32-container/zip.t
S32-hash/exists.t
S32-hash/delete.t
Expand Down Expand Up @@ -583,6 +584,7 @@ S32-str/ucfirst.t # icu
S32-str/uc.t # icu
# S32-str/unpack.t
S32-str/words.t # icu
S32-temporal/calendar.t
S32-temporal/Date.t
S32-temporal/DateTime.t
S32-trig/e.t
Expand Down

0 comments on commit d1f2e59

Please sign in to comment.