Flowdock
method

parse_constant_body

Importance_0
v2_2_9 - Show latest stable - 0 notes - Class: Ruby
parse_constant_body(container, constant) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rdoc/parser/ruby.rb, line 899
  def parse_constant_body container, constant # :nodoc:
    nest     = 0
    rhs_name = ''

    get_tkread

    tk = get_tk

    loop do
      case tk
      when TkSEMICOLON then
        break if nest <= 0
      when TkLPAREN, TkfLPAREN, TkLBRACE, TkfLBRACE, TkLBRACK, TkfLBRACK,
           TkDO, TkIF, TkUNLESS, TkCASE, TkDEF, TkBEGIN then
        nest += 1
      when TkRPAREN, TkRBRACE, TkRBRACK, TkEND then
        nest -= 1
      when TkCOMMENT then
        if nest <= 0 and stop_at_EXPR_END then
          unget_tk tk
          break
        else
          unget_tk tk
          read_documentation_modifiers constant, RDoc::CONSTANT_MODIFIERS
        end
      when TkCONSTANT then
        rhs_name << tk.name

        if nest <= 0 and TkNL === peek_tk then
          create_module_alias container, constant, rhs_name
          break
        end
      when TkNL then
        if nest <= 0 and stop_at_EXPR_END then
          unget_tk tk
          break
        end
      when TkCOLON2, TkCOLON3 then
        rhs_name << '::'
      when nil then
        break
      end
      tk = get_tk
    end

    get_tkread_clean(/^[ \t]+/, '')
  end
Register or log in to add new notes.