Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add a method LANG2 where we can play with :shared
We survive the call to the foreign statementlist token, but we die when trying to return
something from LANG2, or rather when handling the return value in the nqp-ish grammar.
  • Loading branch information
FROGGS committed Jun 5, 2014
1 parent 609fb8f commit f036260
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/Perl6/Grammar.nqp
Expand Up @@ -1431,10 +1431,28 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}
]
]
[ <?{ $*MAIN ne $OLD_MAIN }> <statementlist=.LANG($*MAIN, 'statementlist', 1)> || <?> ]
[ <?{ $*MAIN ne $OLD_MAIN }> <statementlist=.LANG2($*MAIN, 'statementlist', 1)> || <?> ]
<.ws>
}


method LANG2($lang, $regex, *@args) {
say(1439);
# , :shared(self.'!shared'())
# , :shared($*W.find_symbol(['Cursor']))
my $lang_cursor := %*LANG{$lang}.'!cursor_init'(self.orig(), :p(self.pos()));
say(1443);
if self.HOW.traced(self) {
$lang_cursor.HOW.trace-on($lang_cursor, self.HOW.trace_depth(self));
}
say(1447);
my $*ACTIONS := %*LANG{$lang ~ '-actions'};
say(1449);
say($lang_cursor.HOW.name($lang_cursor));
my $ret := $lang_cursor."$regex"(|@args);
say(1452);
$ret;
}

sub do_import($/, $module, $package_source_name, $arglist?) {
if nqp::existskey($module, 'EXPORT') {
my $EXPORT := $*W.stash_hash($module<EXPORT>);
Expand Down

0 comments on commit f036260

Please sign in to comment.