[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Simple patch for pylupdate4
From:       Florent Rougon <f.rougon () free ! fr>
Date:       2013-08-30 15:47:05
Message-ID: 87ob8ffafa.fsf () frougon ! crabdance ! com
[Download RAW message or body]

Hello,

The following trivial patch to pylupdate/fetchtr.cpp (for PyQt 4.10.3)
allows pylupdate4 to correctly process backslashes at the end of a line,
instead of replacing such backslashes with a linefeed (ASCII 10)
character. This is very useful in triple-quoted strings to avoid
introducing newlines that don't exist in the original Python string.
(this is *not* about "\n" sequences; these work fine, having an
identical counterpart in C++ syntax)

Unfortunately, the patch only works for Python source files that have
Unix-style line endings, but doesn't make things any worse for other
newline styles. Ideally, Python source files would be read in some kind
of universal newlines mode...

Could you please include it, or something similar?

Thanks.

-- 
Florent

["pylupdate_backslash_newline_handling.diff" (text/x-diff)]

--- a/pylupdate/fetchtr.cpp
+++ b/pylupdate/fetchtr.cpp
@@ -342,7 +342,8 @@
                                     yyString[yyStringLen++] = (char) n;
                             } else {
                                 const char *p = strchr( tab, yyCh );
-                                if ( yyStringLen < sizeof(yyString) - 1 )
+                                if ( yyStringLen < sizeof(yyString) - 1
+                                     && yyCh != '\n' )
                                     yyString[yyStringLen++] = ( p == 0 ) ?
                                             (char) yyCh : backTab[p - tab];
                                 yyCh = getChar();


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic