The current regex for matching a C-style if is if\s*\(([^)]*)\)(?:\s*;.*\n)*\s*{. This causes problems with code like if (regupper(rx) == 0) { because of additional parentheses. When using this following, simpler regex, this works without problems: if\s*\((.*)\)(?:\s*;.*\n)*\s*{.
Is there any specific reason for the first form of the regex? This method also removes the special handling for the signed() macro.
I was avoiding the greedy match behavior of ".*" as it could potentially consume more text than intended. I have revised the regexes to use non-greedy matching so that nested parens can be used in expressions.
The current regex for matching a C-style if is
if\s*\(([^)]*)\)(?:\s*;.*\n)*\s*{
. This causes problems with code likeif (regupper(rx) == 0) {
because of additional parentheses. When using this following, simpler regex, this works without problems:if\s*\((.*)\)(?:\s*;.*\n)*\s*{
.Is there any specific reason for the first form of the regex? This method also removes the special handling for the
signed()
macro.