Class: FFI::Generator::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/generator/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(indent = 2) ⇒ Parser

Returns a new instance of Parser.



8
9
10
11
12
13
14
15
# File 'lib/generator/parser.rb', line 8

def initialize(indent = 2)
  @indent = indent
  @typedefs = {}
  @nested_type = {}
  @nested_structure = {}
  @ignored = []
  @ignore_at_second_pass = []
end

Instance Method Details

#generate(node) ⇒ Object



16
17
18
19
20
21
# File 'lib/generator/parser.rb', line 16

def generate(node)
  result = ""
  result = pass(node)
  result = pass(node) unless @nested_type.empty?
  result
end

#ignore(*ignored) ⇒ Object



22
23
24
# File 'lib/generator/parser.rb', line 22

def ignore(*ignored)
  @ignored.concat(ignored)
end

#load_config(fn) ⇒ Object



25
26
27
# File 'lib/generator/parser.rb', line 25

def load_config(fn)
  eval(File.read(fn), binding)
end