comparison lisp/progmodes/sh-script.el @ 90984:a1be62cbd32a

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 814-815) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-232
author Miles Bader <miles@gnu.org>
date Wed, 18 Jul 2007 22:15:15 +0000
parents 988f1edc9674 bf55b9b62e57
children f55f9811f5d7
comparison
equal deleted inserted replaced
90983:8cdd8b5fa891 90984:a1be62cbd32a
984 (defun sh-font-lock-here-doc (limit) 984 (defun sh-font-lock-here-doc (limit)
985 "Search for a heredoc marker." 985 "Search for a heredoc marker."
986 ;; This looks silly, but it's because `sh-here-doc-re' keeps changing. 986 ;; This looks silly, but it's because `sh-here-doc-re' keeps changing.
987 (re-search-forward sh-here-doc-re limit t)) 987 (re-search-forward sh-here-doc-re limit t))
988 988
989 (defun sh-quoted-subshell (limit) 989 (defun sh-font-lock-quoted-subshell (limit)
990 "Search for a subshell embedded in a string. 990 "Search for a subshell embedded in a string.
991 Find all the unescaped \" characters within said subshell, remembering that 991 Find all the unescaped \" characters within said subshell, remembering that
992 subshells can nest." 992 subshells can nest."
993 ;; FIXME: This can (and often does) match multiple lines, yet it makes no 993 ;; FIXME: This can (and often does) match multiple lines, yet it makes no
994 ;; effort to handle multiline cases correctly, so it ends up being 994 ;; effort to handle multiline cases correctly, so it ends up being
1016 (?\` (case state 1016 (?\` (case state
1017 (backquote (setq state (pop states))) 1017 (backquote (setq state (pop states)))
1018 (t (push state states) (setq state 'backquote)))) 1018 (t (push state states) (setq state 'backquote))))
1019 (?\$ (if (not (eq (char-after (1+ (point))) ?\()) 1019 (?\$ (if (not (eq (char-after (1+ (point))) ?\())
1020 nil 1020 nil
1021 (forward-char 1)
1021 (case state 1022 (case state
1022 (t (push state states) (setq state 'code))))) 1023 (t (push state states) (setq state 'code)))))
1023 (?\( (case state 1024 (?\( (case state
1024 (double-quote nil) 1025 (double-quote nil)
1025 (t (push state states) (setq state 'code)))) 1026 (t (push state states) (setq state 'code))))
1026 (?\) (case state 1027 (?\) (case state
1027 (double-quote nil) 1028 (double-quote nil)
1028 (t (setq state (pop states))))) 1029 (t (setq state (pop states)))))
1029 (t (error "Internal error in sh-quoted-subshell"))) 1030 (t (error "Internal error in sh-font-lock-quoted-subshell")))
1030 (forward-char 1))) 1031 (forward-char 1)))
1031 t)) 1032 t))
1032 1033
1033 1034
1034 (defun sh-is-quoted-p (pos) 1035 (defun sh-is-quoted-p (pos)
1109 nil t)) 1110 nil t))
1110 ;; Distinguish the special close-paren in `case'. 1111 ;; Distinguish the special close-paren in `case'.
1111 (")" 0 (sh-font-lock-paren (match-beginning 0))) 1112 (")" 0 (sh-font-lock-paren (match-beginning 0)))
1112 ;; highlight (possibly nested) subshells inside "" quoted regions correctly. 1113 ;; highlight (possibly nested) subshells inside "" quoted regions correctly.
1113 ;; This should be at the very end because it uses syntax-ppss. 1114 ;; This should be at the very end because it uses syntax-ppss.
1114 (sh-quoted-subshell))) 1115 (sh-font-lock-quoted-subshell)))
1115 1116
1116 (defun sh-font-lock-syntactic-face-function (state) 1117 (defun sh-font-lock-syntactic-face-function (state)
1117 (let ((q (nth 3 state))) 1118 (let ((q (nth 3 state)))
1118 (if q 1119 (if q
1119 (if (characterp q) 1120 (if (characterp q)