Class: Yadriggy::Command
Overview
A method call without parentheses.
Instance Attribute Summary
Attributes inherited from Call
#args, #block, #block_arg, #name, #op, #receiver
Attributes inherited from ASTnode
Class Method Summary collapse
Instance Method Summary collapse
-
#accept(evaluator) ⇒ void
A method for Visitor pattern.
-
#initialize(sexp) ⇒ Command
constructor
A new instance of Command.
Methods inherited from Call
#initialize2, make, #value, #value_in_class
Methods included from AstHelper
#has_tag?, #to_node, #to_nodes
Methods inherited from ASTnode
#add_child, #add_children, #const_value, #const_value_in_class, #get_context_class, #get_receiver_object, #is_proc?, #pretty_print, #root, #source_location, #source_location_string, #value, #value_in_class
Constructor Details
#initialize(sexp) ⇒ Command
904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 |
# File 'lib/yadriggy/ast.rb', line 904 def initialize(sexp) if sexp[0] == :command initialize_call([:call, nil, nil, sexp[1]]) arg_exp = sexp[2] elsif sexp[0] == :command_call initialize_call([:call, sexp[1], sexp[2], sexp[3]]) arg_exp = sexp[4] else raise "unknown pattern " + sexp.to_s end if arg_exp[0] == :args_add_block initialize_args(arg_exp) else @args = to_nodes(arg_exp) @block_arg = nil add_children(@args) end @block = nil end |
Class Method Details
.tags ⇒ Object
902 |
# File 'lib/yadriggy/ast.rb', line 902 def self.() [:command, :command_call] end |
Instance Method Details
#accept(evaluator) ⇒ void
This method returns an undefined value.
A method for Visitor pattern.
929 930 931 |
# File 'lib/yadriggy/ast.rb', line 929 def accept(evaluator) evaluator.command(self) end |