Function: nnir-imap-next-symbol
nnir-imap-next-symbol is a byte-compiled function defined in
nnir.el.gz.
Signature
(nnir-imap-next-symbol &optional COUNT)
Documentation
Return the next (COUNT) symbol from the current buffer.
Return 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/obsolete/nnir.el.gz
(defun nnir-imap-next-symbol (&optional count)
"Return the next (COUNT) symbol from the current buffer.
Return 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))
(nnir-imap-next-symbol (1- count)))
(let ((case-fold-search t))
;; end of input stream?
(unless (nnir-imap-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)
;; quoted string
((looking-at "\"") (nnir-imap-delimited-string "\""))
;; list expression -- we parse the content and return this as a list.
((looking-at "(")
(nnir-imap-parse-query (nnir-imap-delimited-string ")")))
;; 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)
;; Simple, boring keyword
(t (let ((start (point))
(end (if (search-forward-regexp "[[:blank:]]" nil t)
(prog1
(match-beginning 0)
;; unskip if we hit a non-blank terminal character.
(when (string-match "[^[:blank:]]" (match-string 0))
(backward-char 1)))
(goto-char (point-max)))))
(buffer-substring start end)))))))