mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-10-02 06:57:35 +00:00
Replace search for first bracket/semicolon with regex matching first function declaration
The regex matches the function declaration at the start of the string (post-match).
This commit is contained in:
@@ -172,12 +172,8 @@ class CMockHeaderParser
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
# Determine if we are dealing with a declaration or a function definition
|
if /\A.*\b\([^\)]*\)\s*;/ === inline_function_match.post_match
|
||||||
first_open_bracket = inline_function_match.post_match.index("{")
|
# Only remove the inline part from the function declaration, leaving the function declaration won't do any harm
|
||||||
first_semicolon = inline_function_match.post_match.index(";")
|
|
||||||
|
|
||||||
if first_open_bracket.nil? or (!first_semicolon.nil? and first_semicolon < first_open_bracket)
|
|
||||||
puts "DECLARATION, IGNORE"
|
|
||||||
source = inline_function_match.pre_match + inline_function_match.post_match
|
source = inline_function_match.pre_match + inline_function_match.post_match
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user