ruby/erm_buffer.rb
#:nodoc: internal use only
:nodoc: internal use only
: nodoc : internal use only
def on_kw sym 
      sym = sym.to_sym
      case @mode
      when :sym then
        add :label, sym
      when :def, :predef then
        if sym != :self then
          add :defname, sym
        else
          r = add :kw, sym
          @mode = :def
          r
        end
      else
        last_add = nil
        case sym
        when :end then
          indent :e
        when :do then
          if @cond_stack.last then
            @cond_stack.pop
            r = add :kw, sym
          else
             `add` and `indent` must precede `@block = :b4args`.
             Otherwise @block is overwritten, and indentation is broken
             in the following code:
              each do |a|  <- `|` for argument list is recognized as operator,
                   <- which produces an extra indentation.
              end
            indent :d
            r = add :kw, sym
            @block = :b4args
          end
          return r
        when *BEGINDENT_KW then
          if @statment_start then
            indent :b
          elsif POSTCOND_KW.include? sym then
            last_add = :cont
          end
        when *POSTCOND_KW then
          last_add = :cont
        when *INDENT_KW then
          indent :b
        when *BACKDENT_KW then
          indent :s if @statment_start
        end
        @cond_stack << true if PRE_OPTIONAL_DO_KW.include? sym
        r = add :kw, sym, sym.size, false, last_add
        @mode = :predef if [:def, :alias].include? sym
        r
      end
    end
def on_kw sym sym = sym . to_sym case @mode when :sym then add :label , sym when :def , :predef then if sym != :self then add :defname , sym else r = add :kw , sym @mode = :def r end else last_add = nil case sym when :end then indent :e when :do then if @cond_stack . last then @cond_stack . pop r = add :kw , sym else indent :d r = add :kw , sym @block = :b4args end return r when * BEGINDENT_KW then if @statment_start then indent :b elsif POSTCOND_KW . include? sym then last_add = :cont end when * POSTCOND_KW then last_add = :cont when * INDENT_KW then indent :b when * BACKDENT_KW then indent :s if @statment_start end @cond_stack << true if PRE_OPTIONAL_DO_KW . include? sym r = add :kw , sym , sym . size , false , last_add @mode = :predef if [ :def , :alias ] . include? sym r end end
:nodoc: internal use only
: nodoc : internal use only
# TODO: break up. 61 lines long # `indent` precedes `add` for the compatibility of parsing result. # # `add` and `indent` must precede `@block = :b4args`. # Otherwise @block is overwritten, and indentation is broken # in the following code: #  each do |a| # <- `|` for argument list is recognized as operator, #      # <- which produces an extra indentation. #  end
sym