Class: SbuilderSexp::IfExpression

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

#condition_nodeExpression

Node for condition

Returns:



336
337
338
# File 'lib/parser/parser_nodes.rb', line 336

def condition_node
  recursive_select( SbuilderSexp::IfExpressionCondition ).first.recursive_select(SbuilderSexp::Expression).first
end

#else_expression_nodeExpression

Returns for ELSE expression.

Returns:



345
346
347
348
349
# File 'lib/parser/parser_nodes.rb', line 345

def else_expression_node
  tree_node = recursive_select( SbuilderSexp::IfExpressionElse ).first
  return tree_node unless tree_node
  tree_node.recursive_select(SbuilderSexp::Expression).first
end

#nameObject



351
352
353
# File 'lib/parser/parser_nodes.rb', line 351

def name
  'IF'
end

#then_expression_nodeExpression

Returns for THEN expression.

Returns:



341
342
# File 'lib/parser/parser_nodes.rb', line 341

def then_expression_node
recursive_select( SbuilderSexp::IfExpressionThen ).first.recursive_select(SbuilderSexp::Expression).first       end