Variable: js-jsx--tag-start-re

js-jsx--tag-start-re is a variable defined in js.el.gz.

Value

"\\([[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\(?:\\.[[:alpha:]_$]\\(?:\\s_\\|\\sw\\)*\\)*\\)\\(?:\\(?:\\s-\\|\n\\)*[{/>]\\|\\(?:\\s-\\|\n\\)+[[:alpha:]_$]\\)"

Documentation

Regexp unambiguously matching a JSXOpeningElement.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
;; When applying syntax properties, since `js-syntax-propertize' uses
;; `syntax-propertize-rules' to parse JSXBoundaryElements iteratively
;; and statelessly, whenever we exit such an element, we need to
;; determine the JSX depth.  If >0, then we know to apply syntax
;; properties to JSXText up until the next JSXBoundaryElement occurs.
;; But if the JSX depth is 0, then—importantly—we know to NOT parse
;; the following code as JSXText, rather propertize it as regular JS
;; as long as warranted.
;;
;; Also, when indenting code, we need to know if the code we’re trying
;; to indent is on the 2nd or later line of multiline JSX, in which
;; case the code is indented according to XML-like JSX conventions.
;;
;; For the aforementioned reasons, we find ourselves needing to
;; determine whether point is enclosed in JSX or not; and, if so,
;; where the JSX is.  The following functions provide that knowledge.

(defconst js-jsx--tag-start-re
  (concat "\\(" js--dotted-name-re "\\)\\(?:"
          ;; Whitespace is only necessary if an attribute implies JSX.
          "\\(?:\\s-\\|\n\\)*[{/>]"
          "\\|"
          "\\(?:\\s-\\|\n\\)+" js--name-start-re
          "\\)")
  "Regexp unambiguously matching a JSXOpeningElement.")