From e87c7547822a9e80c5f92721e437eda398c6cf48 Mon Sep 17 00:00:00 2001 From: goodale Date: Thu, 25 Apr 2002 16:04:38 +0000 Subject: Don't get confused by ( and ) in strings in macro arguments. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2754 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/sbin/cpp.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/sbin/cpp.pl b/lib/sbin/cpp.pl index c1b6a998..b3e545dd 100755 --- a/lib/sbin/cpp.pl +++ b/lib/sbin/cpp.pl @@ -1022,16 +1022,26 @@ sub ParseAndExpand # Find any arguments if($splitline[$pos+1] eq "(") { + my $insstring = 0; + my $indstring = 0; $pos++; my $depth = 1; $pos++; while($pos < @splitline && $depth > 0) { - if($splitline[$pos] eq "(") + if($splitline[$pos] eq '\'' && ! $indstring) + { + $insstring = 1 - $insstring; + } + if($splitline[$pos] eq '"'&& ! $insstring) + { + $indstring = 1 - $indstring; + } + if($splitline[$pos] eq "(" && ! $insstring && ! $indstring) { $depth++; } - elsif($splitline[$pos] eq ")") + elsif($splitline[$pos] eq ")" && ! $insstring && ! $indstring) { $depth--; } -- cgit v1.2.3