Deal with more complex array length expressions. (thanks @jlindgren90 !)

This commit is contained in:
mvandervoord
2020-03-18 15:19:23 -04:00
parent 8885be7e55
commit 0f196a52cf
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ class CMockHeaderParser
@c_calling_conventions = cfg.c_calling_conventions.uniq
@treat_as_array = cfg.treat_as_array
@treat_as_void = (['void'] + cfg.treat_as_void).uniq
@function_declaration_parse_base_match = '([\w\s\*\(\),\[\]]+??)\(([\w\s\*\(\),\.\[\]+-]*)\)'
@function_declaration_parse_base_match = '([\w\s\*\(\),\[\]]+??)\(([\w\s\*\(\),\.\[\]+\-\/]*)\)'
@declaration_parse_matcher = /#{@function_declaration_parse_base_match}$/m
@standards = (['int','short','char','long','unsigned','signed'] + cfg.treat_as.keys).uniq
@array_size_name = cfg.array_size_name
@@ -392,7 +392,7 @@ class CMockHeaderParser
else
c = 0
# magically turn brackets into asterisks, also match for parentheses that come from macros
arg_list.gsub!(/(\w+)(?:\s*\[[\s\w\(\)+-]*\])+/, '*\1')
arg_list.gsub!(/(\w+)(?:\s*\[[^\[\]]*\])+/, '*\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)