Function: combobulate-query--term-type

combobulate-query--term-type is a natively compiled function defined in combobulate-navigation.el.

Signature

(combobulate-query--term-type TERM)

Documentation

Return a symbol indicating the type of TERM.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-navigation.el
(defun combobulate-query--term-type (term)
  "Return a symbol indicating the type of TERM."
  ;; (when (and (not (atom term)) (> (length term) 1))
  ;;   (princ "Term `%s' must be a length of one." term))
  (let ((type (pcase term
                ((or '* '? '+ '!)
                 'quantifier)
                ((and (pred (symbolp)) v (guard (string-prefix-p "@" (symbol-name v))))
                 'node-label)
                ((and (pred (symbolp)) v (guard (string-prefix-p "*" (symbol-name v))))
                 'type-label)
                ((and (pred (symbolp)) v (guard (string-prefix-p "!" (symbol-name v))))
                 'text-label)
                ((and (pred symbolp)
                      v (guard (string-suffix-p ":" (symbol-name v))))
                 'field)
                ('_ 'wildcard)
                ('(_) 'named-wildcard)
                ((pred stringp) 'anonymous)
                ;; I mean.. c'mon. The way to do this properly is to
                ;; pass in the state machine's state and then mark
                ;; anything a sibling query if it is not in the first
                ;; position of the whole query?
                ((and (pred consp)
                      `(,first . ,_)
                      (guard (or (consp first)
                                 (stringp first)))
                      ;; (guard (not (member first '(_ (_)))))
                      )
                 'sibling-query)
                ((pred consp) 'sub-query)
                ((pred symbolp) 'node)
                ;; (nil 'invalid)
                (_ 'invalid))))
    type))