Class: BitClust::FunctionReferenceParser

Inherits:
Object
  • Object
show all
Defined in:
lib/bitclust/functionreferenceparser.rb

Overview

Parser for C API reference file (refm/capi/src/*) Much simpler than Ruby API reference parser(RRDParser) because C APIs does not have library, class, etc.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db) ⇒ FunctionReferenceParser

Returns a new instance of FunctionReferenceParser.



26
27
28
# File 'lib/bitclust/functionreferenceparser.rb', line 26

def initialize(db)
  @db = db
end

Class Method Details

.parse_file(path, params = {"version" => "1.9.0"}) ⇒ Object

Returns an array of FunctionEntry



21
22
23
24
# File 'lib/bitclust/functionreferenceparser.rb', line 21

def FunctionReferenceParser.parse_file(path, params = {"version" => "1.9.0"})
  parser = new(FunctionDatabase.dummy(params))
  parser.parse_file(path, File.basename(path, ".rd"), params)
end

Instance Method Details

#parse(f, filename, params = {}) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/bitclust/functionreferenceparser.rb', line 36

def parse(f, filename, params = {})
  @filename = filename
  @path = f.path
  s = Preprocessor.read(f, params)
  file_entries LineInput.for_string(s)
  @db.functions
end

#parse_file(path, filename, properties) ⇒ Object



30
31
32
33
34
# File 'lib/bitclust/functionreferenceparser.rb', line 30

def parse_file(path, filename, properties)
  fopen(path, 'r:UTF-8') {|f|
    return parse(f, filename, properties)
  }
end