Class: SbuilderSexp::FunctionExpression

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

Instance Method Summary collapse

Methods inherited from AbstactExpression

#expression_postfix, #expression_prefix, #expressions, #has_rhs, #node_value, #rhs_node, #traverse

Methods inherited from Treetop::Runtime::SyntaxNode

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

Instance Method Details

#binds_nodeObject



674
675
676
677
678
679
680
# File 'lib/parser/parser_nodes.rb', line 674

def binds_node
  ret = recursive_select( SbuilderSexp::BoundInExpression ).first
  # return nil unless ret
  # ret = ret.recursive_select( SbuilderSexp::BoundInExpression ).first
  # # puts ret
  # ret
end

#expression_valObject

AbstactExpression.traverse calls in yield



670
671
672
# File 'lib/parser/parser_nodes.rb', line 670

def expression_val
  true
end

#function_expressionObject



682
683
684
# File 'lib/parser/parser_nodes.rb', line 682

def function_expression
  elements[1]
end

#lhs_nodeObject



664
665
666
# File 'lib/parser/parser_nodes.rb', line 664

def lhs_node
  nil
end

#nameString

For documentation purposes symbol table context needs a name (For procedures, and macros name is ovbious. For a set expression we define name set a string “Set+<generator set>”

Returns:

  • (String)

    name identifying context in symbol table



691
692
693
# File 'lib/parser/parser_nodes.rb', line 691

def name
  "Func-#{binds_node.bind_set.text_value}"
end

#symbol_definitionsHash:Array

Some variables in ‘set_expression’ (most likely) refer to variable defined in set constructor generate. Return name of this variables.

Returns:

  • (Hash:Array)

    with :node_type,:value, :tree -properties



701
702
703
704
# File 'lib/parser/parser_nodes.rb', line 701

def symbol_definitions
  return [] unless binds_node
  [ { :node_type => node_type, :value => binds_node.bind_var.expression_val, :tree=>binds_node } ]
end