[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110353: Fix cornercase for string sy
From: |
Fabián Ezequiel Gallina |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110353: Fix cornercase for string syntax. |
Date: |
Wed, 03 Oct 2012 18:53:09 -0300 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110353
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: trunk
timestamp: Wed 2012-10-03 18:53:09 -0300
message:
Fix cornercase for string syntax.
* progmodes/python.el (python-syntax-propertize-function):
Simplify and enhance the regexp for unescaped quotes. Now it also
matches quotes in weird situations like the single quote in
"something\"'".
(python-syntax-stringify): Simplify num-quotes detecting code.
modified:
lisp/ChangeLog
lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-10-03 16:15:04 +0000
+++ b/lisp/ChangeLog 2012-10-03 21:53:09 +0000
@@ -1,3 +1,12 @@
+2012-10-03 Fabián Ezequiel Gallina <address@hidden>
+
+ Fix cornercase for string syntax.
+ * progmodes/python.el (python-syntax-propertize-function):
+ Simplify and enhance the regexp for unescaped quotes. Now it also
+ matches quotes in weird situations like the single quote in
+ "something\"'".
+ (python-syntax-stringify): Simplify num-quotes detecting code.
+
2012-10-03 Glenn Morris <address@hidden>
* help-macro.el (three-step-help):
=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el 2012-10-01 00:53:44 +0000
+++ b/lisp/progmodes/python.el 2012-10-03 21:53:09 +0000
@@ -499,16 +499,15 @@
(defconst python-syntax-propertize-function
(syntax-propertize-rules
((rx
- (or (and
- ;; Match even number of backslashes.
- (or (not (any ?\\ ?\' ?\")) point) (* ?\\ ?\\)
- ;; Match single or triple quotes of any kind.
- (group (or "\"" "\"\"\"" "'" "'''")))
- (and
- ;; Match odd number of backslashes.
- (or (not (any ?\\)) point) ?\\ (* ?\\ ?\\)
- ;; Followed by even number of equal quotes.
- (group (or "\"\"" "\"\"\"\"" "''" "''''")))))
+ (and
+ ;; Match even number of backslashes.
+ (or (not (any ?\\ ?\' ?\")) point
+ ;; Quotes might be preceeded by a escaped quote.
+ (and (or (not (any ?\\)) point) ?\\
+ (* ?\\ ?\\) (any ?\' ?\")))
+ (* ?\\ ?\\)
+ ;; Match single or triple quotes of any kind.
+ (group (or "\"" "\"\"\"" "'" "'''"))))
(0 (ignore (python-syntax-stringify))))))
(defsubst python-syntax-count-quotes (quote-char &optional point limit)
@@ -525,12 +524,7 @@
(defun python-syntax-stringify ()
"Put `syntax-table' property correctly on single/triple quotes."
- (let* ((num-quotes
- (let ((n (length (or (match-string-no-properties 1)
- (match-string-no-properties 2)))))
- ;; This corrects the quote count when matching odd number
- ;; of backslashes followed by even number of quotes.
- (or (and (= 1 (logand n 1)) n) (1- n))))
+ (let* ((num-quotes (length (match-string-no-properties 1)))
(ppss (prog2
(backward-char num-quotes)
(syntax-ppss)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110353: Fix cornercase for string syntax.,
Fabián Ezequiel Gallina <=