Mercurial > cpython-lru_cache-weakref
diff Misc/python-mode.el @ 25878:d4cfa4043c09 legacy-trunk
(py-parse-state-re): Remove the "if" from the regular expression.
This fixes an indentation bug reported by Jeremy when seeing multiple
list comprehensions like so:
[x for x in seq
if blah(x)]
# ...
[y for y in seq
if blah(y)]
The reason this broke is because this regexp caused the "find a safe
parsing start location higher up in the file" test to erroneously find
the if in the listcomp. I think the other keywords in this regexp are
fine and good enough.
After a weekend of testing, I can't find any adverse effects.
| author | Barry Warsaw <barry@python.org> |
|---|---|
| date | Mon, 21 Oct 2002 15:58:29 +0000 |
| parents | 1f2b1e684850 |
| children | bf9e0424237f |
line wrap: on
line diff
--- a/Misc/python-mode.el Mon Oct 21 14:25:24 2002 +0000 +++ b/Misc/python-mode.el Mon Oct 21 15:58:29 2002 +0000 @@ -3148,7 +3148,7 @@ ;; Helper functions (defvar py-parse-state-re (concat - "^[ \t]*\\(if\\|elif\\|else\\|while\\|def\\|class\\)\\>" + "^[ \t]*\\(elif\\|else\\|while\\|def\\|class\\)\\>" "\\|" "^[^ #\t\n]"))
