mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-07-29 15:27:49 +00:00
Merge pull request #112 from ajsetter/header-parsing-brackets
Improve handling of brackets in function params. Thanks so much, @ajsetter!
This commit is contained in:
@@ -187,9 +187,9 @@ class CMockHeaderParser
|
||||
return 'void'
|
||||
else
|
||||
c=0
|
||||
arg_list.gsub!(/(\w+)(?:\s*\[[\s\d\w+-]*\])+/,'*\1') # magically turn brackets into asterisks
|
||||
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)
|
||||
arg_list.gsub!(/(\w+)(?:\s*\[\s*\(*[\s\d\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)
|
||||
|
||||
#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|
|
||||
|
||||
@@ -64,6 +64,8 @@
|
||||
|
||||
void oh_brackets1(int fudge[5]);
|
||||
void oh_brackets2(int caramel[]);
|
||||
void oh_brackets3(int toffee[(32)]);
|
||||
void oh_brackets4(int taffy[ (64) ]);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user