summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanilo Segan <danilo@canonical.com>2011-10-08 10:34:09 +0200
committerDanilo Segan <danilo@canonical.com>2011-10-08 10:34:09 +0200
commit085200db7682676bc0df5a296d89b3a757392f09 (patch)
tree720c151cfe399fe4b57c21d706bd4dff57207386
parent44a49f91913944fbd55f758dba5ef509c2405239 (diff)
downloadintltool-085200db7682676bc0df5a296d89b3a757392f09.tar.gz
Add support for detecting scm strings in intltool-update -m.
-rw-r--r--intltool-update.in23
1 files changed, 18 insertions, 5 deletions
diff --git a/intltool-update.in b/intltool-update.in
index 5b3bf42..e4fdebe 100644
--- a/intltool-update.in
+++ b/intltool-update.in
@@ -451,10 +451,19 @@ sub FindLeftoutFiles
my $in_comment = 0;
my $in_macro = 0;
my $in_string = 0;
+ my @multiline_quotes = ("'''", '"""');
+ if ($file =~ /\.scm/) {
+ @multiline_quotes = ('"');
+ }
open FILE, "<$file";
while (<FILE>)
{
+ if ($file =~ /\.scm/) {
+ # Strip single quotes from .scm files.
+ s-\'--g;
+ }
+
# Handle continued multi-line comment.
if ($in_comment)
{
@@ -465,7 +474,11 @@ sub FindLeftoutFiles
# Handle continued multi-line string.
if ($in_string)
{
- next unless s/.*(\'\'\'|\"\"\")//;
+ my $pattern = join '|', @multiline_quotes;
+ if (!s/.*$pattern//) {
+ s///s;
+ next;
+ };
$in_string = 0;
}
@@ -499,11 +512,11 @@ sub FindLeftoutFiles
{
s-//.*--;
}
- elsif ($match eq "\"\"\"" or $match eq "\'\'\'")
+ elsif (grep($match, @multiline_quotes))
{
- if (!s-$match.*?$match--)
+ if (!s-$match(\\$match|[^$match])*$match-QUOTEDTEXT-g)
{
- s-$match.*--;
+ s-$match.*-QUOTEDTEXT-s;
$in_string = 1;
}
}
@@ -529,7 +542,7 @@ sub FindLeftoutFiles
}
## C_ N_ NC_ Q_ and _ are the macros defined in gi8n.h
- if (/(NC_|[NCQ]_|[^_]_|(^|$)[_]) *\(QUOTEDTEXT/m)
+ if (/(NC_|[NCQ]_|[^_]_|(^|$)[_]) *\(?QUOTEDTEXT/m)
{
AddFileToListIfMissing($file, \@buf_allfiles);
last;