Allow for whitespace between parens and brackets

This commit is contained in:
Andrew Setter
2017-03-03 13:30:22 -05:00
parent a55efdba19
commit ebf4ae274a
2 changed files with 4 additions and 3 deletions
+3 -3
View File
@@ -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, 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)
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|
@@ -65,6 +65,7 @@
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