comparison lisp/progmodes/sh-script.el @ 37528:5a240d7bd802

(sh-font-lock-heredoc): Allow optional backslash at the start of the here-document delimiter. (sh-font-lock-syntactic-keywords): Likewise.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 30 Apr 2001 15:23:01 +0000
parents f9dbfb08ed11
children 51f2e2a0c455
comparison
equal deleted inserted replaced
37527:d585b711c8d2 37528:5a240d7bd802
827 "^" (if quoted "[ \t]*") 827 "^" (if quoted "[ \t]*")
828 (regexp-quote (replace-regexp-in-string "['\"]" "" string)) 828 (regexp-quote (replace-regexp-in-string "['\"]" "" string))
829 "\\(\n\\)"))) 829 "\\(\n\\)")))
830 (unless (assoc ere font-lock-syntactic-keywords) 830 (unless (assoc ere font-lock-syntactic-keywords)
831 (let* ( ;; A rough regexp that should find us back. 831 (let* ( ;; A rough regexp that should find us back.
832 (sre (concat "<<\\(-\\)?\\s-*['\"]?" 832 (sre (concat "<<\\(-\\)?\\s-*\\\\?['\"]?"
833 (regexp-quote string) "['\"]?[ \t\n]")) 833 (regexp-quote string) "['\"]?[ \t\n]"))
834 (code `(cond 834 (code `(cond
835 ((save-excursion (re-search-backward ,sre nil t)) 835 ((save-excursion (re-search-backward ,sre nil t))
836 ;; This ^STRING$ is indeed following a <<STRING 836 ;; This ^STRING$ is indeed following a <<STRING
837 sh-here-doc-syntax) 837 sh-here-doc-syntax)
873 ;; word. In the shell, words are separated by metacharacters. 873 ;; word. In the shell, words are separated by metacharacters.
874 ;; The list of special chars is taken from the single-unix spec 874 ;; The list of special chars is taken from the single-unix spec
875 ;; of the shell command language (under `quoting') but with `$' removed. 875 ;; of the shell command language (under `quoting') but with `$' removed.
876 `(("[^|&;<>()`\\\"' \t\n]\\(#+\\)" 1 ,sh-st-symbol) 876 `(("[^|&;<>()`\\\"' \t\n]\\(#+\\)" 1 ,sh-st-symbol)
877 ;; Find HEREDOC starters and add a corresponding rule for the ender. 877 ;; Find HEREDOC starters and add a corresponding rule for the ender.
878 ("[^<>]<<\\(-\\)?\\s-*\\(\\(['\"][^'\"]+['\"]\\|\\sw\\|\\s_\\)+\\).*\\(\n\\)" 878 ("[^<>]<<\\(-\\)?\\s-*\\\\?\\(\\(['\"][^'\"]+['\"]\\|\\sw\\|\\s_\\)+\\).*\\(\n\\)"
879 4 (sh-font-lock-heredoc 879 4 (sh-font-lock-heredoc
880 (match-beginning 0) (match-string 2) (match-end 1))) 880 (match-beginning 0) (match-string 2) (match-end 1)))
881 ;; Distinguish the special close-paren in `case'. 881 ;; Distinguish the special close-paren in `case'.
882 (")" 0 (sh-font-lock-paren (match-beginning 0))))) 882 (")" 0 (sh-font-lock-paren (match-beginning 0)))))
883 883