Fix bug in parenthetical statements being misinterpreted as functions. (Issue #414)

This commit is contained in:
Mark VanderVoord
2023-01-10 15:35:54 -05:00
parent 91bb49c4a8
commit 902b6c8b3d
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -14,7 +14,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[\w\s\*\(\),\[\]]*?)\(([\w\s\*\(\),\.\[\]+\-\/]*)\)'
@declaration_parse_matcher = /#{@function_declaration_parse_base_match}$/m
@standards = (%w[int short char long unsigned signed] + cfg.treat_as.keys).uniq
@array_size_name = cfg.array_size_name
+5 -2
View File
@@ -16,8 +16,8 @@ typedef struct _POINT_T
int y;
} POINT_T;
// typedef edge case;
// not ANSI C but it has been done and will break cmock if not handled
/* typedef edge case;
not ANSI C but it has been done and will break cmock if not handled */
typedef void VOID_TYPE_CRAZINESS;
/* fun parsing & mock generation cases */
@@ -36,6 +36,9 @@ char
int a,
unsigned int b);
/* this isn't a function, despite the parenthesis */
static const unsigned int foo = (1);
U16 *ptr_return1(int a);
U16* ptr_return2(int a);
U16 * ptr_return3(int a);