Class: SbuilderSexp::Snippets

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

Instance Method Summary collapse

Methods inherited from RootContainer

#value

Methods inherited from Treetop::Runtime::SyntaxNode

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

Instance Method Details

#callablesCallable:array

Returns of ‘Callable’ tree nodes.

Returns:

  • (Callable:array)

    of ‘Callable’ tree nodes



43
44
45
# File 'lib/parser/parser_nodes.rb', line 43

def callables
  recursive_select( SbuilderSexp::Callable )
end

#definesarray

Returns of ‘Define’ tree nodes.

Returns:

  • (array)

    of ‘Define’ tree nodes



48
49
50
# File 'lib/parser/parser_nodes.rb', line 48

def defines
  recursive_select( SbuilderSexp::Define )
end

#directive_definitionsObject



38
39
40
# File 'lib/parser/parser_nodes.rb', line 38

def directive_definitions
  directives.map { |d| d.directives }.flatten
end

#directivesDirective:array

Returns of parses’ tree nodes.

Returns:

  • (Directive:array)

    of parses’ tree nodes



34
35
36
# File 'lib/parser/parser_nodes.rb', line 34

def directives
  recursive_select( SbuilderSexp::Directive )
end

#nameObject



29
30
31
# File 'lib/parser/parser_nodes.rb', line 29

def name
  node_type
end

#symbol_definitionsArray

Snippets is main level parse target, and it adds to symbol table base context entries for ‘Define’ nodes

Returns:

  • (Array)

    of hash with {:node_type, :value, :tree }



57
58
59
# File 'lib/parser/parser_nodes.rb', line 57

def symbol_definitions
  defines.map { |c| { :node_type => c.node_type, :value => c.name, :tree => c } }
end