Function: web-mode-css-rule-next

web-mode-css-rule-next is a natively compiled function defined in web-mode.el.

Signature

(web-mode-css-rule-next LIMIT)

Source Code

;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
;; css rule = selector(s) + declaration (properties)
(defun web-mode-css-rule-next (limit)
  (let (at-rule var-rule sel-beg sel-end dec-beg dec-end chunk)
    (skip-chars-forward "\n\t ")
    (setq sel-beg (point))
    (when (and (< (point) limit)
               (web-mode-part-rsf "[{;]" limit))
      (setq sel-end (1- (point)))
      (cond
        ((eq (char-before) ?\{)
         (setq dec-beg (point))
         (setq dec-end (web-mode-closing-paren-position (1- dec-beg) limit))
         (if dec-end
             (progn
               (goto-char dec-end)
               (forward-char))
             (setq dec-end limit)
             (goto-char limit))
         )
        (t
         )
        ) ;cond
      (setq chunk (buffer-substring-no-properties sel-beg sel-end))
      (cond
        ((string-match "@\\([[:alpha:]-]+\\)" chunk)
         (setq at-rule (match-string-no-properties 1 chunk)))
        ((string-match "\\$\\([[:alpha:]-]+\\)" chunk)
         (setq var-rule (match-string-no-properties 1 chunk)))
        ) ;cond
      ) ;when
    (if (not sel-end)
        (progn (goto-char limit) nil)
        (list :at-rule at-rule
              :var-rule var-rule
              :sel-beg sel-beg
              :sel-end sel-end
              :dec-beg dec-beg
              :dec-end dec-end)
        ) ;if
    ))