objc-mode: Fix exceptions in fontification.

These exceptions ("Invalid search bound (wrong side of point)")
were observed in test suite file class-24.m when moving point
up and down a line at a time.

* lisp/progmodes/cc-engine.el (c-forward-declarator): In the
c-syntactic-re-search-forward ~30 lines from the end of the
function amend the regexp for objc-mode such that "@end"
terminates the search, but "<" doesn't.

* lisp/progmodes/cc-fonts.el
(c-make-font-lock-search-function): supply a non-nil
CHECK-POINT argument to c-make-font-lock-search-form.
This commit is contained in:
Alan Mackenzie 2023-07-04 12:43:31 +00:00
parent ec89acba5f
commit 793a416653
2 changed files with 6 additions and 2 deletions

View file

@ -10219,7 +10219,11 @@ point unchanged and return nil."
(prog1
(setq found
(c-syntactic-re-search-forward
"[;:,]\\|\\(=\\|\\s(\\)"
;; Consider making the next regexp a
;; c-lang-defvar (2023-07-04).
(if (c-major-mode-is 'objc-mode)
"\\(?:@end\\)\\|[;:,]\\|\\(=\\|[[(]\\)"
"[;:,]\\|\\(=\\|\\s(\\)")
limit 'limit t))
(setq got-init
(and found (match-beginning 1))))

View file

@ -387,7 +387,7 @@
(parse-sexp-lookup-properties
(cc-eval-when-compile
(boundp 'parse-sexp-lookup-properties))))
,(c-make-font-lock-search-form regexp highlights))
,(c-make-font-lock-search-form regexp highlights t))
nil)))
(defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights)