Class: SbuilderSexp::Callable

Inherits:
Define show all
Defined in:
lib/parser/parser_nodes.rb

Direct Known Subclasses

Macro, OperatorDef, Procedure

Instance Method Summary collapse

Methods inherited from Define

#name

Methods inherited from Treetop::Runtime::SyntaxNode

#node_type, #recursive_inject, #recursive_inject_parent, #recursive_select, #value

Instance Method Details

#bodyObject



1135
1136
1137
1138
# File 'lib/parser/parser_nodes.rb', line 1135

def body
  node = body_node
  node.value  if node
end

#body_nodeObject



1131
1132
1133
1134
# File 'lib/parser/parser_nodes.rb', line 1131

def body_node
  ret = recursive_select(SbuilderSexp::Statement).first
  ret
end

#declaration_definitionsObject



1156
1157
1158
# File 'lib/parser/parser_nodes.rb', line 1156

def declaration_definitions
  []
end

#node_valueObject



1140
1141
1142
1143
1144
1145
1146
# File 'lib/parser/parser_nodes.rb', line 1140

def node_value
  {
    :name => "name",
    :parameters => parameters,
    :body => body,
  }
end

#parameter_definitionsHash:Array

Returns symbol hash with ‘:node_type’, :value,:tree properties.

Returns:

  • (Hash:Array)

    symbol hash with ‘:node_type’, :value,:tree properties



1150
1151
1152
1153
1154
# File 'lib/parser/parser_nodes.rb', line 1150

def parameter_definitions
  parameter_def = parameters
  return [] unless  parameter_def
  parameter_def[:value] 
end

#parametersObject



1125
1126
1127
1128
# File 'lib/parser/parser_nodes.rb', line 1125

def parameters
  node = parameters_node
  return node.value if node
end

#parameters_nodeObject



1121
1122
1123
1124
# File 'lib/parser/parser_nodes.rb', line 1121

def parameters_node
  tree_nodes = recursive_select(SbuilderSexp::Parameters)
  return tree_nodes.first if tree_nodes
end

#symbol_definitionsObject

Symbols defined in this node. They include parameters and declarations (normally only in procedure)



1162
1163
1164
1165
# File 'lib/parser/parser_nodes.rb', line 1162

def symbol_definitions
  # unique b
  return parameter_definitions + declaration_definitions
end