-
-
Save zoffixznet/ff4aa31a820449793bcd6b2d9d44ead2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp | |
index 730b764..409315a 100644 | |
--- a/src/Perl6/Grammar.nqp | |
+++ b/src/Perl6/Grammar.nqp | |
@@ -62,6 +62,15 @@ role STD { | |
token stopper { <!> } | |
my %quote_lang_cache := nqp::hash(); | |
+ method quote_lang_clear_cache() { | |
+ nqp::say("CLEARING CACHE") | |
+ if nqp::atkey(nqp::getenvhash(), 'ZZZ2'); | |
+ nqp::say('ZZ (' ~ nqp::elems(%quote_lang_cache) ~ ')') | |
+ if nqp::atkey(nqp::getenvhash(), 'ZZZ'); | |
+ nqp::deletekey(%quote_lang_cache,$_) for %quote_lang_cache; | |
+ nqp::say('ZZ (' ~ nqp::elems(%quote_lang_cache) ~ ')') | |
+ if nqp::atkey(nqp::getenvhash(), 'ZZZ'); | |
+ } | |
method quote_lang($l, $start, $stop, @base_tweaks?, @extra_tweaks?) { | |
sub lang_key() { | |
my $stopstr := nqp::istype($stop,VMArray) ?? nqp::join(' ',$stop) !! $stop; | |
@@ -71,11 +80,16 @@ role STD { | |
} | |
for @extra_tweaks { | |
if $_[0] eq 'to' { | |
+ nqp::say("BAILING - NOCACHE") | |
+ if nqp::atkey(nqp::getenvhash(), 'ZZZ2'); | |
return 'NOCACHE'; | |
} | |
@keybits.push($_[0] ~ '=' ~ $_[1]); | |
} | |
- nqp::join("\0", @keybits) | |
+ my $v := nqp::join("\0", @keybits); | |
+ nqp::say($l.HOW.name($l) ~ ' ' ~ $v ~ '(' ~ nqp::elems(%quote_lang_cache) ~ ')') | |
+ if nqp::atkey(nqp::getenvhash(), 'ZZZ'); | |
+ $v | |
} | |
sub con_lang() { | |
my $lang := $l.'!cursor_init'(self.orig(), :p(self.pos()), :shared(self.'!shared'())); | |
@@ -4752,6 +4766,9 @@ grammar Perl6::Grammar is HLL::Grammar does STD { | |
'infix:sym<~~>', '(consider implementing an ACCEPTS method)', | |
'prefix:sym<|>', NQPMu); | |
method add_categorical($category, $opname, $canname, $subname, $declarand?, :$defterm) { | |
+ nqp::say("adding categorical") | |
+ if nqp::atkey(nqp::getenvhash(), 'ZZZ2'); | |
+ | |
my $actions := self.actions; | |
# Ensure it's not a null name or a compiler-handled op. | |
@@ -4906,6 +4923,8 @@ if $*COMPILING_CORE_SETTING { | |
} | |
self.HOW.mixin(self, Circumfix.HOW.curry(Circumfix, $canname, @parts[0], @parts[1])); | |
} | |
+ # dump cached quote langs, since we modified our main lang | |
+ Perl6::QGrammar.quote_lang_clear_cache(); | |
# This also becomes the current MAIN. Also place it in %?LANG. | |
%*LANG<MAIN> := self.WHAT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment