Hello community, here is the log from the commit of package nqp for openSUSE:Factory checked in at 2020-03-05 23:20:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nqp (Old) and /work/SRC/openSUSE:Factory/.nqp.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nqp" Thu Mar 5 23:20:07 2020 rev:32 rq:781562 version:2020.02 Changes: -------- --- /work/SRC/openSUSE:Factory/nqp/nqp.changes 2020-01-29 13:18:51.190184335 +0100 +++ /work/SRC/openSUSE:Factory/.nqp.new.26092/nqp.changes 2020-03-05 23:20:11.337241847 +0100 @@ -1,0 +2,12 @@ +Tue Mar 3 13:05:04 CET 2020 - [email protected] + +- update to version 2020.02 + * Fix for https://github.com/perl6/nqp/issues/559 + * Only do assignment if nfa is not in the cache + * cache_add returns the value, so no assignment needed + * Completely disable NFA debugging (for now) + * Don't call non-existent panic method + * Consistently make the `.` in `<.[x]>` a no-op + * Recognize `chain` as an assoc + +------------------------------------------------------------------- Old: ---- nqp-2020.01.tar.gz New: ---- nqp-2020.02.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nqp.spec ++++++ --- /var/tmp/diff_new_pack.4qtacO/_old 2020-03-05 23:20:12.369242415 +0100 +++ /var/tmp/diff_new_pack.4qtacO/_new 2020-03-05 23:20:12.373242417 +0100 @@ -1,7 +1,7 @@ # # spec file for package nqp # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,15 +17,15 @@ Name: nqp -Version: 2020.01 +Version: 2020.02 Release: 1.1 Summary: Not Quite Perl License: Artistic-2.0 Group: Development/Languages/Other URL: http://rakudo.org/ Source: nqp-%{version}.tar.gz -BuildRequires: moarvm-devel >= 2020.01 -Requires: moarvm >= 2020.01 +BuildRequires: moarvm-devel >= 2020.02 +Requires: moarvm >= 2020.02 BuildRoot: %{_tmppath}/%{name}-%{version}-build %description ++++++ nqp-2020.01.tar.gz -> nqp-2020.02.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/3rdparty/nqp-configure/lib/NQP/Config.pm new/nqp-2020.02/3rdparty/nqp-configure/lib/NQP/Config.pm --- old/nqp-2020.01/3rdparty/nqp-configure/lib/NQP/Config.pm 2020-01-27 20:43:47.000000000 +0100 +++ new/nqp-2020.02/3rdparty/nqp-configure/lib/NQP/Config.pm 2020-02-23 13:03:04.000000000 +0100 @@ -498,7 +498,7 @@ sub configure_repo_urls { my $self = shift; - # Pre-cach repo urls to make them available for makefiles. + # Pre-cache repo urls to make them available for makefiles. for my $r ( keys %{ $self->{repo_maps} } ) { $self->repo_url( $r, action => 'pull' ); $self->repo_url( $r, action => 'push' ); @@ -536,7 +536,9 @@ } unless ( defined $config->{make_family} ) { $self->sorry( - "Cannot determine the brand of your $config->{make} utility."); + "Cannot determine the brand of your $config->{make} utility." + . "\nIt is reporting itself as:\n" + . $buf ); } if ( $self->isa_unix ) { @@ -664,7 +666,7 @@ for my $opt ( qw<prefix rakudo-home nqp-home sdkroot sysroot github-user git-protocol rakudo-repo nqp-repo moar-repo roast-repo makefile-timing - relocatable reference> + relocatable git-cache-dir> ) { ( my $ckey = $opt ) =~ s/-/_/g; @@ -678,6 +680,12 @@ $config->{"opt_$cf_var"} = $opt_val; } + if ( $self->{options}{'git-reference'} ) { + print "===WARNING!===\n"; + print "The --git-reference option does not exist anymore.\n"; + print "Consider using --git-cache-dir instead.\n"; + } + $config->{stagestats} = '--stagestats' if $self->{options}{'makefile-timing'}; @@ -1076,13 +1084,9 @@ } sub reference_dir { - my $self = shift; - my $reference = $self->cfg('reference'); - for my $d (@_) { - my $dir = File::Spec->catdir( $reference, $d ); - return $dir if -d $dir; - } - return ''; + my ($self, $name) = @_; + my $git_cache_dir = $self->cfg('git_cache_dir'); + return File::Spec->catdir( $git_cache_dir, $name ); } sub git_checkout { @@ -1094,18 +1098,34 @@ my $config = $self->config; my $options = $self->{options}; my $pwd = cwd(); + my $pullurl = $self->repo_url( $repo, action => 'pull' ); + my $pushurl = $self->repo_url( $repo, action => 'push' ); + # Clone / fetch git reference repo + if ( $config->{git_cache_dir} ) { + my $ref_dir = + $self->reference_dir( $self->{repo_maps}{$repo}[1] ); + if ( !-d $ref_dir ) { + my @ref_args = ( 'git', 'clone', '--bare' ); + push @ref_args, "--depth=$options->{'git-depth'}" + if $options->{'git-depth'}; + push @ref_args, $pullurl, $ref_dir; + $self->msg("Cloning reference from $pullurl\n"); + system_or_die(@ref_args); + } + else { + chdir($ref_dir); + system_or_die( 'git', 'fetch' ); + chdir($pwd); + } + } # get an up-to-date repository if ( !-d $dir ) { - my ( $pullurl, $pushurl ) = ( - $self->repo_url( $repo, action => 'pull' ), - $self->repo_url( $repo, action => 'push' ), - ); my @args = ( 'git', 'clone' ); - if ( $config->{reference} ) { + if ( $config->{git_cache_dir} ) { my $ref_dir = - $self->reference_dir( $self->{repo_maps}{$repo}[1], $dir ); - die "Can't $repo repository directory in $config->{reference}" + $self->reference_dir( $self->{repo_maps}{$repo}[1] ); + die "Can't find $repo reference directory in $config->{git_cache_dir}" unless $ref_dir; push @args, "--reference=$ref_dir"; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/Configure.pl new/nqp-2020.02/Configure.pl --- old/nqp-2020.01/Configure.pl 2020-01-27 20:42:54.000000000 +0100 +++ new/nqp-2020.02/Configure.pl 2020-02-23 13:01:48.000000000 +0100 @@ -6,43 +6,22 @@ use warnings; use Text::ParseWords; use Getopt::Long; -use Cwd qw/abs_path cwd/; +use Cwd; use File::Spec; use File::Path; use FindBin; BEGIN { - if ( -d '.git' ) { - my $set_config = !qx{git config nqp.initialized}; - if ( !-e '3rdparty/nqp-configure/LICENSE' ) { - print "Updating nqp-configure submodule...\n"; - my $msg = -qx{git submodule sync --quiet 3rdparty/nqp-configure && git submodule --quiet update --init 3rdparty/nqp-configure 2>&1}; - if ( $? >> 8 == 0 ) { - say "OK"; - $set_config = 1; - } - else { - if ( $msg =~ - /[']([^']+)[']\s+already exists and is not an empty/ ) - { - print "\n===SORRY=== ERROR: " - . "Cannot update submodule because directory exists and is not empty.\n" - . ">>> Please delete the following folder and try again:\n$1\n\n"; - exit 1; - } - else { - print "\n===SORRY=== ERROR: " - . "Updating the submodule failed for an unknown reason. The error message was:\n" - . $msg; - exit 1; - } - } - } - if ($set_config) { - system("git config submodule.recurse true"); - system("git config nqp.initialized 1"); - } + # Download / Update submodules + my $set_config = !qx{git config nqp.initialized}; + if ( !-e '3rdparty/nqp-configure/LICENSE' ) { + my $code = system($^X, 'tools/build/update-submodules.pl', Cwd::cwd(), @ARGV); + exit 1 if $code >> 8 != 0; + $set_config = 1; + } + if ($set_config) { + system("git config submodule.recurse true"); + system("git config nqp.initialized 1"); } } @@ -71,12 +50,12 @@ 'with-jna=s', 'make-install!', 'makefile-timing!', 'git-protocol=s', 'ignore-errors!', 'link', - 'git-depth=s', 'git-reference=s', + 'git-depth=s', 'git-cache-dir=s', 'github-user=s', 'nqp-repo=s', 'moar-repo=s', 'expand=s', 'out=s', 'set-var=s@', 'relocatable!', 'silent-build!', - 'force-rebuild!' + 'force-rebuild!', 'git-reference=s' ) or do { print_help(); @@ -155,7 +134,8 @@ --sysroot=dir When given, use for searching runtime components here --nqp-home=dir Directory to install NQP files to --backends=list Backends to use: $backends - --gen-moar Download, build, and install a copy of MoarVM to use before writing the Makefile + --gen-moar Download, build, and install a copy of MoarVM to use + before writing the Makefile --force-rebuild Forces rebuild of moar if used with --gen-moar --moar-option='--option=value' Options to pass to MoarVM configuration for --gen-moar @@ -171,21 +151,23 @@ this github user. Note that the user must have all required repos forked from the originals. --nqp-repo=<url> - --moar-repo=<url> - User-defined URL to fetch corresponding components + --moar-repo=<url> User-defined URL to fetch corresponding components from. The URL will also be used to setup git push. --git-protocol={ssh,https,git} Protocol to use for git clone. Default: https --make-install Immediately run `MAKE install` after configuring --git-depth=<number> - Use the --git-depth option for git clone with parameter number - --git-reference=<path> - Use --git-reference option to identify local path where git repositories are stored - For example: --git-reference=/home/user/repo/for_perl6 - Folders 'nqp', 'MoarVM' with corresponding git repos should be in for_perl6 folder - --ignore-errors - Can ignore errors such as what version MoarVM or the JVM is. May not work for other - errors currently. + Use the --git-depth option for git clone with parameter + number + --git-cache-dir=<path> + Use the given path as a git repository cache. + For example: --git-cache-dir=/home/user/git_cache_dir + Each repository ('nqp' and its submodules) will use a + separate subfolder. + If the subfolder does not exist, it will be cloned. If + it exists the contained repository will be updated. + --ignore-errors Can ignore errors such as what version MoarVM or the JVM + is. May not work for other errors currently. --expand=<template> Expand template file. With this option Makefile is not generated. The result is send to stdout unless --out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/MANIFEST new/nqp-2020.02/MANIFEST --- old/nqp-2020.01/MANIFEST 2020-01-27 20:47:05.000000000 +0100 +++ new/nqp-2020.02/MANIFEST 2020-02-23 13:06:11.000000000 +0100 @@ -641,6 +641,7 @@ tools/build/install-jvm-runner.pl.in tools/build/npm-install-or-link.pl tools/build/process-qregex-tests +tools/build/update-submodules.pl tools/find-undocumented-ops.p6 tools/jvm/eval-client.pl tools/lib/NQP/Config/NQP.pm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/VERSION new/nqp-2020.02/VERSION --- old/nqp-2020.01/VERSION 2020-01-27 20:43:31.000000000 +0100 +++ new/nqp-2020.02/VERSION 2020-02-23 13:02:17.000000000 +0100 @@ -1 +1 @@ -2020.01 +2020.02 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/docs/ops.markdown new/nqp-2020.02/docs/ops.markdown --- old/nqp-2020.01/docs/ops.markdown 2020-01-27 20:42:54.000000000 +0100 +++ new/nqp-2020.02/docs/ops.markdown 2020-02-23 13:01:48.000000000 +0100 @@ -319,6 +319,7 @@ * [locallifetime](#locallifetime) * [const](#const) * [cpucores](#cpucores) + * [decodelocaltime](#decodelocaltime) * [getrusage](#getrusage) * [uname](#uname) * [debugnoop `jvm`](#debugnoop-jvm) @@ -2649,6 +2650,14 @@ Returns a native integer for the number of CPU cores that are reported to be available. +## decodelocaltime +* `decodelocaltime(int $epoch --> int @tm)` + +Returns an integer array with localtime information, formatted like the +`C struct tm`: $sec,$min,$hour,$mday,$mon,$year,$weekday,$yearday,$isdst. +Note that contrary to C's localtime() function, the $year contains the +actual year (A.D), and the $month has been normalized to 1..12. + ## getrusage * `getrusage(int @rusage)` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/src/HLL/Grammar.nqp new/nqp-2020.02/src/HLL/Grammar.nqp --- old/nqp-2020.01/src/HLL/Grammar.nqp 2020-01-27 20:42:54.000000000 +0100 +++ new/nqp-2020.02/src/HLL/Grammar.nqp 2020-02-23 13:01:48.000000000 +0100 @@ -510,7 +510,7 @@ @opstack[nqp::elems(@opstack)-1]<OPER>.Str, $infix.Str()); } - elsif $inassoc eq 'left' { + elsif $inassoc eq 'left' || $inassoc eq 'chain' { # left associative, reduce immediately self.EXPR_reduce(@termstack, @opstack); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/src/QRegex/Cursor.nqp new/nqp-2020.02/src/QRegex/Cursor.nqp --- old/nqp-2020.01/src/QRegex/Cursor.nqp 2020-01-27 20:42:54.000000000 +0100 +++ new/nqp-2020.02/src/QRegex/Cursor.nqp 2020-02-23 13:01:48.000000000 +0100 @@ -33,7 +33,7 @@ method !braid_init(:$grammar, :$actions, :$package, *%ignore) { my $new := nqp::create(self); - nqp::bindattr($new, Braid, '$!actions', $grammar); + nqp::bindattr($new, Braid, '$!grammar', $grammar); nqp::bindattr($new, Braid, '$!actions', $actions); nqp::bindattr($new, Braid, '$!package', $package); nqp::bindattr($new, Braid, '$!slangs', nqp::hash()); @@ -673,12 +673,10 @@ } # Evaluate the alternation. - my $nfa := self.HOW.cache_get(self, $name); - if nqp::isnull($nfa) { - $nfa := self.'!alt_nfa'($!regexsub, $name); - self.HOW.cache_add(self, $name, $nfa); - } - $nfa.run_alt(nqp::getattr_s($shared, ParseShared, '$!target'), $pos, $!bstack, $!cstack, @labels); + nqp::ifnull( + self.HOW.cache_get(self, $name), + self.HOW.cache_add(self, $name, self.'!alt_nfa'($!regexsub, $name)) + ).run_alt(nqp::getattr_s($shared, ParseShared, '$!target'), $pos, $!bstack, $!cstack, @labels); } method !alt_nfa($regex, str $name) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/src/QRegex/NFA.nqp new/nqp-2020.02/src/QRegex/NFA.nqp --- old/nqp-2020.01/src/QRegex/NFA.nqp 2020-01-27 20:42:54.000000000 +0100 +++ new/nqp-2020.02/src/QRegex/NFA.nqp 2020-02-23 13:01:48.000000000 +0100 @@ -27,26 +27,26 @@ my $EDGE_CHARRANGE_M_NEG := 23; my $ACTIONS; - my $nfadeb; +# my $nfadeb; my int $ind; - sub dentin() { - if $nfadeb { - $ind := $ind + 2; - nqp::x(' ', nqp::if($ind >= 0, $ind, 0)); - } - else { '' } - } - - sub dentout($x) { - if $nfadeb { - $ind := $ind - 2; - if $ind < 0 { - note(" inconsistent indentation! NFA debugger tried to dentout to $ind."); - } - } - $x; - } +# sub dentin() { +# if $nfadeb { +# $ind := $ind + 2; +# nqp::x(' ', nqp::if($ind >= 0, $ind, 0)); +# } +# else { '' } +# } + +# sub dentout($x) { +# if $nfadeb { +# $ind := $ind - 2; +# if $ind < 0 { +# note(" inconsistent indentation! NFA debugger tried to dentout to $ind."); +# } +# } +# $x; +# } # The build-time set of states, with element zero being the fate name # list. @@ -78,18 +78,19 @@ } method addstate() { - my $indent := dentin(); +# my $indent := dentin(); my int $id := +$!states; - note("$indent addstate $id") if $nfadeb; +# note("$indent addstate $id") if $nfadeb; $!states[$id] := []; - dentout($id); +# dentout($id); + $id } method addedge($from, $to, $action, $value, :$newedge = 1) { - my $indent := dentin(); +# my $indent := dentin(); my $v := nqp::istype($value, QAST::SVal) ?? $value.value !! $value; my $vv := $action == $EDGE_SUBRULE ?? "" !! $v; - note("$indent addedge $from -> $to {$ACTIONS[nqp::bitand_i($action,0xff)] // 'unk'}") if $nfadeb; +# note("$indent addedge $from -> $to {$ACTIONS[nqp::bitand_i($action,0xff)] // 'unk'}") if $nfadeb; $!edges := 1 if $newedge; $to := self.addstate() if $to < 0; my $st := $!states[$from]; @@ -107,49 +108,53 @@ nqp::push($st, $action); nqp::push($st, $v); nqp::push($st, $to); - dentout($to); +# dentout($to); + $to } method states() { $!states } method addnode($node, :$*vars_as_generic) { - my $indent := dentin(); - note("$indent addnode") if $nfadeb; - # nqp::die("HERE") if $nfadeb && $nfadeb++ == 2; +# my $indent := dentin(); +# note("$indent addnode") if $nfadeb; +# # nqp::die("HERE") if $nfadeb && $nfadeb++ == 2; self.regex_nfa($node, 1, 0); $!LITEND := 0; - self.mydump() if $nfadeb; - dentout(self); +# self.mydump() if $nfadeb; +# dentout(self); + self } method regex_nfa($node, $from, $to) { - my $indent := dentin(); +# my $indent := dentin(); my $method := ($node.rxtype // 'concat'); - note("$indent regex_nfa $from -> $to $method") if $nfadeb; +# note("$indent regex_nfa $from -> $to $method") if $nfadeb; $!LITEND := 1 unless $method eq 'literal' || $method eq 'concat' || $method eq 'alt'; my $result := self.HOW.can(self, $method) ?? self."$method"($node, $from, $to) !! self.fate($node, $from, $to); - note("$indent ...regex_nfa returns $result") if $nfadeb; +# note("$indent ...regex_nfa returns $result") if $nfadeb; - dentout($result); +# dentout($result); + $result } method fate($node, $from, $to) { - my $indent := dentin(); - note("$indent fate $from -> $to") if $nfadeb; - dentout(self.addedge($from, 0, $EDGE_FATE, 0, :newedge(0))); +# my $indent := dentin(); +# note("$indent fate $from -> $to") if $nfadeb; +# dentout(self.addedge($from, 0, $EDGE_FATE, 0, :newedge(0))); + self.addedge($from, 0, $EDGE_FATE, 0, :newedge(0)); } method alt($node, $from, $to) { - my $indent := dentin(); - note($node.dump) if $nfadeb; +# my $indent := dentin(); +# note($node.dump) if $nfadeb; my $litendfront := $!LITEND; my $litendback; for $node.list { - note("$indent alternative") if $nfadeb; +# note("$indent alternative") if $nfadeb; $!LITEND := $litendfront; my int $st := self.regex_nfa($_, $from, $to); @@ -160,18 +165,20 @@ } # stop litlen at recombination unless all alts are pure literal $!LITEND := $litendback; - dentout($to); +# dentout($to); + $to; } method altseq($node, $from, $to) { if nqp::elems(@($node)) { - my $indent := dentin(); +# my $indent := dentin(); my int $st := self.regex_nfa($node[0], $from, $to); $to := $st if $to < 0 && $st > 0; $st := self.addedge($from, $to, $EDGE_EPSILON, 0); $to := $st if $to < 0 && $st > 0; - note("$indent ...altseq returns $to") if $nfadeb; - dentout($to); +# note("$indent ...altseq returns $to") if $nfadeb; +# dentout($to); + $to; } else { self.fate($node, $from, $to); @@ -193,7 +200,7 @@ %cclass_code<s> := nqp::const::CCLASS_WHITESPACE; %cclass_code<w> := nqp::const::CCLASS_WORD; %cclass_code<n> := nqp::const::CCLASS_NEWLINE; - $nfadeb := nqp::existskey(nqp::getenvhash(),'NQP_NFA_DEB'); +# $nfadeb := nqp::existskey(nqp::getenvhash(),'NQP_NFA_DEB'); $ACTIONS := ['FATE','EPSILON','CODEPOINT','CODEPOINT_NEG','CHARCLASS', 'CHARCLASS_NEG','CHARLIST','CHARLIST_NEG','SUBRULE','CODEPOINT_I', 'CODEPOINT_I_NEG','GENERIC_VAR','CHARRANGE','CHARRANGE_NEG', @@ -203,42 +210,47 @@ } method cclass($node, $from, $to) { - my $indent := dentin(); - dentout(self.addedge($from, $to, $EDGE_CHARCLASS + ?$node.negate, - %cclass_code{ $node.name })); +# my $indent := dentin(); +# dentout(self.addedge($from, $to, $EDGE_CHARCLASS + ?$node.negate, +# %cclass_code{ $node.name })); + self.addedge($from, $to, $EDGE_CHARCLASS + ?$node.negate, + %cclass_code{ $node.name }); } method concat($node, $from, $to) { - my $indent := dentin(); - note("$indent concat $from -> $to") if $nfadeb; +# my $indent := dentin(); +# note("$indent concat $from -> $to") if $nfadeb; my int $i := 0; my int $n := +$node.list - 1; while $from > 0 && $i < $n { $from := self.regex_nfa($node[$i], $from, -1); $i := $i + 1; } - note("$indent ...concat created $from, n = $n") if $nfadeb; +# note("$indent ...concat created $from, n = $n") if $nfadeb; my $result := $from > 0 && $n >= 0 ?? self.regex_nfa($node[$i], $from, $to) !! $to; - note("$indent ...concat returns $result") if $nfadeb; - dentout($result); +# note("$indent ...concat returns $result") if $nfadeb; +# dentout($result); + $result; } method enumcharlist($node, $from, $to) { - my $indent := dentin(); - note("$indent enumcharlist $from -> $to") if $nfadeb; +# my $indent := dentin(); +# note("$indent enumcharlist $from -> $to") if $nfadeb; my $charlist := $node[0]; if $node.subtype eq 'zerowidth' { $from := self.addedge($from, -1, $EDGE_CHARLIST + ?$node.negate, $charlist); - dentout(self.addedge($from, 0, $EDGE_FATE, 0)); +# dentout(self.addedge($from, 0, $EDGE_FATE, 0)); + self.addedge($from, 0, $EDGE_FATE, 0); } else { - dentout(self.addedge($from, $to, $EDGE_CHARLIST + ?$node.negate, $charlist)); +# dentout(self.addedge($from, $to, $EDGE_CHARLIST + ?$node.negate, $charlist)); + self.addedge($from, $to, $EDGE_CHARLIST + ?$node.negate, $charlist); } } method charrange($node, $from, $to) { - my $indent := dentin(); - note("$indent charrange $from -> $to") if $nfadeb; +# my $indent := dentin(); +# note("$indent charrange $from -> $to") if $nfadeb; my $base_edge := $node[0] eq 'ignoremark' || $node[0] eq 'ignorecase+ignoremark' ?? $EDGE_CHARRANGE_M !! $EDGE_CHARRANGE; @@ -266,7 +278,8 @@ $to := $result if $to < 0 && $result > 0; } } - dentout($result) +# dentout($result) + $result } # Synthetics must be conveyed as strings; anything else can go as an @@ -278,11 +291,11 @@ } method literal($node, $from, $to) { - my $indent := dentin(); +# my $indent := dentin(); my int $litlen := nqp::chars($node[0]) - 1; my int $i := 0; if $litlen >= 0 { - note("$indent literal $from -> $to {$node[0]}") if $nfadeb; +# note("$indent literal $from -> $to {$node[0]}") if $nfadeb; if $node.subtype eq 'ignorecase' { my str $litconst_lc := nqp::lc($node[0]); my str $litconst_uc := nqp::uc($node[0]); @@ -291,8 +304,10 @@ [ord-or-str($litconst_lc, $i), ord-or-str($litconst_uc, $i)]); $i := $i + 1; } - dentout(self.addedge($from, $to, $!LITEND ?? $EDGE_CODEPOINT_I !! $EDGE_CODEPOINT_I_LL, - [ord-or-str($litconst_lc, $i), ord-or-str($litconst_uc, $i)])); +# dentout(self.addedge($from, $to, $!LITEND ?? $EDGE_CODEPOINT_I !! $EDGE_CODEPOINT_I_LL, +# [ord-or-str($litconst_lc, $i), ord-or-str($litconst_uc, $i)])); + self.addedge($from, $to, $!LITEND ?? $EDGE_CODEPOINT_I !! $EDGE_CODEPOINT_I_LL, + [ord-or-str($litconst_lc, $i), ord-or-str($litconst_uc, $i)]); } elsif $node.subtype eq 'ignoremark' { my str $litconst := $node[0]; @@ -300,7 +315,8 @@ $from := self.addedge($from, -1, $EDGE_CODEPOINT_M, nqp::ordbaseat($litconst, $i)); $i := $i + 1; } - dentout(self.addedge($from, $to, $EDGE_CODEPOINT_M, nqp::ordbaseat($litconst, $i))); +# dentout(self.addedge($from, $to, $EDGE_CODEPOINT_M, nqp::ordbaseat($litconst, $i))); + self.addedge($from, $to, $EDGE_CODEPOINT_M, nqp::ordbaseat($litconst, $i)); # XXX $EDGE_CODEPOINT_M_LL ? } elsif $node.subtype eq 'ignorecase+ignoremark' { @@ -311,8 +327,10 @@ [nqp::ordbaseat($litconst_lc, $i), nqp::ordbaseat($litconst_uc, $i)]); $i := $i + 1; } - dentout(self.addedge($from, $to, $EDGE_CODEPOINT_IM, - [nqp::ordbaseat($litconst_lc, $i), nqp::ordbaseat($litconst_uc, $i)])); +# dentout(self.addedge($from, $to, $EDGE_CODEPOINT_IM, +# [nqp::ordbaseat($litconst_lc, $i), nqp::ordbaseat($litconst_uc, $i)])); + self.addedge($from, $to, $EDGE_CODEPOINT_IM, + [nqp::ordbaseat($litconst_lc, $i), nqp::ordbaseat($litconst_uc, $i)]); # XXX $EDGE_CODEPOINT_IM_LL ? } else { @@ -321,25 +339,29 @@ $from := self.addedge($from, -1, $EDGE_CODEPOINT, ord-or-str($litconst, $i)); $i := $i + 1; } - dentout(self.addedge($from, $to, $!LITEND ?? $EDGE_CODEPOINT !! $EDGE_CODEPOINT_LL, - ord-or-str($litconst, $i))); +# dentout(self.addedge($from, $to, $!LITEND ?? $EDGE_CODEPOINT !! $EDGE_CODEPOINT_LL, +# ord-or-str($litconst, $i))); + self.addedge($from, $to, $!LITEND ?? $EDGE_CODEPOINT !! $EDGE_CODEPOINT_LL, + ord-or-str($litconst, $i)); } } else { - note("$indent literal $from -> $to ''") if $nfadeb; - dentout(self.addedge($from, $to, $EDGE_EPSILON, 0)); +# note("$indent literal $from -> $to ''") if $nfadeb; +# dentout(self.addedge($from, $to, $EDGE_EPSILON, 0)); + self.addedge($from, $to, $EDGE_EPSILON, 0); } } method subrule($node, $from, $to) { - my $indent := dentin(); +# my $indent := dentin(); my $subtype := $node.subtype; - note("$indent subrule $from -> $to {$node.name}") if $nfadeb; +# note("$indent subrule $from -> $to {$node.name}") if $nfadeb; if $node.name eq 'before' && !$node.negate && nqp::istype((try $node[0][1].ann('orig_qast')), QAST::Regex) { my int $end := self.addstate(); self.regex_nfa($node[0][1].ann('orig_qast'), $from, $end); - dentout(self.fate($node, $end, $to)); +# dentout(self.fate($node, $end, $to)); + self.fate($node, $end, $to); } elsif $subtype ne 'zerowidth' && ($node.name eq 'alpha' || @@ -348,14 +370,16 @@ ?? $node[0][0].value !! $node[0][0]) eq 'alpha') { $to := self.addedge($from, $to, $EDGE_CHARCLASS + $node.negate, nqp::const::CCLASS_ALPHABETIC); - dentout(self.addedge($from, $to, $EDGE_CODEPOINT + $node.negate, 95)); +# dentout(self.addedge($from, $to, $EDGE_CODEPOINT + $node.negate, 95)); + self.addedge($from, $to, $EDGE_CODEPOINT + $node.negate, 95); } elsif !$node.negate && ($node.name eq 'ws' || $subtype eq 'method' && (nqp::istype($node[0][0], QAST::SVal) ?? $node[0][0].value !! $node[0][0]) eq 'ws') { - dentout(self.fate($node, $from, $to)); +# dentout(self.fate($node, $from, $to)); + self.fate($node, $from, $to); } elsif !$node.negate && $subtype ne 'zerowidth' && ($node.name eq 'ident' || @@ -374,16 +398,19 @@ self.addedge($midstate, $second, $EDGE_CHARCLASS, nqp::const::CCLASS_WORD); self.addedge($second, $midstate, $EDGE_EPSILON, 0); $to := self.addedge($midstate, $to, $EDGE_EPSILON, 0); - dentout($to); +# dentout($to); + $to; } elsif $subtype eq 'zerowidth' { if $node.negate { - dentout(self.fate($node, $from, $to)) +# dentout(self.fate($node, $from, $to)) + self.fate($node, $from, $to) } else { my int $end := self.addstate(); self.addedge($from, $end, $EDGE_SUBRULE, $node.name); - dentout(self.fate($node, $end, $to)); +# dentout(self.fate($node, $end, $to)); + self.fate($node, $end, $to); } } elsif $*vars_as_generic && $subtype eq 'method' && @@ -392,20 +419,24 @@ && nqp::istype($node[0][1], QAST::Var) && $node[0][1].scope eq 'lexical' { $!generic := 1; - dentout(self.addedge($from, $to, $EDGE_GENERIC_VAR, $node[0][1].name)); +# dentout(self.addedge($from, $to, $EDGE_GENERIC_VAR, $node[0][1].name)); + self.addedge($from, $to, $EDGE_GENERIC_VAR, $node[0][1].name); } else { - dentout($subtype eq 'capture' && $node[1] +# dentout($subtype eq 'capture' && $node[1] +# ?? self.regex_nfa($node[1], $from, $to) +# !! self.addedge($from, $to, $EDGE_SUBRULE, $node[0][0])) + $subtype eq 'capture' && $node[1] ?? self.regex_nfa($node[1], $from, $to) - !! self.addedge($from, $to, $EDGE_SUBRULE, $node[0][0])) + !! self.addedge($from, $to, $EDGE_SUBRULE, $node[0][0]) } } method quant($node, $from, $to) { - my $indent := dentin(); +# my $indent := dentin(); my int $min := 0 + ($node.min // 0); my int $max := 0 + ($node.max // -1); # -1 means Inf - note("$indent quant $from -> $to $min $max") if $nfadeb; +# note("$indent quant $from -> $to $min $max") if $nfadeb; if $max > 1 || $min > 1 { my int $count := 0; @@ -414,7 +445,7 @@ while $count < $max || $count < $min { if $count >= $min { $st := self.addedge($from, $to, $EDGE_EPSILON, 0); - note("$indent ...quant sf = $st") if $nfadeb; +# note("$indent ...quant sf = $st") if $nfadeb; } if $has_sep && $count > 0 { $from := self.regex_nfa($node[1], $from, -1); @@ -436,8 +467,9 @@ self.regex_nfa($node[0], $from, $looper); } $to := $st if $to < 0 && $st > 0; - note("$indent ...quant returns $to with st = $st") if $nfadeb; - return dentout($to); +# note("$indent ...quant returns $to with st = $st") if $nfadeb; +# return dentout($to); + return $to; } if $max == -1 { if $min == 0 { # * quantifier @@ -445,7 +477,7 @@ my int $start := self.addstate(); self.addedge($from, $start, $EDGE_EPSILON, 0); my int $looper := self.addstate(); - note("$indent ...in quant *%, start = $start, looper = $looper") if $nfadeb; +# note("$indent ...in quant *%, start = $start, looper = $looper") if $nfadeb; my int $st := self.regex_nfa($node[0], $start, $looper); self.regex_nfa($node[1], $looper, $start); self.addedge($looper, $to, $EDGE_EPSILON, 0) unless $to < 0; @@ -453,7 +485,7 @@ $to := $st if $to < 0 && $st > 0; } else { - note("$indent ...in quant *") if $nfadeb; +# note("$indent ...in quant *") if $nfadeb; self.regex_nfa($node[0], $from, $from); my int $st := self.addedge($from, $to, $EDGE_EPSILON, 0); $to := $st if $to < 0 && $st > 0; @@ -462,59 +494,67 @@ my int $start := self.addstate(); self.addedge($from, $start, $EDGE_EPSILON, 0); my int $looper := self.addstate(); - note("$indent ...in quant +, start = $start, looper = $looper") if $nfadeb; +# note("$indent ...in quant +, start = $start, looper = $looper") if $nfadeb; my int $st := self.regex_nfa($node[0], $start, $looper); if nqp::defined($node[1]) { self.regex_nfa($node[1], $looper, $start); } else { - note("$indent ...in quant +, no node[1]") if $nfadeb; +# note("$indent ...in quant +, no node[1]") if $nfadeb; self.addedge($looper, $start, $EDGE_EPSILON, 0); } self.addedge($looper, $to, $EDGE_EPSILON, 0) unless $to < 0; $to := $st if $to < 0 && $st > 0; } - note("$indent ...quant returns $to") if $nfadeb; - dentout($to); +# note("$indent ...quant returns $to") if $nfadeb; +# dentout($to); + $to; } elsif $min == 0 && $max == 1 { # ? quantifier my int $st := self.regex_nfa($node[0], $from, $to); $to := $st if $to < 0 && $st > 0; $st := self.addedge($from, $to, $EDGE_EPSILON, 0); $to := $st if $to < 0 && $st > 0; - note("$indent ...quant returns $to") if $nfadeb; - dentout($to); +# note("$indent ...quant returns $to") if $nfadeb; +# dentout($to); + $to; } else { - note("$indent ...quant returns fate") if $nfadeb; - dentout(self.fate($node, $from, $to)) +# note("$indent ...quant returns fate") if $nfadeb; +# dentout(self.fate($node, $from, $to)) + self.fate($node, $from, $to) } } method qastnode($node, $from, $to) { - my $indent := dentin(); - note("$indent qastnode $from -> $to") if $nfadeb; - dentout($node.subtype eq 'zerowidth' || $node.subtype eq 'declarative' ?? +# my $indent := dentin(); +# note("$indent qastnode $from -> $to") if $nfadeb; +# dentout($node.subtype eq 'zerowidth' || $node.subtype eq 'declarative' ?? +# self.addedge($from, $to, $EDGE_EPSILON, 0) !! +# self.fate($node, $from, $to)); + $node.subtype eq 'zerowidth' || $node.subtype eq 'declarative' ?? self.addedge($from, $to, $EDGE_EPSILON, 0) !! - self.fate($node, $from, $to)); + self.fate($node, $from, $to); } method subcapture($node, $from, $to) { - my $indent := dentin(); - note("$indent subcapture $from -> $to") if $nfadeb; - dentout(self.regex_nfa($node[0], $from, $to)); +# my $indent := dentin(); +# note("$indent subcapture $from -> $to") if $nfadeb; +# dentout(self.regex_nfa($node[0], $from, $to)); + self.regex_nfa($node[0], $from, $to); } method save(:$non_empty) { - my $indent := dentin(); - note("$indent save") if $nfadeb; +# my $indent := dentin(); +# note("$indent save") if $nfadeb; unless $!edges { return 0 unless $non_empty; self.addedge(1, 0, $EDGE_FATE, 0, :newedge(1)) } - dentout($!states) +# dentout($!states) + $!states } method mergesubrule(int $start, int $to, int $fate, $cursor, $name, %caller_seen?) { - my $indent := dentin(); +# my $indent := dentin(); my %seen := nqp::clone(%caller_seen); my @substates; my $meth; @@ -522,7 +562,7 @@ if nqp::istype($name,QAST::Var) { $meth := $name.ann('coderef'); $n := $meth.name; - note("$indent mergesubrule $n start $start to $to fate $fate") if $nfadeb; +# note("$indent mergesubrule $n start $start to $to fate $fate") if $nfadeb; if !nqp::existskey(%seen, $n) { if nqp::can($meth, 'NFA') { @substates := $meth.NFA(); @@ -531,11 +571,11 @@ %seen{$n} := 1; } else { - note("$indent ...skipping $n to avoid left recursion") if $nfadeb; +# note("$indent ...skipping $n to avoid left recursion") if $nfadeb; } } elsif nqp::can($cursor, $name) { - note("$indent mergesubrule $name start $start to $to fate $fate") if $nfadeb; +# note("$indent mergesubrule $name start $start to $to fate $fate") if $nfadeb; $n := $name; if !nqp::existskey(%seen, $name) { $meth := nqp::can($cursor.HOW, 'traced') && $cursor.HOW.traced($cursor) @@ -562,64 +602,65 @@ %seen{$name} := 1; } else { - note("$indent ...skipping $name to avoid left recursion") if $nfadeb; - } - } - if $nfadeb { - my int $s := 1; - my int $send := +@substates; - my int $bad := 0; - while $s < $send { - my $edges := @substates[$s]; - if +$edges == 0 { - note("$indent ...Bad at $s:"); - $bad := $bad + 1; - } - $s := $s + 1; - } - if $bad > 0 { - note("$indent ...attempt to merge $bad empty states from $n"); - note("Fates:"); - for @substates[0] -> $f { - note("\t$f"); - } - note(""); - $s := 1; - while $s < $send { - note("$s:"); - for @substates[$s] -> $a, $v, $t { - my int $act := nqp::bitand_i($a,0xff); - my $action := $ACTIONS[$act]; - if $act == $EDGE_CODEPOINT || $act == $EDGE_CODEPOINT_LL { - note("\t$t $action " ~ nqp::chr($v)); - } - elsif $act == $EDGE_FATE { - note("\t$t $action " ~ $v); - } - elsif $act == $EDGE_CHARCLASS || $act == $EDGE_CHARCLASS_NEG { - note("\t$t $action " ~ $v ~ "\n"); - } - elsif $act == $EDGE_CHARLIST || $act == $EDGE_CHARLIST_NEG { - note("\t$t $action " ~ $v ~ "\n"); - } - elsif $act == $EDGE_SUBRULE && nqp::istype($v,BOOTStr) { - note("\t$t $action " ~ $v ~ "\n"); - } - else { - note("\t$t $action\n"); - } - } - note("\n"); - $s := $s + 1; - } +# note("$indent ...skipping $name to avoid left recursion") if $nfadeb; } } - dentout(self.mergesubstates($start, $to, $fate, @substates, $cursor, %seen)); +# if $nfadeb { +# my int $s := 1; +# my int $send := +@substates; +# my int $bad := 0; +# while $s < $send { +# my $edges := @substates[$s]; +# if +$edges == 0 { +# note("$indent ...Bad at $s:"); +# $bad := $bad + 1; +# } +# $s := $s + 1; +# } +# if $bad > 0 { +# note("$indent ...attempt to merge $bad empty states from $n"); +# note("Fates:"); +# for @substates[0] -> $f { +# note("\t$f"); +# } +# note(""); +# $s := 1; +# while $s < $send { +# note("$s:"); +# for @substates[$s] -> $a, $v, $t { +# my int $act := nqp::bitand_i($a,0xff); +# my $action := $ACTIONS[$act]; +# if $act == $EDGE_CODEPOINT || $act == $EDGE_CODEPOINT_LL { +# note("\t$t $action " ~ nqp::chr($v)); +# } +# elsif $act == $EDGE_FATE { +# note("\t$t $action " ~ $v); +# } +# elsif $act == $EDGE_CHARCLASS || $act == $EDGE_CHARCLASS_NEG { +# note("\t$t $action " ~ $v ~ "\n"); +# } +# elsif $act == $EDGE_CHARLIST || $act == $EDGE_CHARLIST_NEG { +# note("\t$t $action " ~ $v ~ "\n"); +# } +# elsif $act == $EDGE_SUBRULE && nqp::istype($v,BOOTStr) { +# note("\t$t $action " ~ $v ~ "\n"); +# } +# else { +# note("\t$t $action\n"); +# } +# } +# note("\n"); +# $s := $s + 1; +# } +# } +# } +# dentout(self.mergesubstates($start, $to, $fate, @substates, $cursor, %seen)); + self.mergesubstates($start, $to, $fate, @substates, $cursor, %seen); } method mergesubstates(int $start, int $to, int $fate, @substates, $cursor, %seen?) { - my $indent := dentin(); - note("$indent mergesubstates start $start to $to fate $fate") if $nfadeb; +# my $indent := dentin(); +# note("$indent mergesubstates start $start to $to fate $fate") if $nfadeb; $!states[0][$fate] := $fate; # overridden by !protoregex_nfa if @substates { # create an empty end state for the subrule's NFA @@ -671,12 +712,16 @@ $i := $i + 1; } self.addedge($start, $substart+1, $EDGE_EPSILON, 0); - dentout($to > 0 +# dentout($to > 0 +# ?? self.addedge($substart, $to, $EDGE_EPSILON, 0) +# !! self.addedge($substart, 0, $EDGE_FATE, $fate)) + $to > 0 ?? self.addedge($substart, $to, $EDGE_EPSILON, 0) - !! self.addedge($substart, 0, $EDGE_FATE, $fate)) + !! self.addedge($substart, 0, $EDGE_FATE, $fate) } else { - dentout(self.addedge($start, 0, $EDGE_FATE, $fate)); +# dentout(self.addedge($start, 0, $EDGE_FATE, $fate)); + self.addedge($start, 0, $EDGE_FATE, $fate); } } @@ -685,7 +730,7 @@ method run(str $target, int $offset) { unless nqp::isconcrete($!nfa_object) { - self.mydump() if $nfadeb; +# self.mydump() if $nfadeb; nqp::scwbdisable(); $!nfa_object := nqp::nfafromstatelist($!states, NFAType); nqp::scwbenable(); @@ -696,7 +741,7 @@ method run_alt(str $target, int $offset, $bstack, $cstack, @labels) { unless nqp::isconcrete($!nfa_object) { - self.mydump() if $nfadeb; +# self.mydump() if $nfadeb; nqp::scwbdisable(); $!nfa_object := nqp::nfafromstatelist($!states, NFAType); nqp::scwbenable(); @@ -767,15 +812,15 @@ method optimize() { my int $send := nqp::elems($!states); - note("------------------------------------------\n $send states") if $nfadeb; - $ind := 0 if $nfadeb; +# note("------------------------------------------\n $send states") if $nfadeb; +# $ind := 0 if $nfadeb; if $send > 3 { my $remap := nqp::list_i(); nqp::setelems($remap, $send + 1); my $refs := nqp::list_i(); nqp::setelems($refs, $send + 1); - self.mydump() if $nfadeb; +# self.mydump() if $nfadeb; # first pass, remember single-edge epsilon states my int $s := 1; @@ -813,7 +858,7 @@ # } # unlink all the empty epsilons, count resulting refs to each state - note("now $send states before unlinking empties") if $nfadeb; +# note("now $send states before unlinking empties") if $nfadeb; $s := 1; while $s < $send { if nqp::atpos_i($remap,$s) && $s > 1 { @@ -829,7 +874,7 @@ if $to && nqp::atpos_i($remap,$to) { while nqp::atpos_i($remap,$to) { $to := nqp::atpos_i($remap,$to); - note(" chasing $was to $to") if $nfadeb; +# note(" chasing $was to $to") if $nfadeb; } $edges[$e] := $to; } @@ -840,9 +885,9 @@ $s := $s + 1; } - self.mydump() if $nfadeb; +# self.mydump() if $nfadeb; # replace epsilons to single edge, single ref states - note("now $send states before stealing singleton edges") if $nfadeb; +# note("now $send states before stealing singleton edges") if $nfadeb; $s := 1; while $s < $send { my $edges := $!states[$s]; @@ -856,7 +901,7 @@ if $to { my $sedges := $!states[$to]; if +$sedges == 3 { - note(" $s stealing $to") if $nfadeb; +# note(" $s stealing $to") if $nfadeb; $edges[$e] := $sedges[0]; $edges[$e + 1] := $sedges[1]; $edges[$e + 2] := $sedges[2]; @@ -871,10 +916,10 @@ } $s := $s + 1; } - self.mydump() if $nfadeb; +# self.mydump() if $nfadeb; # build resequence map for states that still have any edges - note("now $send states before calculating remap") if $nfadeb; +# note("now $send states before calculating remap") if $nfadeb; my int $newend := 1; $s := 1; while $s < $send { @@ -900,8 +945,8 @@ # } # now move the states and remap the edges (if, in fact, any states were removed) - self.mydump() if $nfadeb; - note("now $send states mapping to $newend states") if $nfadeb; +# self.mydump() if $nfadeb; +# note("now $send states mapping to $newend states") if $nfadeb; if $newend < $send { my $newstates := nqp::list(); nqp::setelems($newstates, $newend); @@ -921,7 +966,7 @@ my int $act := nqp::bitand_i($edges[$e-2], 0xff); if $to { my int $to2 := nqp::atpos_i($remap,$to); - note("In $s -> $newpos remapping " ~ $ACTIONS[$act] ~ " $to -> $to2") if $nfadeb; +# note("In $s -> $newpos remapping " ~ $ACTIONS[$act] ~ " $to -> $to2") if $nfadeb; $edges[$e] := $to2; } $e := $e + 3; @@ -934,7 +979,7 @@ my int $f := 0; while $f < $e { if $act == $edges[$f] && $edges[$e+2] == $edges[$f+2] && $edges[$e+1] == $edges[$f+1] { - note("Deleting dup edge at $s $e/$f") if $nfadeb; +# note("Deleting dup edge at $s $e/$f") if $nfadeb; $f := $e; nqp::splice($edges,[],$e,3); $e := $e - 3; @@ -947,17 +992,17 @@ } } else { - note("False mapping for $s") if $nfadeb; +# note("False mapping for $s") if $nfadeb; } } else { - note("Skipping $s") if $nfadeb; +# note("Skipping $s") if $nfadeb; } $s := $s + 1; } nqp::bindattr(self, QRegex::NFA, '$!states', $newstates); } - self.mydump() if $nfadeb; +# self.mydump() if $nfadeb; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/src/QRegex/P6Regex/Actions.nqp new/nqp-2020.02/src/QRegex/P6Regex/Actions.nqp --- old/nqp-2020.01/src/QRegex/P6Regex/Actions.nqp 2020-01-27 20:42:54.000000000 +0100 +++ new/nqp-2020.02/src/QRegex/P6Regex/Actions.nqp 2020-02-23 13:01:48.000000000 +0100 @@ -552,8 +552,10 @@ method assertion:sym<method>($/) { my $qast := $<assertion>.ast; - $qast.subtype('method'); - $qast.name(''); + if $qast.rxtype eq 'subrule' { + $qast.subtype('method'); + $qast.name(''); + } make $qast; } @@ -580,7 +582,7 @@ else { $loc := nqp::index(%*RX<name>, ':'); my $angleloc := nqp::index(%*RX<name>, '<', $loc); - $angleloc := nqp::index(%*RX<name>, '«', $loc) if $angleloc < 0; + $angleloc := nqp::index(%*RX<name>, '«', $loc) if $angleloc < 0; $rxname := nqp::substr(%*RX<name>, $loc + 1, $angleloc - $loc - 1) unless $loc < 0; } if $loc >= 0 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/src/vm/moar/QAST/QASTRegexCompilerMAST.nqp new/nqp-2020.02/src/vm/moar/QAST/QASTRegexCompilerMAST.nqp --- old/nqp-2020.01/src/vm/moar/QAST/QASTRegexCompilerMAST.nqp 2020-01-27 20:42:54.000000000 +0100 +++ new/nqp-2020.02/src/vm/moar/QAST/QASTRegexCompilerMAST.nqp 2020-02-23 13:01:48.000000000 +0100 @@ -453,7 +453,7 @@ method cclass($node) { my $subtype := $node.name; my $cclass := %cclass_code{ $subtype }; - self.panic("Unrecognized subtype '$subtype' in QAST::Regex cclass") + nqp::die("Unrecognized subtype '$subtype' in QAST::Regex cclass") unless $cclass; my $itmp := $!regalloc.fresh_i(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/tools/build/update-submodules.pl new/nqp-2020.02/tools/build/update-submodules.pl --- old/nqp-2020.01/tools/build/update-submodules.pl 1970-01-01 01:00:00.000000000 +0100 +++ new/nqp-2020.02/tools/build/update-submodules.pl 2020-02-23 13:01:48.000000000 +0100 @@ -0,0 +1,101 @@ +#!/usr/bin/env perl +# Copyright (C) 2009-2019 The Perl Foundation + +use 5.10.1; +use strict; +use warnings; +use Getopt::Long; +use Cwd; +use File::Spec; + +my $msg; + +my $repo = shift @ARGV; +chdir $repo; + +exit 0 if !-d '.git'; + +my $git_cache_dir; +Getopt::Long::Configure("pass_through"); +Getopt::Long::GetOptions('git-cache-dir=s' => \$git_cache_dir); + +print 'Updating submodules .................................... '; + +exec_and_check('git submodule sync --quiet 2>&1', 'Submodule sync failed for an unknown reason.'); +exec_and_check('git submodule --quiet init 2>&1', 'Submodule init failed for an unknown reason.'); + +if ($git_cache_dir) { + my $out = qx{git submodule status 2>&1}; + if ($? >> 8 != 0) { + print "\n===SORRY=== ERROR: Submodule status failed for an unknown reason.\n"; + print "The error message was: $out\n"; + exit 1; + } + for my $smodline (split(/^/m, $out)) { + chomp $smodline; + if ($smodline !~ /^.[0-9a-f]+ ([^ ]+)(?:$| )/) { + print "\n===SORRY=== ERROR: " + . "Submodule status output looks unexpected: '$smodline'"; + exit 1; + } + my $smodpath = $1; + my $smodname = (File::Spec->splitdir($smodpath))[-1]; + my $modrefdir = File::Spec->catdir($git_cache_dir, $smodname); + my $url = qx{git config submodule.$smodpath.url 2>&1}; + chomp $url; + if (!$url) { + print "Couldn't retrieve submodule URL for submodule $smodname\n"; + exit 1; + } + if (!-e $modrefdir) { + exec_and_check("git clone --quiet --bare $url $modrefdir", "Got clone of $url failed."); + } + else { + my $back = Cwd::cwd(); + chdir $modrefdir; + exec_and_check('git fetch --quiet --all', "Got fetch in $modrefdir failed."); + chdir $back; + } + $msg = qx{git submodule --quiet update --reference $modrefdir $smodpath 2>&1}; + check_update_ok($?, $msg); + } +} +else { + $msg = qx{git submodule --quiet update 2>&1}; + check_update_ok($?, $msg); +} + +print "OK\n"; + + +# Helper subs. + +sub exec_and_check { + my ($command, $msg) = @_; + my $out = qx{$command}; + if ($? >> 8 != 0) { + print "\n===SORRY=== ERROR: $msg\n"; + print "The error message was: $out\n"; + exit 1; + } +} + +sub check_update_ok { + my ($code, $msg) = @_; + if ($code >> 8 != 0) { + if ( $msg =~ + /[']([^']+)[']\s+already exists and is not an empty/ ) + { + print "\n===SORRY=== ERROR: " + . "Cannot update submodule because directory exists and is not empty.\n" + . ">>> Please delete the following folder and try again:\n$1\n\n"; + } + else { + print "\n===SORRY=== ERROR: " + . "Updating the submodule failed for an unknown reason. The error message was:\n" + . $msg; + } + exit 1; + } +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/tools/lib/NQP/Config/NQP.pm new/nqp-2020.02/tools/lib/NQP/Config/NQP.pm --- old/nqp-2020.01/tools/lib/NQP/Config/NQP.pm 2020-01-27 20:42:54.000000000 +0100 +++ new/nqp-2020.02/tools/lib/NQP/Config/NQP.pm 2020-02-23 13:01:48.000000000 +0100 @@ -330,6 +330,9 @@ my @opts = @{ $options->{'moar-option'} || [] }; push @opts, "--optimize"; push @opts, '--relocatable' if $options->{relocatable}; + push @opts, + '--git-cache-dir=' . File::Spec->rel2abs($options->{'git-cache-dir'}) + if $options->{'git-cache-dir'}; my $startdir = $config->{base_dir}; my $git_protocol = $options->{'git-protocol'} || 'https'; my $try_generate; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nqp-2020.01/tools/templates/MOAR_REVISION new/nqp-2020.02/tools/templates/MOAR_REVISION --- old/nqp-2020.01/tools/templates/MOAR_REVISION 2020-01-27 20:43:30.000000000 +0100 +++ new/nqp-2020.02/tools/templates/MOAR_REVISION 2020-02-23 13:02:17.000000000 +0100 @@ -1 +1 @@ -2020.01.1 +2020.02
