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
=== modified file 'intltool-update.in'
--- intltool-update.in 2009-04-21 01:58:31 +0000
+++ intltool-update.in 2009-07-12 19:12:22 +0000
@@ -425,6 +425,7 @@
425 {425 {
426 my $in_comment = 0;426 my $in_comment = 0;
427 my $in_macro = 0;427 my $in_macro = 0;
428 my $in_string = 0;
428429
429 open FILE, "<$file";430 open FILE, "<$file";
430 while (<FILE>)431 while (<FILE>)
@@ -436,6 +437,13 @@
436 $in_comment = 0;437 $in_comment = 0;
437 }438 }
438439
440 # Handle continued multi-line string.
441 if ($in_string)
442 {
443 next unless /(\'\'\'|\"\"\")/;
444 $in_string = 0;
445 }
446
439 # Handle continued macro.447 # Handle continued macro.
440 if ($in_macro)448 if ($in_macro)
441 {449 {
@@ -451,7 +459,7 @@
451 }459 }
452460
453 # Handle comments and quoted text.461 # Handle comments and quoted text.
454 while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy462 while (m-(/\*|//|\'\'\'|\"\"\"|\'|\")-) # \' and \" keep emacs perl mode happy
455 {463 {
456 my $match = $1;464 my $match = $1;
457 if ($match eq "/*")465 if ($match eq "/*")
@@ -466,6 +474,14 @@
466 {474 {
467 s-//.*--;475 s-//.*--;
468 }476 }
477 elsif ($match eq "\"\"\"" or $match eq "\'\'\'")
478 {
479 if (!s-$match.*?$match--)
480 {
481 s-$match.*--;
482 $in_string = 1;
483 }
484 }
469 else # ' or "485 else # ' or "
470 {486 {
471 if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-)487 if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-)

Subscribers

People subscribed via source and target branches

to all changes: