Merge lp:~dobey/intltool/python-strings into lp:intltool

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 696
Merged at revision: not available
Proposed branch: lp:~dobey/intltool/python-strings
Merge into: lp:intltool
Diff against target: None lines
To merge this branch: bzr merge lp:~dobey/intltool/python-strings
Reviewer Review Type Date Requested Status
intltool Developers Pending
Review via email: mp+8648@code.launchpad.net

Commit message

Handle multi-line python strings ''' and """ better

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'intltool-update.in'
2--- intltool-update.in 2009-04-21 01:58:31 +0000
3+++ intltool-update.in 2009-07-12 19:12:22 +0000
4@@ -425,6 +425,7 @@
5 {
6 my $in_comment = 0;
7 my $in_macro = 0;
8+ my $in_string = 0;
9
10 open FILE, "<$file";
11 while (<FILE>)
12@@ -436,6 +437,13 @@
13 $in_comment = 0;
14 }
15
16+ # Handle continued multi-line string.
17+ if ($in_string)
18+ {
19+ next unless /(\'\'\'|\"\"\")/;
20+ $in_string = 0;
21+ }
22+
23 # Handle continued macro.
24 if ($in_macro)
25 {
26@@ -451,7 +459,7 @@
27 }
28
29 # Handle comments and quoted text.
30- while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy
31+ while (m-(/\*|//|\'\'\'|\"\"\"|\'|\")-) # \' and \" keep emacs perl mode happy
32 {
33 my $match = $1;
34 if ($match eq "/*")
35@@ -466,6 +474,14 @@
36 {
37 s-//.*--;
38 }
39+ elsif ($match eq "\"\"\"" or $match eq "\'\'\'")
40+ {
41+ if (!s-$match.*?$match--)
42+ {
43+ s-$match.*--;
44+ $in_string = 1;
45+ }
46+ }
47 else # ' or "
48 {
49 if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-)

Subscribers

People subscribed via source and target branches

to all changes: