Skip to content
Browse files

enable runtime adverbs or m//, enable checks for valid adverbs

  • Loading branch information...
1 parent c15a26e commit 5ee5857d50bd1a7a2314b575489d4e47bf580a6a @moritz moritz committed Jul 24, 2011
Showing with 17 additions and 9 deletions.
  1. +16 −8 src/Perl6/Actions.pm
  2. +1 −1 t/spectest.data
View
24 src/Perl6/Actions.pm
@@ -2850,18 +2850,18 @@ class Perl6::Actions is HLL::Actions {
our %MATCH_ALLOWED_ADVERBS;
INIT {
my $mods := 'i ignorecase s sigspace r ratchet';
- for pir::split__PSS(' ', $mods) {
+ for nqp::split(' ', $mods) {
%SHARED_ALLOWED_ADVERBS{$_} := 1;
}
$mods := 'g global ii samecase x c continue p pos nth th st nd rd';
- for pir::split__PSS(' ', $mods) {
+ for nqp::split(' ', $mods) {
%SUBST_ALLOWED_ADVERBS{$_} := 1;
}
# TODO: add g global ov overlap once they actually work
$mods := 'x c continue p pos nth th st nd rd';
- for pir::split__PSS(' ', $mods) {
+ for nqp::split(' ', $mods) {
%MATCH_ALLOWED_ADVERBS{$_} := 1;
}
}
@@ -2889,6 +2889,14 @@ class Perl6::Actions is HLL::Actions {
make $*value;
}
+ method rx_adverbs($/) {
+ my @pairs;
+ for $<quotepair> {
+ nqp::push(@pairs, $_.ast);
+ }
+ make @pairs;
+ }
+
method setup_quotepair($/) {
my %h;
my $key := $*ADVERB.ast.named;
@@ -2954,20 +2962,20 @@ class Perl6::Actions is HLL::Actions {
PAST::Var.new( :name('$_'), :scope('lexical_6model') ),
block_closure($coderef)
);
-# self.handle_and_check_adverbs($/, %MATCH_ALLOWED_ADVERBS, 'm', $past);
+ self.handle_and_check_adverbs($/, %MATCH_ALLOWED_ADVERBS, 'm', $past);
make PAST::Op.new( :pasttype('bind_6model'),
PAST::Var.new(:name('$/'), :scope('lexical_6model')),
$past
);
}
method handle_and_check_adverbs($/, %adverbs, $what, $past?) {
- for $<quotepair> {
- unless %SHARED_ALLOWED_ADVERBS{$_.ast.named} || %adverbs{$_.ast.named} {
- $/.CURSOR.panic("Adverb '" ~ $_.ast.named ~ "' not allowed on " ~ $what);
+ for $<rx_adverbs>.ast {
+ unless %SHARED_ALLOWED_ADVERBS{$_.named} || %adverbs{$_.named} {
+ $/.CURSOR.panic("Adverb '" ~ $_.named ~ "' not allowed on " ~ $what);
}
if $past {
- $past.push($_.ast);
+ $past.push($_);
}
}
}
View
2 t/spectest.data
@@ -282,7 +282,7 @@ S05-modifier/overlapping.t
# S05-modifier/pos.t
# S05-modifier/repetition.t # needs regex
# S05-modifier/sigspace.t # needs regex
-# S05-substitution/match.t # needs regex
+S05-substitution/match.t
# S05-substitution/subst.t # needs regex
# S05-transliteration/trans.t # needs regex
# S05-transliteration/with-closure.t # needs regex

0 comments on commit 5ee5857

Please sign in to comment.
Something went wrong with that request. Please try again.