Class: Grammar::Ruby::Code::Begin
- Inherits:
-
List
show all
- Defined in:
- lib/grammar/ruby/code.rb
Constant Summary
False, FalseTerminator, Implicit, Nil, Self, True
Instance Method Summary
collapse
Methods inherited from List
#_codes, #_paren
[], #_and, #_assign, #_classname, #_code_self, #_codes, #_data, #_dot, #_equal, #_immediate, #_inspect, #_locals, #_mid, #_not, #_or, #_question, #_rand, #_rcond, #_ror, #_rstep, #_splat, #_step, #_to_block, #_unless, #_until, #_while, #method_missing
Constructor Details
#initialize(body) ⇒ Begin
Returns a new instance of Begin.
904
905
906
907
|
# File 'lib/grammar/ruby/code.rb', line 904
def initialize(body)
= 0
super([body])
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Grammar::Ruby::Code
Instance Method Details
#_always ⇒ Object
944
945
946
|
# File 'lib/grammar/ruby/code.rb', line 944
def _always
false
end
|
#_def(name, *args) ⇒ Object
941
942
943
|
# File 'lib/grammar/ruby/code.rb', line 941
def _def(name, *args)
Def.new(name.to_s, args, Steps.new(@operands))
end
|
#_else(after) ⇒ Object
935
936
937
938
939
940
|
# File 'lib/grammar/ruby/code.rb', line 935
def _else(after)
return(super) if >=3
= 3
@operands << Dedented.new("else") << after
self
end
|
#_ensure(after) ⇒ Object
929
930
931
932
933
934
|
# File 'lib/grammar/ruby/code.rb', line 929
def _ensure(after)
return(super) if >=2
= 2
@operands << Dedented.new("ensure") << after
self
end
|
#_lines(text, indent = 0, op = nil, maxlen = 72) ⇒ Object
914
915
916
917
918
919
920
921
922
|
# File 'lib/grammar/ruby/code.rb', line 914
def _lines(text, indent=0, op=nil, maxlen=72)
text.last.concat("begin ")
if super(text, indent+2, nil, maxlen)
text.last.concat(" end")
else
text << indent << "end"
nil
end
end
|
#_never ⇒ Object
947
948
949
|
# File 'lib/grammar/ruby/code.rb', line 947
def _never
false
end
|
#_operator ⇒ Object
908
909
910
|
# File 'lib/grammar/ruby/code.rb', line 908
def _operator
nil
end
|
#_operator0 ⇒ Object
911
912
913
|
# File 'lib/grammar/ruby/code.rb', line 911
def _operator0
"; "
end
|
#_rescue(after, exception = nil, var = nil) ⇒ Object
923
924
925
926
927
928
|
# File 'lib/grammar/ruby/code.rb', line 923
def _rescue(after, exception=nil, var=nil)
return(super) if >1
= 1
@operands << Rescue.new(exception, var) << after
self
end
|