diff options
author | Rodney Dawes <dobey@gnome.org> | 2009-07-12 17:50:01 -0400 |
---|---|---|
committer | Tarmac <> | 2009-07-12 17:50:01 -0400 |
commit | a13e0df6dd10cddcbd1bf17ed2bc661e0d225cc0 (patch) | |
tree | 8050b2426a8f197f98f250596dffc25a06f218fa /intltool-update.in | |
parent | 8145d0bc83487c58802332347bfb7bdb05a17e00 (diff) | |
parent | 18eb0f1461fbdbc0cc74195106dee4fdc6eada5d (diff) | |
download | intltool-a13e0df6dd10cddcbd1bf17ed2bc661e0d225cc0.tar.gz |
Handle multi-line python strings ''' and """ better
Diffstat (limited to 'intltool-update.in')
-rw-r--r-- | intltool-update.in | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/intltool-update.in b/intltool-update.in index cd92b51..852dd1d 100644 --- a/intltool-update.in +++ b/intltool-update.in @@ -425,6 +425,7 @@ sub FindLeftoutFiles { my $in_comment = 0; my $in_macro = 0; + my $in_string = 0; open FILE, "<$file"; while (<FILE>) @@ -436,6 +437,13 @@ sub FindLeftoutFiles $in_comment = 0; } + # Handle continued multi-line string. + if ($in_string) + { + next unless /(\'\'\'|\"\"\")/; + $in_string = 0; + } + # Handle continued macro. if ($in_macro) { @@ -451,7 +459,7 @@ sub FindLeftoutFiles } # Handle comments and quoted text. - while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy + while (m-(/\*|//|\'\'\'|\"\"\"|\'|\")-) # \' and \" keep emacs perl mode happy { my $match = $1; if ($match eq "/*") @@ -466,6 +474,14 @@ sub FindLeftoutFiles { s-//.*--; } + elsif ($match eq "\"\"\"" or $match eq "\'\'\'") + { + if (!s-$match.*?$match--) + { + s-$match.*--; + $in_string = 1; + } + } else # ' or " { if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-) |