Skip to content

Commit

Permalink
fix analyze-vim-declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
cdickmann committed Dec 17, 2013
1 parent a950e37 commit 04111cb
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions devel/analyze-vim-declarations.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
require 'nokogiri'

require 'pp'
# :usage => analyze-vim-declarations.rb vim-declarations.xml foo-declarations.xml vmodl.db

XML_FNS = ARGV[0...-1]
Expand Down Expand Up @@ -130,14 +130,18 @@ def handle_version x

XML_FNS.each do |fn|
puts "parsing #{fn} ..."
xml = Nokogiri.parse(File.read(fn), nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS)
xml_str = File.read(fn)
xml_str = xml_str.gsub(/\<description-html\>(.*?)\<\/description-html\>/m, "")
xml = Nokogiri.parse(xml_str, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS)
xml.root.at('enums').children.each { |x| handle_enum x }
xml.root.at('managed-objects').children.each { |x| handle_managed_object x }
xml.root.at('data-objects').children.each { |x| handle_data_object x }
xml.root.at('faults').children.each { |x| handle_fault x }
#xml.root.at('definitions').at('version-types').children.each { |x| handle_version x }
end

#pp ID2NAME

munge_fault = lambda { |x| true }

TYPES.each do |k,t|
Expand All @@ -160,12 +164,20 @@ def handle_version x
end
t['methods'].each do |mName,x|
if y = x['result']
y['wsdl_type'] = ID2NAME[y['type-id-ref']]
begin
y['wsdl_type'] = ID2NAME[y['type-id-ref']]
rescue Exception => ex
pp ex
end
y.delete 'type-id-ref'
munge_fault[y]
end
x['params'].each do |r|
r['wsdl_type'] = ID2NAME[r['type-id-ref']]
begin
r['wsdl_type'] = ID2NAME[r['type-id-ref']]
rescue Exception => ex
pp ex
end
r.delete 'type-id-ref'
munge_fault[r]
end
Expand Down

0 comments on commit 04111cb

Please sign in to comment.