mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
(py-goto-beginning-of-tqs): When searching backwards for the matching
delimiter, watch out for backslash escaped delimiters. Also use = instead of eq for character comparison (because a character is = to it's integer value, but not eq to it).
This commit is contained in:
parent
08a8a355be
commit
3c34bb33ff
1 changed files with 8 additions and 4 deletions
|
@ -2864,12 +2864,16 @@ If nesting level is zero, return nil."
|
||||||
"Go to the beginning of the triple quoted string we find ourselves in.
|
"Go to the beginning of the triple quoted string we find ourselves in.
|
||||||
DELIM is the TQS string delimiter character we're searching backwards
|
DELIM is the TQS string delimiter character we're searching backwards
|
||||||
for."
|
for."
|
||||||
(let ((skip (and delim (make-string 1 delim))))
|
(let ((skip (and delim (make-string 1 delim)))
|
||||||
|
(continue t))
|
||||||
(when skip
|
(when skip
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(py-safe (search-backward skip))
|
(while continue
|
||||||
(if (and (eq (char-before) delim)
|
(py-safe (search-backward skip))
|
||||||
(eq (char-before (1- (point))) delim))
|
(setq continue (and (not (bobp))
|
||||||
|
(= (char-before) ?\\))))
|
||||||
|
(if (and (= (char-before) delim)
|
||||||
|
(= (char-before (1- (point))) delim))
|
||||||
(setq skip (make-string 3 delim))))
|
(setq skip (make-string 3 delim))))
|
||||||
;; we're looking at a triple-quoted string
|
;; we're looking at a triple-quoted string
|
||||||
(py-safe (search-backward skip)))))
|
(py-safe (search-backward skip)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue