Instead of matching multiple characters, match any occurrence
preceded by a single whitespace and handle the exceptions
later.
# errno == EINTR)
# ;
#
- if ($data =~ /[^;\s]\s+[;,]/) {
- print "Whitespace before (semi)colon:\n";
- print "$file:$.: $line";
- $ret = 1;
+ if ($data =~ /\s[;,]/) {
+ unless ($data =~ /\S; ; / ||
+ $data =~ /^\s+;/) {
+ print "Whitespace before (semi)colon:\n";
+ print "$file:$.: $line";
+ $ret = 1;
+ }
}
# Require EOL, macro line continuation, or whitespace after ";".