]> granicus.if.org Git - python/commitdiff
(py-parse-state-re): Remove the "if" from the regular expression.
authorBarry Warsaw <barry@python.org>
Mon, 21 Oct 2002 15:58:29 +0000 (15:58 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 21 Oct 2002 15:58:29 +0000 (15:58 +0000)
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.

Misc/python-mode.el

index bf4c4d5f605a1d58f49f1b00279750da238666e5..6ae0c9b7721603b46bcf593908c96edc1ea7897c 100644 (file)
@@ -3148,7 +3148,7 @@ local bindings to py-newline-and-indent."))
 ;; Helper functions
 (defvar py-parse-state-re
   (concat
-   "^[ \t]*\\(if\\|elif\\|else\\|while\\|def\\|class\\)\\>"
+   "^[ \t]*\\(elif\\|else\\|while\\|def\\|class\\)\\>"
    "\\|"
    "^[^ #\t\n]"))