aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/cc-engine.el28
-rw-r--r--lisp/progmodes/cc-fonts.el26
-rw-r--r--lisp/progmodes/cc-mode.el27
-rw-r--r--lisp/progmodes/cperl-mode.el4
-rw-r--r--lisp/progmodes/ld-script.el9
-rw-r--r--lisp/progmodes/perl-mode.el43
-rw-r--r--lisp/progmodes/sh-script.el1
7 files changed, 72 insertions, 66 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 22f5b906e4e..59dc96af030 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6089,14 +6089,8 @@ comment at the start of cc-engine.el for more info."
6089 6089
6090(defsubst c-clear-found-types () 6090(defsubst c-clear-found-types ()
6091 ;; Clears `c-found-types'. 6091 ;; Clears `c-found-types'.
6092 (setq c-found-types (make-vector 53 0))) 6092 (setq c-found-types
6093 6093 (make-hash-table :test #'equal :weakness nil)))
6094(defun c-copy-found-types ()
6095 (let ((copy (make-vector 53 0)))
6096 (mapatoms (lambda (sym)
6097 (intern (symbol-name sym) copy))
6098 c-found-types)
6099 copy))
6100 6094
6101(defun c-add-type (from to) 6095(defun c-add-type (from to)
6102 ;; Add the given region as a type in `c-found-types'. If the region 6096 ;; Add the given region as a type in `c-found-types'. If the region
@@ -6110,29 +6104,27 @@ comment at the start of cc-engine.el for more info."
6110 ;; 6104 ;;
6111 ;; This function might do hidden buffer changes. 6105 ;; This function might do hidden buffer changes.
6112 (let ((type (c-syntactic-content from to c-recognize-<>-arglists))) 6106 (let ((type (c-syntactic-content from to c-recognize-<>-arglists)))
6113 (unless (intern-soft type c-found-types) 6107 (unless (gethash type c-found-types)
6114 (unintern (substring type 0 -1) c-found-types) 6108 (remhash (substring type 0 -1) c-found-types)
6115 (intern type c-found-types)))) 6109 (puthash type t c-found-types))))
6116 6110
6117(defun c-unfind-type (name) 6111(defun c-unfind-type (name)
6118 ;; Remove the "NAME" from c-found-types, if present. 6112 ;; Remove the "NAME" from c-found-types, if present.
6119 (unintern name c-found-types)) 6113 (remhash name c-found-types))
6120 6114
6121(defsubst c-check-type (from to) 6115(defsubst c-check-type (from to)
6122 ;; Return non-nil if the given region contains a type in 6116 ;; Return non-nil if the given region contains a type in
6123 ;; `c-found-types'. 6117 ;; `c-found-types'.
6124 ;; 6118 ;;
6125 ;; This function might do hidden buffer changes. 6119 ;; This function might do hidden buffer changes.
6126 (intern-soft (c-syntactic-content from to c-recognize-<>-arglists) 6120 (gethash (c-syntactic-content from to c-recognize-<>-arglists) c-found-types))
6127 c-found-types))
6128 6121
6129(defun c-list-found-types () 6122(defun c-list-found-types ()
6130 ;; Return all the types in `c-found-types' as a sorted list of 6123 ;; Return all the types in `c-found-types' as a sorted list of
6131 ;; strings. 6124 ;; strings.
6132 (let (type-list) 6125 (let (type-list)
6133 (mapatoms (lambda (type) 6126 (maphash (lambda (type _)
6134 (setq type-list (cons (symbol-name type) 6127 (setq type-list (cons type type-list)))
6135 type-list)))
6136 c-found-types) 6128 c-found-types)
6137 (sort type-list 'string-lessp))) 6129 (sort type-list 'string-lessp)))
6138 6130
@@ -7066,7 +7058,7 @@ comment at the start of cc-engine.el for more info."
7066 ;; This function might do hidden buffer changes. 7058 ;; This function might do hidden buffer changes.
7067 7059
7068 (let ((start (point)) 7060 (let ((start (point))
7069 (old-found-types (c-copy-found-types)) 7061 (old-found-types (copy-hash-table c-found-types))
7070 ;; If `c-record-type-identifiers' is set then activate 7062 ;; If `c-record-type-identifiers' is set then activate
7071 ;; recording of any found types that constitute an argument in 7063 ;; recording of any found types that constitute an argument in
7072 ;; the arglist. 7064 ;; the arglist.
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 66f2575f49f..b35d33a5fd3 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1182,10 +1182,15 @@ casts and declarations are fontified. Used on level 2 and higher."
1182 (goto-char match-pos) 1182 (goto-char match-pos)
1183 (backward-char) 1183 (backward-char)
1184 (c-backward-token-2) 1184 (c-backward-token-2)
1185 (or (looking-at c-block-stmt-2-key) 1185 (cond
1186 (looking-at c-block-stmt-1-2-key) 1186 ((looking-at c-paren-stmt-key)
1187 (looking-at c-typeof-key)))) 1187 ;; Allow comma separated <> arglists in for statements.
1188 (cons nil t)) 1188 (cons nil nil))
1189 ((or (looking-at c-block-stmt-2-key)
1190 (looking-at c-block-stmt-1-2-key)
1191 (looking-at c-typeof-key))
1192 (cons nil t))
1193 (t nil)))))
1189 ;; Near BOB. 1194 ;; Near BOB.
1190 ((<= match-pos (point-min)) 1195 ((<= match-pos (point-min))
1191 (cons 'arglist t)) 1196 (cons 'arglist t))
@@ -1226,13 +1231,16 @@ casts and declarations are fontified. Used on level 2 and higher."
1226 ;; Got a cached hit in some other type of arglist. 1231 ;; Got a cached hit in some other type of arglist.
1227 (type 1232 (type
1228 (cons 'arglist t)) 1233 (cons 'arglist t))
1229 (not-front-decl 1234 ((and not-front-decl
1230 ;; The point is within the range of a previously 1235 ;; The point is within the range of a previously
1231 ;; encountered type decl expression, so the arglist 1236 ;; encountered type decl expression, so the arglist
1232 ;; is probably one that contains declarations. 1237 ;; is probably one that contains declarations.
1233 ;; However, if `c-recognize-paren-inits' is set it 1238 ;; However, if `c-recognize-paren-inits' is set it
1234 ;; might also be an initializer arglist. 1239 ;; might also be an initializer arglist.
1235 ;; 1240 (or (not c-recognize-paren-inits)
1241 (save-excursion
1242 (goto-char match-pos)
1243 (not (c-back-over-member-initializers)))))
1236 ;; The result of this check is cached with a char 1244 ;; The result of this check is cached with a char
1237 ;; property on the match token, so that we can look 1245 ;; property on the match token, so that we can look
1238 ;; it up again when refontifying single lines in a 1246 ;; it up again when refontifying single lines in a
@@ -1243,17 +1251,21 @@ casts and declarations are fontified. Used on level 2 and higher."
1243 ;; Got an open paren preceded by an arith operator. 1251 ;; Got an open paren preceded by an arith operator.
1244 ((and (eq (char-before match-pos) ?\() 1252 ((and (eq (char-before match-pos) ?\()
1245 (save-excursion 1253 (save-excursion
1254 (goto-char match-pos)
1246 (and (zerop (c-backward-token-2 2)) 1255 (and (zerop (c-backward-token-2 2))
1247 (looking-at c-arithmetic-op-regexp)))) 1256 (looking-at c-arithmetic-op-regexp))))
1248 (cons nil nil)) 1257 (cons nil nil))
1249 ;; In a C++ member initialization list. 1258 ;; In a C++ member initialization list.
1250 ((and (eq (char-before match-pos) ?,) 1259 ((and (eq (char-before match-pos) ?,)
1251 (c-major-mode-is 'c++-mode) 1260 (c-major-mode-is 'c++-mode)
1252 (save-excursion (c-back-over-member-initializers))) 1261 (save-excursion
1262 (goto-char match-pos)
1263 (c-back-over-member-initializers)))
1253 (c-put-char-property (1- match-pos) 'c-type 'c-not-decl) 1264 (c-put-char-property (1- match-pos) 'c-type 'c-not-decl)
1254 (cons 'not-decl nil)) 1265 (cons 'not-decl nil))
1255 ;; At start of a declaration inside a declaration paren. 1266 ;; At start of a declaration inside a declaration paren.
1256 ((save-excursion 1267 ((save-excursion
1268 (goto-char match-pos)
1257 (and (memq (char-before match-pos) '(?\( ?\,)) 1269 (and (memq (char-before match-pos) '(?\( ?\,))
1258 (c-go-up-list-backward match-pos) 1270 (c-go-up-list-backward match-pos)
1259 (eq (char-after) ?\() 1271 (eq (char-after) ?\()
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index bf0439ffe8a..0bf89b9a36a 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1539,6 +1539,21 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
1539 (setq new-pos capture-opener)) 1539 (setq new-pos capture-opener))
1540 (and (/= new-pos pos) new-pos))) 1540 (and (/= new-pos pos) new-pos)))
1541 1541
1542(defun c-fl-decl-end (pos)
1543 ;; If POS is inside a declarator, return the end of the token that follows
1544 ;; the declarator, otherwise return nil.
1545 (goto-char pos)
1546 (let ((lit-start (c-literal-start))
1547 pos1)
1548 (if lit-start (goto-char lit-start))
1549 (c-backward-syntactic-ws)
1550 (when (setq pos1 (c-on-identifier))
1551 (goto-char pos1)
1552 (when (and (c-forward-declarator)
1553 (eq (c-forward-token-2) 0))
1554 (c-backward-syntactic-ws)
1555 (point)))))
1556
1542(defun c-change-expand-fl-region (_beg _end _old-len) 1557(defun c-change-expand-fl-region (_beg _end _old-len)
1543 ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock 1558 ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock
1544 ;; region. This will usually be the smallest sequence of whole lines 1559 ;; region. This will usually be the smallest sequence of whole lines
@@ -1552,18 +1567,16 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".")
1552 (setq c-new-BEG 1567 (setq c-new-BEG
1553 (or (c-fl-decl-start c-new-BEG) (c-point 'bol c-new-BEG)) 1568 (or (c-fl-decl-start c-new-BEG) (c-point 'bol c-new-BEG))
1554 c-new-END 1569 c-new-END
1555 (save-excursion 1570 (or (c-fl-decl-end c-new-END)
1556 (goto-char c-new-END) 1571 (c-point 'bonl (max (1- c-new-END) (point-min)))))))
1557 (if (bolp)
1558 (point)
1559 (c-point 'bonl c-new-END))))))
1560 1572
1561(defun c-context-expand-fl-region (beg end) 1573(defun c-context-expand-fl-region (beg end)
1562 ;; Return a cons (NEW-BEG . NEW-END), where NEW-BEG is the beginning of a 1574 ;; Return a cons (NEW-BEG . NEW-END), where NEW-BEG is the beginning of a
1563 ;; "local" declaration containing BEG (see `c-fl-decl-start') or BOL BEG is 1575 ;; "local" declaration containing BEG (see `c-fl-decl-start') or BOL BEG is
1564 ;; in. NEW-END is beginning of the line after the one END is in. 1576 ;; in. NEW-END is beginning of the line after the one END is in.
1565 (cons (or (c-fl-decl-start beg) (c-point 'bol beg)) 1577 (c-save-buffer-state ()
1566 (c-point 'bonl end))) 1578 (cons (or (c-fl-decl-start beg) (c-point 'bol beg))
1579 (or (c-fl-decl-end end) (c-point 'bonl (1- end))))))
1567 1580
1568(defun c-before-context-fl-expand-region (beg end) 1581(defun c-before-context-fl-expand-region (beg end)
1569 ;; Expand the region (BEG END) as specified by 1582 ;; Expand the region (BEG END) as specified by
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index c0f1aaf39d4..c69eca22413 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -3734,7 +3734,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
3734 "\\(\\`\n?\\|^\n\\)=" ; POD 3734 "\\(\\`\n?\\|^\n\\)=" ; POD
3735 "\\|" 3735 "\\|"
3736 ;; One extra () before this: 3736 ;; One extra () before this:
3737 "<<" ; HERE-DOC 3737 "<<~?" ; HERE-DOC
3738 "\\(" ; 1 + 1 3738 "\\(" ; 1 + 1
3739 ;; First variant "BLAH" or just ``. 3739 ;; First variant "BLAH" or just ``.
3740 "[ \t]*" ; Yes, whitespace is allowed! 3740 "[ \t]*" ; Yes, whitespace is allowed!
@@ -4000,7 +4000,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
4000 (setq b (point)) 4000 (setq b (point))
4001 ;; We do not search to max, since we may be called from 4001 ;; We do not search to max, since we may be called from
4002 ;; some hook of fontification, and max is random 4002 ;; some hook of fontification, and max is random
4003 (or (and (re-search-forward (concat "^" qtag "$") 4003 (or (and (re-search-forward (concat "^[ \t]*" qtag "$")
4004 stop-point 'toend) 4004 stop-point 'toend)
4005 ;;;(eq (following-char) ?\n) ; XXXX WHY??? 4005 ;;;(eq (following-char) ?\n) ; XXXX WHY???
4006 ) 4006 )
diff --git a/lisp/progmodes/ld-script.el b/lisp/progmodes/ld-script.el
index 389ddfca6b1..7a666e95297 100644
--- a/lisp/progmodes/ld-script.el
+++ b/lisp/progmodes/ld-script.el
@@ -85,10 +85,12 @@
85 ;; 3.4.5 Other Linker Script Commands 85 ;; 3.4.5 Other Linker Script Commands
86 "ASSERT" "EXTERN" "FORCE_COMMON_ALLOCATION" 86 "ASSERT" "EXTERN" "FORCE_COMMON_ALLOCATION"
87 "INHIBIT_COMMON_ALLOCATION" "INSERT" "AFTER" "BEFORE" 87 "INHIBIT_COMMON_ALLOCATION" "INSERT" "AFTER" "BEFORE"
88 "NOCROSSREFS" "OUTPUT_ARCH" "LD_FEATURE" 88 "NOCROSSREFS" "NOCROSSREFS_TO" "OUTPUT_ARCH" "LD_FEATURE"
89 ;; 3.5.2 PROVIDE 89 ;; 3.5.2 HIDDEN
90 "HIDDEN"
91 ;; 3.5.3 PROVIDE
90 "PROVIDE" 92 "PROVIDE"
91 ;; 3.5.3 PROVIDE_HIDDEN 93 ;; 3.5.4 PROVIDE_HIDDEN
92 "PROVIDE_HIDDEN" 94 "PROVIDE_HIDDEN"
93 ;; 3.6 SECTIONS Command 95 ;; 3.6 SECTIONS Command
94 "SECTIONS" 96 "SECTIONS"
@@ -142,6 +144,7 @@
142 "DEFINED" 144 "DEFINED"
143 "LENGTH" "len" "l" 145 "LENGTH" "len" "l"
144 "LOADADDR" 146 "LOADADDR"
147 "LOG2CEIL"
145 "MAX" 148 "MAX"
146 "MIN" 149 "MIN"
147 "NEXT" 150 "NEXT"
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 3def37a2ea8..6197a53ee66 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -213,25 +213,6 @@
213 (regexp-opt perl--syntax-exp-intro-keywords) 213 (regexp-opt perl--syntax-exp-intro-keywords)
214 "\\|[-?:.,;|&+*=!~({[]\\|\\(^\\)\\)[ \t\n]*"))) 214 "\\|[-?:.,;|&+*=!~({[]\\|\\(^\\)\\)[ \t\n]*")))
215 215
216;; FIXME: handle here-docs and regexps.
217;; <<EOF <<"EOF" <<'EOF' (no space)
218;; see `man perlop'
219;; ?...?
220;; /.../
221;; m [...]
222;; m /.../
223;; q /.../ = '...'
224;; qq /.../ = "..."
225;; qx /.../ = `...`
226;; qr /.../ = precompiled regexp =~=~ m/.../
227;; qw /.../
228;; s /.../.../
229;; s <...> /.../
230;; s '...'...'
231;; tr /.../.../
232;; y /.../.../
233;;
234;; <file*glob>
235(defun perl-syntax-propertize-function (start end) 216(defun perl-syntax-propertize-function (start end)
236 (let ((case-fold-search nil)) 217 (let ((case-fold-search nil))
237 (goto-char start) 218 (goto-char start)
@@ -324,23 +305,25 @@
324 ((concat 305 ((concat
325 "\\(?:" 306 "\\(?:"
326 ;; << "EOF", << 'EOF', or << \EOF 307 ;; << "EOF", << 'EOF', or << \EOF
327 "<<[ \t]*\\('[^'\n]*'\\|\"[^\"\n]*\"\\|\\\\[[:alpha:]][[:alnum:]]*\\)" 308 "<<\\(~\\)?[ \t]*\\('[^'\n]*'\\|\"[^\"\n]*\"\\|\\\\[[:alpha:]][[:alnum:]]*\\)"
328 ;; The <<EOF case which needs perl--syntax-exp-intro-regexp, to 309 ;; The <<EOF case which needs perl--syntax-exp-intro-regexp, to
329 ;; disambiguate with the left-bitshift operator. 310 ;; disambiguate with the left-bitshift operator.
330 "\\|" perl--syntax-exp-intro-regexp "<<\\(?1:\\sw+\\)\\)" 311 "\\|" perl--syntax-exp-intro-regexp "<<\\(?2:\\sw+\\)\\)"
331 ".*\\(\n\\)") 312 ".*\\(\n\\)")
332 (3 (let* ((st (get-text-property (match-beginning 3) 'syntax-table)) 313 (4 (let* ((st (get-text-property (match-beginning 4) 'syntax-table))
333 (name (match-string 1))) 314 (name (match-string 2))
334 (goto-char (match-end 1)) 315 (indented (match-beginning 1)))
316 (goto-char (match-end 2))
335 (if (save-excursion (nth 8 (syntax-ppss (match-beginning 0)))) 317 (if (save-excursion (nth 8 (syntax-ppss (match-beginning 0))))
336 ;; Leave the property of the newline unchanged. 318 ;; Leave the property of the newline unchanged.
337 st 319 st
338 (cons (car (string-to-syntax "< c")) 320 (cons (car (string-to-syntax "< c"))
339 ;; Remember the names of heredocs found on this line. 321 ;; Remember the names of heredocs found on this line.
340 (cons (pcase (aref name 0) 322 (cons (cons (pcase (aref name 0)
341 (`?\\ (substring name 1)) 323 (`?\\ (substring name 1))
342 ((or `?\" `?\' `?\`) (substring name 1 -1)) 324 ((or `?\" `?\' `?\`) (substring name 1 -1))
343 (_ name)) 325 (_ name))
326 indented)
344 (cdr st))))))) 327 (cdr st)))))))
345 ;; We don't call perl-syntax-propertize-special-constructs directly 328 ;; We don't call perl-syntax-propertize-special-constructs directly
346 ;; from the << rule, because there might be other elements (between 329 ;; from the << rule, because there might be other elements (between
@@ -383,7 +366,9 @@
383 (goto-char (nth 8 state))) 366 (goto-char (nth 8 state)))
384 (while (and names 367 (while (and names
385 (re-search-forward 368 (re-search-forward
386 (concat "^" (regexp-quote (pop names)) "\n") 369 (pcase-let ((`(,name . ,indented) (pop names)))
370 (concat "^" (if indented "[ \t]*")
371 (regexp-quote name) "\n"))
387 limit 'move)) 372 limit 'move))
388 (unless names 373 (unless names
389 (put-text-property (1- (point)) (point) 'syntax-table 374 (put-text-property (1- (point)) (point) 'syntax-table
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 35b555e6879..23e79f6ac59 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1683,6 +1683,7 @@ with your script for an edit-interpret-debug cycle."
1683 ((string-match "[.]sh\\>" buffer-file-name) "sh") 1683 ((string-match "[.]sh\\>" buffer-file-name) "sh")
1684 ((string-match "[.]bash\\>" buffer-file-name) "bash") 1684 ((string-match "[.]bash\\>" buffer-file-name) "bash")
1685 ((string-match "[.]ksh\\>" buffer-file-name) "ksh") 1685 ((string-match "[.]ksh\\>" buffer-file-name) "ksh")
1686 ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh")
1686 ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh") 1687 ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh")
1687 ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh") 1688 ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh")
1688 ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh") 1689 ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")