Function: web-mode-attribute-end-position

web-mode-attribute-end-position is a natively compiled function defined in web-mode.el.

Signature

(web-mode-attribute-end-position &optional POS)

Source Code

;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
;; TODO: retoucher en incluant un param limit et en s'inspirant de
;;       web-mode-attribute-next-position
(defun web-mode-attribute-end-position (&optional pos)
  (unless pos (setq pos (point)))
  (let (beg end depth flags)
    ;;(message "pos=%S" pos)
    (setq depth (get-text-property pos 'jsx-depth))
    (cond
      ((null pos)
       (setq end nil))
      ((get-text-property pos 'tag-attr-end)
       (setq end pos))
      ((get-text-property pos 'tag-attr)
       (setq end (next-single-property-change pos 'tag-attr-end))
       (when (and depth
                  end
                  (setq beg (web-mode-attribute-beginning-position end))
                  (setq flags (get-text-property pos 'tag-attr-beg))
                  (eq (logand flags 4) 4))
         (setq depth (1- (get-text-property beg 'jsx-depth)))
         ;;(message "%S %S" beg end)
         )
       (cond
         ((not (get-text-property end 'tag-attr-end))
          (setq end nil))
         ((and depth
               (eq depth (get-text-property end 'jsx-depth))
               (not (eq depth (get-text-property end 'jsx-end))))
          )
         ((and depth (eq (1+ depth) (get-text-property end 'jsx-depth)))
          )
         ((and depth (not (eq (1+ depth) (get-text-property end 'jsx-depth))))
          (let ((continue (< end (point-max))))
            (while continue
              (setq end (1+ end))
              (setq end (next-single-property-change end 'tag-attr-end))
              (cond
                ((null end)
                 (setq continue nil))
                ((not (get-text-property end 'tag-attr-end))
                 (setq continue nil
                       end nil))
                ((eq (1+ depth) (get-text-property end 'jsx-depth))
                 (setq continue nil))
                ) ;cond
              ) ;while
            ) ;let
          )
         ) ;cond
       )
      (t
       (setq end nil))
      ) ;cond
    end))