Show More
@@ -50,25 +50,26 b' def compilere(pat, multiline=False):' | |||
|
50 | 50 | pass |
|
51 | 51 | return re.compile(pat) |
|
52 | 52 | |
|
53 | def repquote(m): | |
|
54 | 53 |
|
|
55 |
|
|
|
56 |
|
|
|
54 | # patterns (especially pypats), before changing around repquote() | |
|
55 | _repquotefixedmap = {' ': ' ', '\n': '\n', '.': 'p', ':': 'q', | |
|
57 | 56 | '%': '%', '\\': 'b', '*': 'A', '+': 'P', '-': 'M'} |
|
58 |
|
|
|
57 | def _repquoteencodechr(i): | |
|
59 | 58 |
|
|
60 | 59 |
|
|
61 | 60 |
|
|
62 |
|
|
|
63 |
|
|
|
61 | if c in _repquotefixedmap: | |
|
62 | return _repquotefixedmap[c] | |
|
64 | 63 |
|
|
65 | 64 |
|
|
66 | 65 |
|
|
67 | 66 |
|
|
68 | 67 |
|
|
68 | _repquotett = ''.join(_repquoteencodechr(i) for i in xrange(256)) | |
|
69 | ||
|
70 | def repquote(m): | |
|
69 | 71 | t = m.group('text') |
|
70 | tt = ''.join(encodechr(i) for i in xrange(256)) | |
|
71 | t = t.translate(tt) | |
|
72 | t = t.translate(_repquotett) | |
|
72 | 73 | return m.group('quote') + t + m.group('quote') |
|
73 | 74 | |
|
74 | 75 | def reppython(m): |
@@ -276,7 +276,11 b' web templates' | |||
|
276 | 276 | > ''' "%-6d \n 123456 .:*+-= foobar") |
|
277 | 277 | > EOF |
|
278 | 278 | |
|
279 | $ "$check_code" stringjoin.py | |
|
279 | (Checking multiple invalid files at once examines whether caching | |
|
280 | translation table for repquote() works as expected or not. All files | |
|
281 | should break rules depending on result of repquote(), in this case) | |
|
282 | ||
|
283 | $ "$check_code" stringjoin.py uigettext.py | |
|
280 | 284 | stringjoin.py:1: |
|
281 | 285 | > foo = (' foo' |
|
282 | 286 | string join across lines with no space |
@@ -301,9 +305,6 b' web templates' | |||
|
301 | 305 | stringjoin.py:8: |
|
302 | 306 | > 'bar foo-' |
|
303 | 307 | string join across lines with no space |
|
304 | [1] | |
|
305 | ||
|
306 | $ "$check_code" uigettext.py | |
|
307 | 308 | uigettext.py:1: |
|
308 | 309 | > ui.status("% 10s %05d % -3.2f %*s %%" |
|
309 | 310 | missing _() in ui message (use () to hide false-positives) |
General Comments 0
You need to be logged in to leave comments.
Login now