@@ -58,7 +58,7 @@ def parse_cpp_modules(entry_point)
5858
5959 # Functions with signatures that I currently don't understand well
6060 # enough to parse.
61- module_declaration &.scan ( /(?:WRAP_VERSION_FUNC|WRAPN )\( ([^)]+)\) / ) do |match |
61+ module_declaration &.scan ( /(?:WRAP_VERSION_FUNC)\( ([^)]+)\) / ) do |match |
6262 function_name = match [ 0 ] . split ( ', ' ) [ 0 ]
6363 output << "---@field #{ function_name } function\n "
6464 end
@@ -77,12 +77,10 @@ def parse_cpp_modules(entry_point)
7777 signature_name = signature . gsub ( /"/ , '' ) . strip
7878
7979 cleaned_signature_name = signature_name . gsub ( /#{ module_name } _/ , '' )
80- module_file [ /^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ namespace } #{ cleaned_signature_name } \s ? \( ([^)]+)?\) / ]
80+ module_file [ /^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ namespace } #{ cleaned_signature_name } \R ? \s * \( ([^)]+)?\) / ]
8181 next if Regexp . last_match
8282
83- file [ /^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ signature_name } \s ?\( ([^)]+)?\) / ]
84- next unless Regexp . last_match
85-
83+ file [ /^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ signature_name } \R ?\s *\( ([^)]+)?\) / ]
8684 output << "---@field #{ function_name } function\n "
8785 end
8886
@@ -98,13 +96,18 @@ def parse_cpp_modules(entry_point)
9896 signature_name = signature . gsub ( /"/ , '' ) . strip
9997
10098 cleaned_signature_name = signature_name . gsub ( /#{ module_name } _/ , '' )
101- module_file [ %r{(//.*\R )?^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ namespace } #{ cleaned_signature_name } \s ? \( ([^)]+)?\) } ]
99+ module_file [ %r{(//.*\R )?^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ namespace } #{ cleaned_signature_name } \R ? \s * \( ([^)]+)?\) } ]
102100 next unless Regexp . last_match
103101
104102 functions << DFHackLuaDefinitions ::CPP . parse_function ( Regexp . last_match , module_name :, prefix :,
105103 function_name :)
106104 end
107105
106+ module_declaration &.scan ( /WRAPN\( \s *(\w +)\s *,\s *(\w +)\s *\) / ) do |function_name , signature_name |
107+ file [ %r{(//.*\R )?^(?:static\s )?(\S +).*?#{ signature_name } \R ?\s *\( ([^)]+)?\) } ]
108+ functions << CPP . parse_function ( Regexp . last_match , module_name :, prefix :, function_name :)
109+ end
110+
108111 module_declaration &.scan ( /(?:WRAP|WRAPM)\( (.+)?\) ,?/ ) do |function_name , |
109112 function_name = Regexp . last_match ( 1 ) if function_name =~ /,\s ?(\S +)/
110113 signature = "#{ namespace } #{ function_name } "
0 commit comments