Show More
@@ -51,22 +51,20 b' def compilere(pat, multiline=False):' | |||
|
51 | 51 | return re.compile(pat) |
|
52 | 52 | |
|
53 | 53 | def repquote(m): |
|
54 | fromc = '.:' | |
|
55 | tochr = 'pq' | |
|
54 | fixedmap = {'.': 'p', ':': 'q'} | |
|
56 | 55 | def encodechr(i): |
|
57 | 56 | if i > 255: |
|
58 | 57 | return 'u' |
|
59 | 58 | c = chr(i) |
|
60 | 59 | if c in ' \n': |
|
61 | 60 | return c |
|
61 | if c in fixedmap: | |
|
62 | return fixedmap[c] | |
|
62 | 63 | if c.isalpha(): |
|
63 | 64 | return 'x' |
|
64 | 65 | if c.isdigit(): |
|
65 | 66 | return 'n' |
|
66 |
|
|
|
67 | return tochr[fromc.find(c)] | |
|
68 | except (ValueError, IndexError): | |
|
69 | return 'o' | |
|
67 | return 'o' | |
|
70 | 68 | t = m.group('text') |
|
71 | 69 | tt = ''.join(encodechr(i) for i in xrange(256)) |
|
72 | 70 | t = t.translate(tt) |
@@ -248,7 +246,7 b' pypats = [' | |||
|
248 | 246 | (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"), |
|
249 | 247 | (r'\w\s=\s\s+\w', "gratuitous whitespace after ="), |
|
250 | 248 | (r'.{81}', "line too long"), |
|
251 | (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), | |
|
249 | (r' x+[xpqo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), | |
|
252 | 250 | (r'[^\n]\Z', "no trailing newline"), |
|
253 | 251 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), |
|
254 | 252 | # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', |
@@ -248,3 +248,27 b' web templates' | |||
|
248 | 248 | > {desc|escape} |
|
249 | 249 | warning: follow desc keyword with either firstline or websub |
|
250 | 250 | [1] |
|
251 | ||
|
252 | 'string join across lines with no space' detection | |
|
253 | ||
|
254 | $ cat > stringjoin.py <<EOF | |
|
255 | > foo = (' foo' | |
|
256 | > 'bar foo.' | |
|
257 | > 'bar foo:' | |
|
258 | > 'bar foo@' | |
|
259 | > 'bar') | |
|
260 | > EOF | |
|
261 | $ "$check_code" stringjoin.py | |
|
262 | stringjoin.py:1: | |
|
263 | > foo = (' foo' | |
|
264 | string join across lines with no space | |
|
265 | stringjoin.py:2: | |
|
266 | > 'bar foo.' | |
|
267 | string join across lines with no space | |
|
268 | stringjoin.py:3: | |
|
269 | > 'bar foo:' | |
|
270 | string join across lines with no space | |
|
271 | stringjoin.py:4: | |
|
272 | > 'bar foo@' | |
|
273 | string join across lines with no space | |
|
274 | [1] |
General Comments 0
You need to be logged in to leave comments.
Login now