Permalink
Browse files

Implement :$<foo> colonpair syntax.

  • Loading branch information...
1 parent 215b1d8 commit d25808bd098772944f31b212f3e9789a92e37f8c @jnthn jnthn committed Jun 9, 2013
Showing with 16 additions and 2 deletions.
  1. +11 −1 src/Perl6/Actions.nqp
  2. +5 −1 src/Perl6/Grammar.nqp
View
@@ -1275,7 +1275,17 @@ class Perl6::Actions is HLL::Actions does STDActions {
}
method colonpair_variable($/) {
- make make_variable($/, [~$/]);
+ if $<capvar> {
+ make QAST::Op.new(
+ :op('callmethod'),
+ :name('postcircumfix:<{ }>'),
+ QAST::Var.new(:name('$/'), :scope('lexical')),
+ $*W.add_string_constant(~$<desigilname>)
+ );
+ }
+ else {
+ make make_variable($/, [~$/]);
+ }
}
sub make_pair($key_str, $value) {
View
@@ -1448,7 +1448,11 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
}
token colonpair_variable {
- <sigil> {} <twigil>**0..1 <desigilname>
+ <sigil> {}
+ [
+ | <twigil>**0..1 <desigilname>
+ | $<capvar>='<' <desigilname> '>'
+ ]
}
proto token special_variable { <...> }

0 comments on commit d25808b

Please sign in to comment.