Class: SbuilderSexp::VariableDef

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

Overview


Variable

Instance Method Summary collapse

Methods inherited from Treetop::Runtime::SyntaxNode

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

Instance Method Details

#initExpression

Returns tree node for init expression.

Returns:



1231
1232
1233
# File 'lib/parser/parser_nodes.rb', line 1231

def init
  tree_nodes = recursive_select(SbuilderSexp::Expression).first
end

#nameObject



1219
1220
1221
1222
# File 'lib/parser/parser_nodes.rb', line 1219

def name
  # recursive_select(SbuilderSexp::Identifier).first.node_value
  variable.node_value
end

#symbol_definitionsArray

Return entries for symbol table. In this case, add just variable definition.

Returns:

  • (Array)

    of 1 hash with :node_type,:value



1239
1240
1241
# File 'lib/parser/parser_nodes.rb', line 1239

def symbol_definitions
  [ { :node_type => node_type, :value => name } ]
end

#variableIdentifier

Returns tree node for variable defined.

Returns:



1225
1226
1227
# File 'lib/parser/parser_nodes.rb', line 1225

def variable
  tree_nodes = recursive_select(SbuilderSexp::Identifier).first      
end