mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
* lisp/progmodes/sh-script.el (sh--inside-arithmetic-expression): New func.
(sh-font-lock-open-heredoc): Use it. Fixes: debbugs:12770
This commit is contained in:
parent
86a7968c86
commit
b08b6da7fe
4 changed files with 25 additions and 1 deletions
|
|
@ -940,6 +940,15 @@ See `sh-feature'.")
|
|||
(concat "<<-?\\s-*\\\\?\\(\\(?:['\"][^'\"]+['\"]\\|\\sw\\|[-/~._]\\)+\\)"
|
||||
sh-escaped-line-re "\\(\n\\)")))
|
||||
|
||||
(defun sh--inside-arithmetic-expression (pos)
|
||||
(save-excursion
|
||||
(let ((ppss (syntax-ppss pos)))
|
||||
(when (nth 1 ppss)
|
||||
(goto-char (nth 1 ppss))
|
||||
(and (eq ?\( (char-after))
|
||||
(eq ?\( (char-before))
|
||||
(eq ?\$ (char-before (1- (point)))))))))
|
||||
|
||||
(defun sh-font-lock-open-heredoc (start string eol)
|
||||
"Determine the syntax of the \\n after a <<EOF.
|
||||
START is the position of <<.
|
||||
|
|
@ -948,7 +957,8 @@ INDENTED is non-nil if the here document's content (and the EOF mark) can
|
|||
be indented (i.e. a <<- was used rather than just <<).
|
||||
Point is at the beginning of the next line."
|
||||
(unless (or (memq (char-before start) '(?< ?>))
|
||||
(sh-in-comment-or-string start))
|
||||
(sh-in-comment-or-string start)
|
||||
(sh--inside-arithmetic-expression start))
|
||||
;; We're looking at <<STRING, so we add "^STRING$" to the syntactic
|
||||
;; font-lock keywords to detect the end of this here document.
|
||||
(let ((str (replace-regexp-in-string "['\"]" "" string))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue