Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Initial stab at getting $~Vars to work
  • Loading branch information
Mouq committed Nov 13, 2014
1 parent 1d3d97f commit 93987f1
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -1753,6 +1753,22 @@ class Perl6::Actions is HLL::Actions does STDActions {
$past := add_placeholder_parameter($/, $sigil, $desigilname,
:named($twigil eq ':'), :full_name($past.name()));
}
elsif $twigil eq '~' {
my $actionsname := $desigilname ~ '-actions';
$past := QAST::Op.new(
:op<callmethod>, :name<new>, :returns($*W.find_symbol(['Slang'])),
QAST::Var.new( :name<Slang>, :scope<lexical> ));
if nqp::existskey(%*LANG, $desigilname) {
my $wval := QAST::WVal.new( :value(%*LANG{$desigilname}) );
$wval.named('grammar');
$past.push($wval);
}
if nqp::existskey(%*LANG, $actionsname) {
my $wval := QAST::WVal.new( :value(%*LANG{$actionsname}) );
$wval.named('actions');
$past.push($wval);
}
}
elsif $past.name() eq '@_' {
if $*W.nearest_signatured_block_declares('@_') {
$past.scope('lexical');
Expand Down
2 changes: 1 addition & 1 deletion src/Perl6/Grammar.nqp
Expand Up @@ -2134,7 +2134,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
token twigil:sym<*> { <sym> <?before \w> }
token twigil:sym<?> { <sym> <?before \w> }
token twigil:sym<=> { <sym> <?before \w> }
token twigil:sym<~> { <sym> <?before \w> <.NYI("Slangy variables")> }
token twigil:sym<~> { <sym> <?before \w> }

proto token package_declarator { <...> }
token package_declarator:sym<package> {
Expand Down
11 changes: 11 additions & 0 deletions src/core/Slang.pm
@@ -0,0 +1,11 @@
class Slang {
has $.grammar;
has $.actions;
method gist {
# Handle NQP objects like Perl6::Grammar
'Slang.new('
~ (':grammar('~$!grammar.HOW.name($!grammar)~')',
':actions('~$!actions.HOW.name($!actions)~')').join(', ')
~ ')'
}
}
1 change: 1 addition & 0 deletions tools/build/Makefile-JVM.in
Expand Up @@ -197,6 +197,7 @@ J_CORE_SOURCES = \
src/core/Inc.pm \
src/core/Process.pm \
src/core/StrDistance.pm \
src/core/Slang.pm \
src/core/core_epilogue.pm \

PERL6_DEBUG_JAR = perl6-debug.jar
Expand Down
1 change: 1 addition & 0 deletions tools/build/Makefile-Parrot.in
Expand Up @@ -265,6 +265,7 @@ P_CORE_SOURCES = \
src/core/Inc.pm \
src/core/Process.pm \
src/core/StrDistance.pm \
src/core/Slang.pm \
src/core/core_epilogue.pm \

PERL6_DEBUG_PBC = perl6-debug.pbc
Expand Down
1 change: 1 addition & 0 deletions tools/build/moar_core_sources
Expand Up @@ -145,4 +145,5 @@ src/core/Argfiles.pm
src/core/Inc.pm
src/core/Process.pm
src/core/StrDistance.pm
src/core/Slang.pm
src/core/core_epilogue.pm

0 comments on commit 93987f1

Please sign in to comment.