Skip to content

Commit

Permalink
Perlito5 - parser - tweak qr() AST
Browse files Browse the repository at this point in the history
  • Loading branch information
fglock committed Oct 29, 2014
1 parent 2df3521 commit e8398b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions perlito5.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4408,7 +4408,7 @@ sub Perlito5::Grammar::String::qr_quote_parse {
$modifiers = Perlito5::Match::flat($m);
$part1->{'to'} = $m->{'to'}
}
$part1->{'capture'} = Perlito5::AST::Apply->new('code' => 'p5:qr', 'arguments' => [$str_regex, $modifiers], 'namespace' => '');
$part1->{'capture'} = Perlito5::AST::Apply->new('code' => 'p5:qr', 'arguments' => [$str_regex, Perlito5::AST::Val::Buf->new('buf' => $modifiers)], 'namespace' => '');
return $part1
}
sub Perlito5::Grammar::String::qx_quote_parse {
Expand Down Expand Up @@ -9667,7 +9667,7 @@ package Perlito5::AST::Apply;
my $self = shift;
my $level = shift;
my $wantarray = shift;
'p5qr(' . Perlito5::Javascript2::to_str($self->{'arguments'}->[0]) . ', "' . $self->{'arguments'}->[1] . '")'
'p5qr(' . Perlito5::Javascript2::to_str($self->{'arguments'}->[0]) . ', ' . Perlito5::Javascript2::to_str($self->{'arguments'}->[1]) . ')'
}, '__PACKAGE__' => sub {
my $self = $_[0];
'"' . $Perlito5::PKG_NAME . '"'
Expand Down
4 changes: 3 additions & 1 deletion src5/lib/Perlito5/Grammar/String.pm
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ sub qr_quote_parse {

$part1->{capture} = Perlito5::AST::Apply->new(
code => 'p5:qr',
arguments => [ $str_regex, $modifiers ],
arguments => [ $str_regex,
Perlito5::AST::Val::Buf->new( buf => $modifiers ),
],
namespace => ''
);
return $part1;
Expand Down
3 changes: 2 additions & 1 deletion src5/lib/Perlito5/Javascript2/Emitter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,8 @@ package Perlito5::AST::Apply;
my $level = shift;
my $wantarray = shift;
# p5qr( $str, $modifier );
'p5qr(' . Perlito5::Javascript2::to_str( $self->{arguments}[0] ) . ', "' . $self->{arguments}[1] . '")';
'p5qr(' . Perlito5::Javascript2::to_str( $self->{arguments}[0] ) . ', '
. Perlito5::Javascript2::to_str( $self->{arguments}[1] ) . ')';
},
'__PACKAGE__' => sub {
my $self = $_[0];
Expand Down

0 comments on commit e8398b1

Please sign in to comment.