Function: gnus-search-query-next-symbol

gnus-search-query-next-symbol is a byte-compiled function defined in gnus-search.el.gz.

Signature

(gnus-search-query-next-symbol &optional COUNT)

Documentation

Return the next symbol from the current buffer, or nil if we are at the end of the buffer. If supplied COUNT skips some symbols before returning the one at the supplied position.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-search.el.gz
(defun gnus-search-query-next-symbol (&optional count)
  "Return the next symbol from the current buffer, or nil if we are
at the end of the buffer.  If supplied COUNT skips some symbols before
returning the one at the supplied position."
  (when (and (numberp count) (> count 1))
    (gnus-search-query-next-symbol (1- count)))
  (let ((case-fold-search t))
    ;; end of input stream?
    (unless (gnus-search-query-end-of-input)
      ;; No, return the next symbol from the stream.
      (cond
       ;; Negated expression -- return it and advance one char.
       ((looking-at "-") (forward-char 1) 'not)
       ;; List expression -- we parse the content and return this as a list.
       ((looking-at "(")
	(gnus-search-parse-query (gnus-search-query-return-string ")" t)))
       ;; Keyword input -- return a symbol version.
       ((looking-at "\\band\\b") (forward-char 3) 'and)
       ((looking-at "\\bor\\b")  (forward-char 2) 'or)
       ((looking-at "\\bnot\\b") (forward-char 3) 'not)
       ((looking-at "\\bnear\\b") (forward-char 4) 'near)
       ;; Plain string, no keyword
       ((looking-at "[\"/]?\\b[^:]+\\([[:blank:]]\\|\\'\\)")
	(gnus-search-query-return-string
	 (when (looking-at-p "[\"/]") t)))
       ;; Assume a K:V expression.
       (t (let ((key (gnus-search-query-expand-key
		      (buffer-substring
		       (point)
		       (progn
			 (re-search-forward ":" (point-at-eol) t)
			 (1- (point))))))
		(value (gnus-search-query-return-string
			(when (looking-at-p "[\"/]") t))))
	    (gnus-search-query-parse-kv key value)))))))