Project

General

Profile

Actions

Backport #7255

closed

Ripper inside class_eval ommits :string_content between new line and :string_embexpr

Added by brueckenschlaeger23 (Micha J) over 11 years ago. Updated over 11 years ago.

Status:
Closed
[ruby-core:48703]

Description

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 #{}.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0