Issue #7255 has been updated by zzak (Zachary Scott).

Category set to ext
Assignee set to nobu (Nobuyoshi Nakada)


----------------------------------------
Bug #7255: Ripper inside class_eval ommits :string_content between new line and :string_embexpr
https://bugs.ruby-lang.org/issues/7255#change-32440

Author: brueckenschlaeger23 (Micha J)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: ext
Target version: 
ruby -v: 1.9.3p286


See the following Code parsed by Ripper using 

    content = 'class_eval <<-RUBY, __FILE__, __LINE__+1        
        
        def #{parent}contents(*args)
          ""
        end
    RUBY
    '

    Ripper::SexpBuilder.new(content).parse

The resulting sexp ommits truncates the first string_add to "        \n" instead of "        \n        def "

            - - :string_literal
              - - :string_add
                - - :string_add
                  - - :string_add
                    - - :string_content
                    - - :@tstring_content
                      - "        \n"
                      - - 2
                        - 0

If you remove the empty line, it works fine and the "     def " is part of the string. As well it works without any embed #{}. 



-- 
http://bugs.ruby-lang.org/