Class: SbuilderSexp::ChooseExpression

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

Instance Method Summary collapse

Methods inherited from SimpleExpression

#expression_val, #lhs_node

Methods inherited from AbstactExpression

#expression_postfix, #expression_prefix, #expression_val, #expressions, #has_rhs, #lhs_node, #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_nodeBoundInExpression

Returns root node for x in S.

Returns:



389
390
391
# File 'lib/parser/parser_nodes.rb', line 389

def binds_node
  recursive_select( SbuilderSexp::BoundInExpression ).first
end

#choose_expressionAbstractExpression

Choose defines ‘choose_expression’ in left hand size in binary tree modeling expression.

Returns:

  • (AbstractExpression)

    synxtax tree node for the quentified expression



397
398
399
# File 'lib/parser/parser_nodes.rb', line 397

def choose_expression
  expressions.first
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



407
408
409
# File 'lib/parser/parser_nodes.rb', line 407

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

#symbol_definitionHash

for the bind variabe in choose

Returns:

  • (Hash)

    of symbol_definition :node_type,:value,:tree



418
419
420
# File 'lib/parser/parser_nodes.rb', line 418

def symbol_definition
  { :node_type => node_type, :value => binds_node.bind_var.expression_val, :tree=>binds_node }
end

#symbol_definitionsHash:Array

Returns see ‘symbol_definition’.

Returns:

  • (Hash:Array)

    see ‘symbol_definition’



412
413
414
# File 'lib/parser/parser_nodes.rb', line 412

def symbol_definitions
  [symbol_definition]
end