Class: Grammar::Ruby::Code::Steps

Inherits:
List show all
Defined in:
lib/grammar/ruby/code.rb

Direct Known Subclasses

SharedSteps

Constant Summary

Constants inherited from Grammar::Ruby::Code

False, FalseTerminator, Implicit, Nil, Self, True

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from List

#_codes, #_lines, #_paren, #initialize

Methods inherited from Grammar::Ruby::Code

[], #_and, #_assign, #_classname, #_code_self, #_codes, #_data, #_def, #_dot, #_else, #_ensure, #_equal, #_immediate, #_inspect, #_lines, #_locals, #_or, #_question, #_rand, #_rcond, #_rescue, #_ror, #_splat, #_to_block, #_unless, #_until, #_while, #initialize, #method_missing

Constructor Details

This class inherits a constructor from Grammar::Ruby::Code::List

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Grammar::Ruby::Code

Class Method Details

.new(operands) ⇒ Object



608
609
610
# File 'lib/grammar/ruby/code.rb', line 608

def self.new(operands)
    (operands.size==1) ? operands[0] : super
end

Instance Method Details

#_alwaysObject



617
618
619
# File 'lib/grammar/ruby/code.rb', line 617

def _always
    @operands.last._always
end

#_mid(before) ⇒ Object



634
635
636
637
638
639
640
641
# File 'lib/grammar/ruby/code.rb', line 634

def _mid(before)
    @operands.pop._mid(@operands)
    if @operands.size==1
        @operands.first._mid(before)
    else
        before << self
    end
end

#_neverObject



620
621
622
# File 'lib/grammar/ruby/code.rb', line 620

def _never
    @operands.last._never
end

#_notObject



631
632
633
# File 'lib/grammar/ruby/code.rb', line 631

def _not
    @operands[-1] = @operands[-1]._not
end

#_operatorObject



611
612
613
# File 'lib/grammar/ruby/code.rb', line 611

def _operator
    nil
end

#_operator0Object



614
615
616
# File 'lib/grammar/ruby/code.rb', line 614

def _operator0
    "; "
end

#_rstep(before) ⇒ Object



628
629
630
# File 'lib/grammar/ruby/code.rb', line 628

def _rstep(before)
    before.concat(@operands)
end

#_step(after) ⇒ Object



623
624
625
626
627
# File 'lib/grammar/ruby/code.rb', line 623

def _step(after)
    @operands.pop._mid(@operands)
    after._rstep(@operands)
    self
end