@@ -62,29 +62,31 @@ def parse_cpp_modules(entry_point)
6262 end
6363
6464 # Functions that manipulate lua_state (usually?)
65- unless is_module
66- function_declaration &.scan ( /^\s *{\s *([^,]+),\s *([^}]+)\s *}/ ) do |name , signature |
67- next if name =~ /NULL/
65+ function_declaration &.scan ( /^\s +\{ ([^}]+)}/ ) do
66+ name , signature = Regexp . last_match ( 1 ) . gsub ( /['" ]/ , '' ) . strip . split ( ',' )
6867
69- function_name = name . gsub ( /"/ , '' ) . strip
70- signature_name = signature . gsub ( /"/ , '' ) . strip
68+ next if name =~ /NULL/
7169
72- module_file [ /^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ namespace } #{ signature_name . gsub (
73- /#{ module_name } _/ , ''
74- ) } \s ?\( ([^)]+)?\) /]
75- next if Regexp . last_match
70+ function_name = name . gsub ( /"/ , '' ) . strip
71+ signature_name = signature . gsub ( /"/ , '' ) . strip
72+
73+ module_file [ /^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ namespace } #{ signature_name . gsub (
74+ /#{ module_name } _/ , ''
75+ ) } \s ?\( ([^)]+)?\) /]
76+ next if Regexp . last_match
7677
77- file [ /^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ signature_name } \s ?\( ([^)]+)?\) / ] unless is_module
78- next unless Regexp . last_match
78+ file [ /^(?:static\s )?(?:DFHACK_EXPORT\s )?(\S +).*?#{ signature_name } \s ?\( ([^)]+)?\) / ]
79+ next unless Regexp . last_match
7980
80- output << "---@field #{ function_name } function\n "
81- end
81+ output << "---@field #{ function_name } function\n "
8282 end
8383
8484 output << "#{ prefix } #{ module_name } = {}\n \n "
8585
8686 # Guessing here a little bit.
87- function_declaration &.scan ( /^\s *{\s *([^,]+),\s *([^}]+)\s *}/ ) do |name , signature |
87+ function_declaration &.scan ( /^\s +\{ ([^}]+)}/ ) do
88+ name , signature = Regexp . last_match ( 1 ) . gsub ( /['" ]/ , '' ) . strip . split ( ',' )
89+
8890 next if name =~ /NULL/
8991
9092 function_name = name . gsub ( /"/ , '' ) . strip
0 commit comments