Class: C2FFI4RB::Parser

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

Constant Summary collapse

TYPE_TABLE =
{
  ':unsigned-int' => ':uint',
  ':unsigned-char' => ':uchar',
  ':unsigned-long' => ':ulong',
  ':function-pointer' => ':pointer'
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.

[View source]

18
19
20
21
22
# File 'lib/c2ffi4rb/parser.rb', line 18

def initialize
  @struct_type = []
  @toplevels = []
  @anon_counter = 0
end

Class Method Details

.parse(arr) ⇒ Object

[View source]

14
15
16
# File 'lib/c2ffi4rb/parser.rb', line 14

def self.parse(arr)
  Parser.new.parse(arr)
end

Instance Method Details

#parse(arr) ⇒ Object

[View source]

24
25
26
27
28
29
30
# File 'lib/c2ffi4rb/parser.rb', line 24

def parse(arr)
  arr.each do |form|
    parse_toplevel(form)
  end

  puts @toplevels.join("\n\n")
end