Function: c-in-requires-or-at-end-of-clause
c-in-requires-or-at-end-of-clause is a byte-compiled function defined
in cc-engine.el.gz.
Signature
(c-in-requires-or-at-end-of-clause &optional POS)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
(defun c-in-requires-or-at-end-of-clause (&optional pos)
;; Is POS (default POINT) in a C++ "requires" expression or "requires"
;; clause or at the end of a "requires" clause? If so return a cons
;; (POSITION . END) where POSITION is that of the "requires" keyword, and
;; END is `expression' if POS is in an expression, nil if it's in a clause
;; or t if it's at the end of a clause. "End of a clause" means just after
;; the non syntactic WS on the line where the clause ends.
;;
;; Note we can't use `c-beginning-of-statement-1' in this function because
;; of this function's use in `c-at-vsemi-p' for C++ Mode.
(save-excursion
(if pos (goto-char pos) (setq pos (point)))
(let ((limit (max (- (point) 2000) (point-min)))
found-req req-pos found-clause res pe-start pe-end
)
(while ; Loop around syntactically significant "requires" keywords.
(progn
(while
(and
(setq found-req (re-search-backward
c-fun-name-substitute-key
limit t)) ; Fast!
(or (not (setq found-req
(not (eq (char-after (match-end 0)) ?_))))
(not (setq found-req (not (c-in-literal))))))) ; Slow!
(setq req-pos (point))
(cond
((not found-req) ; No "requires" found
nil)
((save-excursion ; A primary expression `pos' is in
(setq pe-end nil)
(while (and (setq pe-start (point))
(< (point) pos)
(c-forward-primary-expression nil t)
(setq pe-end (point))
(progn (c-forward-syntactic-ws)
(looking-at "&&\\|||"))
(c-forward-over-token-and-ws)))
pe-end)
(if (<= pe-end pos)
t ; POS is not in a primary expression.
(setq res (cons pe-start 'expression))
nil))
((progn
(goto-char req-pos)
(if (looking-at c-requires-clause-key)
(setq found-clause (c-forward-c++-requires-clause nil t))
(and (c-forward-concept-fragment)
(setq found-clause (point))))
nil))
((and found-clause (>= (point) pos))
(setq res (cons req-pos (eq (point) pos)))
nil)
(found-clause ; We found a constraint clause, but it did not
; extend far enough forward to reach POS.
(c-go-up-list-backward req-pos limit))
(t (goto-char req-pos)
t))))
res)))