mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-30 19:53:09 +00:00
* lisp/progmodes/sh-script.el: Better handle nested quotes
(sh-here-doc-open-re): Don't mis-match the <<< operator (bug#20683). (sh-font-lock-quoted-subshell): Make sure double quotes within single quotes don't mistakenly end prematurely the surrounding string.
This commit is contained in:
parent
26a17f5ac9
commit
06193432f2
@ -987,7 +987,7 @@ See `sh-feature'.")
|
|||||||
"\\(?:\\(?:.*[^\\\n]\\)?\\(?:\\\\\\\\\\)*\\\\\n\\)*.*")
|
"\\(?:\\(?:.*[^\\\n]\\)?\\(?:\\\\\\\\\\)*\\\\\n\\)*.*")
|
||||||
|
|
||||||
(defconst sh-here-doc-open-re
|
(defconst sh-here-doc-open-re
|
||||||
(concat "<<-?\\s-*\\\\?\\(\\(?:['\"][^'\"]+['\"]\\|\\sw\\|[-/~._]\\)+\\)"
|
(concat "[^<]<<-?\\s-*\\\\?\\(\\(?:['\"][^'\"]+['\"]\\|\\sw\\|[-/~._]\\)+\\)"
|
||||||
sh-escaped-line-re "\\(\n\\)")))
|
sh-escaped-line-re "\\(\n\\)")))
|
||||||
|
|
||||||
(defun sh--inside-noncommand-expression (pos)
|
(defun sh--inside-noncommand-expression (pos)
|
||||||
@ -1064,7 +1064,16 @@ subshells can nest."
|
|||||||
(pcase (char-after)
|
(pcase (char-after)
|
||||||
(?\' (pcase state
|
(?\' (pcase state
|
||||||
(`double-quote nil)
|
(`double-quote nil)
|
||||||
(_ (forward-char 1) (skip-chars-forward "^'" limit))))
|
(_ (forward-char 1)
|
||||||
|
;; FIXME: mark skipped double quotes as punctuation syntax.
|
||||||
|
(let ((spos (point)))
|
||||||
|
(skip-chars-forward "^'" limit)
|
||||||
|
(save-excursion
|
||||||
|
(let ((epos (point)))
|
||||||
|
(goto-char spos)
|
||||||
|
(while (search-forward "\"" epos t)
|
||||||
|
(put-text-property (point) (1- (point))
|
||||||
|
'syntax-table '(1)))))))))
|
||||||
(?\\ (forward-char 1))
|
(?\\ (forward-char 1))
|
||||||
(?\" (pcase state
|
(?\" (pcase state
|
||||||
(`double-quote (setq state (pop states)))
|
(`double-quote (setq state (pop states)))
|
||||||
|
Loading…
Reference in New Issue
Block a user