Function: js-jsx--syntax-propertize-extend-region
js-jsx--syntax-propertize-extend-region is a byte-compiled function
defined in js.el.gz.
Signature
(js-jsx--syntax-propertize-extend-region START END)
Documentation
Extend the START-END region for propertization, if necessary.
If any “>” in the region appears to be the end of a tag starting
before the start of the region, extend region backwards to the
start of that tag so parsing may proceed from that point.
For use by syntax-propertize-extend-region-functions.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js-jsx--syntax-propertize-extend-region (start end)
"Extend the START-END region for propertization, if necessary.
If any “>” in the region appears to be the end of a tag starting
before the start of the region, extend region backwards to the
start of that tag so parsing may proceed from that point.
For use by `syntax-propertize-extend-region-functions'."
(let (new-start
forward-sexp-function ; Use the Lisp version.
parse-sexp-lookup-properties) ; Fix backward-sexp error here.
(catch 'stop
(goto-char start)
(while (re-search-forward ">" end t)
(catch 'continue
;; Check if this is really a right shift bitwise operator
;; (“>>” or “>>>”).
(unless (or (eq (char-before (1- (point))) ?>)
(eq (char-after) ?>))
(save-excursion
(backward-char)
(while (progn (if (= (point) (point-min)) (throw 'continue nil))
(/= (char-before) ?<))
(skip-chars-backward " \t\n")
(if (= (point) (point-min)) (throw 'continue nil))
(cond
((memq (char-before) '(?\" ?\' ?\` ?\}))
(condition-case nil
(backward-sexp)
(scan-error (throw 'continue nil))))
((memq (char-before) '(?\/ ?\=)) (backward-char))
((looking-back js--dotted-name-re (line-beginning-position) t)
(goto-char (match-beginning 0)))
(t (throw 'continue nil))))
(when (< (point) start)
(setq new-start (1- (point)))
(throw 'stop nil)))))))
(if new-start (cons new-start end))))