123456789_123456789_123456789_123456789_123456789_

Class: 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
Defined in: ext/ripper/lib/ripper/sexp.rb

Constant Summary

::Ripper - Inherited

EVENTS, PARSER_EVENTS, SCANNER_EVENTS, Version

Class Method Summary

::Ripper - Inherited

.dedent_string

USE OF RIPPER LIBRARY ONLY.

.lex

Tokenizes the Ruby program and returns an array of an array, which is formatted like [[lineno, column], type, token, state].

.lex_state_name

Returns a string representation of lex_state.

.new

Create a new ::Ripper object.

.parse

Parses the given Ruby program read from src.

.sexp
EXPERIMENTAL

Parses src and create S-exp tree.

.sexp_raw
EXPERIMENTAL

Parses src and create S-exp tree.

.slice
EXPERIMENTAL

Parses src and return a string which was matched to pattern.

.tokenize

Tokenizes the Ruby program and returns an array of strings.

.token_match

Instance Attribute Summary

::Ripper - Inherited

#debug_output

Get debug output.

#debug_output=

Set debug output.

#end_seen?

Return true if parsed source ended by _END_.

#error?

Return true if parsed source has errors.

#yydebug

Get yydebug.

#yydebug=

Set yydebug.

Instance Method Summary

::Ripper - Inherited

#column

Return column number of current parsing line.

#encoding

Return encoding of the source.

#filename

Return current parsing filename.

#lineno

Return line number of current parsing line.

#parse

Start parsing and returns the value of the root action.

#state

Return scanner state of current token.

#token

Return the current token string.

#compile_error

This method is called when the parser found syntax error.

#dedent_string

Alias for dedent_string.

#warn

This method is called when weak warning is produced by the parser.

#warning

This method is called when strong warning is produced by the parser.

#assert_Qundef, #rawVALUE, #validate_object, #_dispatch_0, #_dispatch_1, #_dispatch_2, #_dispatch_3, #_dispatch_4, #_dispatch_5, #_dispatch_6, #_dispatch_7

Constructor Details

This class inherits a constructor from Ripper

Instance Method Details

#dedent_element(e, width) (private)

[ GitHub ]

  
# File 'ext/ripper/lib/ripper/sexp.rb', line 66

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

#on_heredoc_dedent(val, width) (private)

[ GitHub ]

  
# File 'ext/ripper/lib/ripper/sexp.rb', line 73

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