Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
dispatch dot infix to concat operation
  • Loading branch information
FROGGS committed Mar 25, 2013
1 parent ff7d3c3 commit 302e259
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 14 additions & 2 deletions lib/Perl6/P5Actions.pm
Expand Up @@ -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; }

Expand Down Expand Up @@ -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)");
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 2 additions & 5 deletions lib/Perl6/P5Grammar.pm
Expand Up @@ -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')> }
Expand Down

0 comments on commit 302e259

Please sign in to comment.