Details

    • Number of attachments :
      0

      Description

      Broken:

      system ~/projects/jruby $ jruby -e "lambda { [1].each {|one; bl| } }"
      SyntaxError: -e:1: syntax error, unexpected tIDENTIFIER
      
      lambda { [1].each {|one; bl| } }
                                 ^
      

      Due to this commit:

      commit 3e6d201fe4659f14eb0d0565f1b7680a8f162e22
      Author: Hiro Asari <asari.ruby@gmail.com>
      Date:   Mon Feb 27 10:02:26 2012 -0800
      
          Fix JRUBY-6504: Block parameter syntax issue where the closing | comes at the beginning of the line
      

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Something like this, maybe?

        diff --git a/src/org/jruby/parser/Ruby19Parser.y b/src/org/jruby/parser/Ruby19Parser.y
        index 13ec1a7..7f38dcc 100644
        --- a/src/org/jruby/parser/Ruby19Parser.y
        +++ b/src/org/jruby/parser/Ruby19Parser.y
        @@ -1374,7 +1374,14 @@ block_param_def : tPIPE opt_bv_decl tPIPE {
                         }
         
         // shadowed block variables....
        -opt_bv_decl     : opt_nl {
        +opt_bv_decl     : none
        +                | opt_nl {
        +                    $$ = null;
        +                }
        +                | ';' bv_dels {
        +                    $$ = null;
        +                }
        +                | opt_nl ';' bv_dels {
                             $$ = null;
                         }
                         | opt_nl ';' bv_dels opt_nl {
        
        

        FWIW, this came up in 1.9 spec run, so someone's not running specs

        Show
        Charles Oliver Nutter added a comment - Something like this, maybe? diff --git a/src/org/jruby/parser/Ruby19Parser.y b/src/org/jruby/parser/Ruby19Parser.y index 13ec1a7..7f38dcc 100644 --- a/src/org/jruby/parser/Ruby19Parser.y +++ b/src/org/jruby/parser/Ruby19Parser.y @@ -1374,7 +1374,14 @@ block_param_def : tPIPE opt_bv_decl tPIPE { } // shadowed block variables.... -opt_bv_decl : opt_nl { +opt_bv_decl : none + | opt_nl { + $$ = null; + } + | ';' bv_dels { + $$ = null; + } + | opt_nl ';' bv_dels { $$ = null; } | opt_nl ';' bv_dels opt_nl { FWIW, this came up in 1.9 spec run, so someone's not running specs
        Hide
        Charles Oliver Nutter added a comment -

        It was a simple typo... bv_decls/bv_dels.

        commit 58d4d4c90ea9ce720b6a47690ec04ca288b7a9c9
        Author: Charles Oliver Nutter <headius@headius.com>
        Date:   Thu Mar 8 00:02:24 2012 -0600
        
            Fix JRUBY-6534: Broken block-local vars in 1.9 mode
            
            * Simple typo in the parser.
        
        Show
        Charles Oliver Nutter added a comment - It was a simple typo... bv_decls/bv_dels. commit 58d4d4c90ea9ce720b6a47690ec04ca288b7a9c9 Author: Charles Oliver Nutter <headius@headius.com> Date: Thu Mar 8 00:02:24 2012 -0600 Fix JRUBY-6534: Broken block-local vars in 1.9 mode * Simple typo in the parser.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Charles Oliver Nutter
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: