Class: Grammar::Ruby::Code::Conditional::Question

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

Constant Summary

Constants inherited from Grammar::Ruby::Code

False, FalseTerminator, Implicit, Nil, Self, True

Instance Method Summary collapse

Methods inherited from List

#_codes, #_lines, #_operator0, #initialize

Methods inherited from Grammar::Ruby::Code

[], #_and, #_assign, #_classname, #_code_self, #_codes, #_data, #_def, #_dot, #_else, #_ensure, #_equal, #_immediate, #_inspect, #_lines, #_locals, #_not, #_or, #_question, #_rand, #_rcond, #_rescue, #_ror, #_rstep, #_splat, #_step, #_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

Instance Method Details

#[](i) ⇒ Object



668
669
670
# File 'lib/grammar/ruby/code.rb', line 668

def [](i)
    @operands[i]
end

#[]=(i, code) ⇒ Object



671
672
673
# File 'lib/grammar/ruby/code.rb', line 671

def []=(i, code)
    @operands[i] = code
end

#_alwaysObject



662
663
664
# File 'lib/grammar/ruby/code.rb', line 662

def _always
    @operands.last._always
end

#_mid(before) ⇒ Object



674
675
676
677
678
679
680
681
# File 'lib/grammar/ruby/code.rb', line 674

def _mid(before)
    @operands.pop._mid(@operands)
    if @operands.size==1
        # TODO : translate to Or in this case
        @operands << True
    end
    before << self
end

#_neverObject



665
666
667
# File 'lib/grammar/ruby/code.rb', line 665

def _never
    @operands.last._never
end

#_operatorObject



656
657
658
# File 'lib/grammar/ruby/code.rb', line 656

def _operator
    " ? "
end

#_paren(op) ⇒ Object



659
660
661
# File 'lib/grammar/ruby/code.rb', line 659

def _paren(op)
    false
end