mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-17 23:59:59 +00:00
Merge pull request #268 from jlindgren90/master
Allow arbitrary parentheses within length of array arguments.
This commit is contained in:
@@ -357,12 +357,15 @@ class CMockHeaderParser
|
||||
if ((@local_as_void.include?(arg_list.strip)) or (arg_list.empty?))
|
||||
return 'void'
|
||||
else
|
||||
c=0
|
||||
arg_list.gsub!(/(\w+)(?:\s*\[\s*\(*[\s\w+-]*\)*\s*\])+/,'*\1') # magically turn brackets into asterisks, also match for parentheses that come from macros
|
||||
arg_list.gsub!(/\s+\*/,'*') # remove space to place asterisks with type (where they belong)
|
||||
arg_list.gsub!(/\*(\w)/,'* \1') # pull asterisks away from arg to place asterisks with type (where they belong)
|
||||
c = 0
|
||||
# magically turn brackets into asterisks, also match for parentheses that come from macros
|
||||
arg_list.gsub!(/(\w+)(?:\s*\[[\s\w\(\)+-]*\])+/, '*\1')
|
||||
# remove space to place asterisks with type (where they belong)
|
||||
arg_list.gsub!(/\s+\*/, '*')
|
||||
# pull asterisks away from arg to place asterisks with type (where they belong)
|
||||
arg_list.gsub!(/\*(\w)/, '* \1')
|
||||
|
||||
#scan argument list for function pointers and replace them with custom types
|
||||
# scan argument list for function pointers and replace them with custom types
|
||||
arg_list.gsub!(/([\w\s\*]+)\(+\s*\*[\*\s]*([\w\s]*)\s*\)+\s*\(((?:[\w\s\*]*,?)*)\s*\)*/) do |m|
|
||||
|
||||
functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}"
|
||||
|
||||
Reference in New Issue
Block a user