123456789_123456789_123456789_123456789_123456789_

Class: Prism::Translation::Ripper::SexpBuilder

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Ripper
Instance Chain:
self, Ripper
Inherits: Ripper
  • ::Object
Defined in: lib/prism/translation/ripper/sexp.rb

Overview

This class mirrors the ::Ripper::SexpBuilder subclass of Ripper that returns the arrays of [type, *children].

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#error (readonly)

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 12

attr_reader :error

Instance Method Details

#compile_error(mesg) (private)

Alias for #on_error.

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 65

alias compile_error on_error

#dedent_element(e, width) (private)

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 16

def dedent_element(e, width)
  if (n = dedent_string(e[1], width)) > 0
    e[2][1] += n
  end
  e
end

#on_error(mesg) (private) Also known as: #on_parse_error, #compile_error

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 60

def on_error(mesg)
  @error = mesg
end

#on_heredoc_dedent(val, width) (private)

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 23

def on_heredoc_dedent(val, width)
  sub = proc do |cont|
    cont.map! do |e|
      if Array === e
        case e[0]
        when :@tstring_content
          e = dedent_element(e, width)
        when /_add\z/
          e[1] = sub[e[1]]
        end
      elsif String === e
        dedent_string(e, width)
      end
      e
    end
  end
  sub[val]
  val
end

#on_parse_error(mesg) (private)

Alias for #on_error.

[ GitHub ]

  
# File 'lib/prism/translation/ripper/sexp.rb', line 64

alias on_parse_error on_error