Permalink
Browse files

dispatch dot infix to concat operation

  • Loading branch information...
1 parent ff7d3c3 commit 302e259e2c392ababf66df335baf555ce80590ca @FROGGS FROGGS committed Mar 25, 2013
Showing with 16 additions and 7 deletions.
  1. +14 −2 lib/Perl6/P5Actions.pm
  2. +2 −5 lib/Perl6/P5Grammar.pm
View
@@ -3265,7 +3265,7 @@ class Perl6::P5Actions is HLL::Actions does STDActions {
make $<postfix> ?? $<postfix>.ast !! $<postcircumfix>.ast;
}
- method dotty:sym<.>($/) { make $<dottyop>.ast; }
+# method dotty:sym<.>($/) { make $<dottyop>.ast; }
method dotty:sym«->»($/) { make $<dottyop>.ast; }
method postfix:sym«->»($/) { make $<dottyop>.ast; }
@@ -4001,7 +4001,10 @@ class Perl6::P5Actions is HLL::Actions does STDActions {
'fff', -> $/, $sym { flipflop($/[0].ast, $/[1].ast, 0, 0, 1) },
'^fff', -> $/, $sym { flipflop($/[0].ast, $/[1].ast, 1, 0, 1) },
'fff^', -> $/, $sym { flipflop($/[0].ast, $/[1].ast, 0, 1, 1) },
- '^fff^',-> $/, $sym { flipflop($/[0].ast, $/[1].ast, 1, 1, 1) }
+ '^fff^',-> $/, $sym { flipflop($/[0].ast, $/[1].ast, 1, 1, 1) },
+
+ # Perl 5
+ '.', -> $/, $sym { concat_op($/, $/[0].ast, $/[1].ast) }
);
method EXPR($/, $key?) {
say("method P5 EXPR($/, $key)");
@@ -4314,6 +4317,15 @@ class Perl6::P5Actions is HLL::Actions does STDActions {
return $past;
}
+ sub concat_op($/, $lhs_ast, $rhs_ast) {
+ my $past := QAST::Op.new(
+ :op('call'), :name('&infix:<~>'),
+ $lhs_ast,
+ $rhs_ast
+ );
+ $past
+ }
+
sub mixin_op($/, $sym) {
my $rhs := $/[1].ast;
my $past := QAST::Op.new(
View
@@ -3110,11 +3110,8 @@ grammar Perl6::P5Grammar is HLL::Grammar does STD5 {
## additive
-# token infix:sym<.>
- #{ <sym> <O('%additive')> }
-# { <sym> <O('%concatenation')> }
- token infix:sym<.> { <sym> <O('%concatenation , :op<concat>')> }
-
+ token infix:sym<.>
+ { <sym> <O('%additive')> }
token infix:sym<+>
{ <sym> <O('%additive')> }

0 comments on commit 302e259

Please sign in to comment.