Class: SbuilderSexp::Procedure

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

Instance Method Summary collapse

Methods inherited from Callable

#body, #body_node, #node_value, #parameter_definitions, #parameters, #parameters_node, #symbol_definitions

Methods inherited from Define

#name

Methods inherited from Treetop::Runtime::SyntaxNode

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

Instance Method Details

#declaration_definitionsVariableDef:Array

overrides method in parent to return decclartions in

Returns:

  • (VariableDef:Array)

    of variable definition, empty array if no definition



1195
1196
1197
1198
1199
# File 'lib/parser/parser_nodes.rb', line 1195

def declaration_definitions
  declaration_def = procedure_variables
  return [] unless declaration_def.any?
  declaration_def
end

#procedure_variablesObject



1186
1187
1188
1189
1190
# File 'lib/parser/parser_nodes.rb', line 1186

def procedure_variables
  # node = procedure_variables_node
  # return node.value if node
  variable_declarations.map { |variable_declaration| variable_declaration.variable.value }
end

#procedure_variables_nodeNil|ProcVariables

Returns of variable definition node for procedure.

Returns:

  • (Nil|ProcVariables)

    of variable definition node for procedure



1175
1176
1177
1178
# File 'lib/parser/parser_nodes.rb', line 1175

def procedure_variables_node
  tree_nodes = recursive_select(SbuilderSexp::ProcVariables)
  return tree_nodes.first if tree_nodes
end

#variable_declarationsVariableDef:Array

Returns variable declarations.

Returns:

  • (VariableDef:Array)

    variable declarations



1181
1182
1183
1184
# File 'lib/parser/parser_nodes.rb', line 1181

def variable_declarations
  return [] unless procedure_variables_node
  return procedure_variables_node.recursive_select(SbuilderSexp::VariableDef)
end