Function: bazel--find-target-name

bazel--find-target-name is a natively compiled function defined in bazel.el.

Signature

(bazel--find-target-name BOUND)

Documentation

Search for a target name from point to BOUND.

If a target name was found, return non-nil and set the match to the match text. The second match group matches the name.

Source Code

;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazel--find-target-name (bound)
  "Search for a target name from point to BOUND.
If a target name was found, return non-nil and set the match to
the match text.  The second match group matches the name."
  (declare (ftype (function (integer) t)))
  (cl-check-type bound natnum)
  (let ((case-fold-search nil)
        (search-spaces-regexp nil))
    (and (re-search-forward
          (rx symbol-start "name" (* blank) ?= (* blank)
              (group (any ?\" ?'))
              (group (+ (any "a-z" "A-Z" "0-9" ?-
                             "!%@^_` #$&()*+,;<=>?[]{|}~/.")))
              ;; Don’t look for dynamic target names such as "foo" + SUFFIX;
              ;; only fontifying the "foo" part would be confusing.
              (backref 1) (* blank) (any ?, ?\)))
          bound t)
         (let ((syntax (syntax-ppss (match-beginning 0))))
           (and (> (ppss-depth syntax) 0)
                (null (ppss-comment-or-string-start syntax)))))))