New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0-array and 1-array composer broken #67
Comments
From @cognominalbut n-array composer with n > 1 works correctly $ alias rakudo $ rakudo -e 'my @a = []; say @a[0]' $ rakudo -e 'my @a = [1,2]; say @a[1]' -- |
From @cognominalThis fixes the bug but does not handle multidimensional arrays. Index: languages/perl6/src/parser/actions.pm========== method circumfix($/, $key) { Index: compilers/nqp/src/Grammar.pg========== +## loose logical operators -- |
@cognominal - Status changed from 'new' to 'open' |
From @cognominalit seems that lines have been folded. So I attach the diff here |
From @cognominalarray_composer.diffIndex: languages/perl6/src/parser/actions.pm
===================================================================
--- languages/perl6/src/parser/actions.pm (revision 27594)
+++ languages/perl6/src/parser/actions.pm (working copy)
@@ -1629,12 +1629,19 @@
method circumfix($/, $key) {
my $past;
- if $key eq '( )' {
- $past := $( $<statementlist> );
+ if $key eq '[ ]' or $key eq '( )' {
+ my $statement := $<statementlist><statement>;
+ if +$statement == 1 {
+ if $statement[0]<expr><expr><type> eq 'infix:,' {
+ $past := $( $<statementlist> );
+ } else {
+ $past := PAST::Op.new( :node($/), :name('list'), :pasttype('call') );
+ $past.push( $( $statement<expr> ) );
+ }
+ } else {
+ $past := PAST::Op.new( :node($/), :name('list'), :pasttype('call') );
+ }
}
- if $key eq '[ ]' {
- $past := $( $<statementlist> );
- }
elsif $key eq '{ }' {
$past := $( $<pblock> );
}
Index: compilers/nqp/src/Grammar.pg
===================================================================
--- compilers/nqp/src/Grammar.pg (revision 27594)
+++ compilers/nqp/src/Grammar.pg (working copy)
@@ -487,3 +487,11 @@
is nullterm
{ ... }
+## loose logical operators
+proto infix:<and> is looser(infix:<,>)
+ is pasttype('if')
+ { .... }
+
+proto infix:<or> is looser(infix:<and>)
+ is pasttype('unless')
+ { ... }
|
From @cognominalThis fix the bug but does not handle multidimensional arrays. Index: languages/perl6/src/parser/actions.pm--- languages/perl6/src/parser/actions.pm (revision 27594) method circumfix($/, $key) { Index: compilers/nqp/src/Grammar.pg--- compilers/nqp/src/Grammar.pg (revision 27594) +## loose logical operators -- |
From @pmichaudOn Sun May 18 15:57:25 2008, cognominal wrote:
I've committed the nqp patch in r27647, thanks. As far as the array composer goes, I can't really accept the patch What really needs to happen here is to introduce a "list" past node type Thanks! Pm |
From @pmichaudFixed in r27917, thanks! Pm |
@pmichaud - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#52276 (status was 'resolved')
Searchable as RT52276$
The text was updated successfully, but these errors were encountered: