• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/progmodes/

Lines Matching +defs:simple +defs:skip +defs:symbol +defs:backward

94 ;;   Used by `c-forward-syntactic-ws' and `c-backward-syntactic-ws' to
356 (skip-chars-backward " \t")
359 (backward-char)
379 ;; precisely, the value is the symbol for the keyword in
384 ;; Return non-nil if the symbol KEYWORD-SYM, as returned by
390 ;; String syntax chars, suitable for skip-syntax-(forward|backward).
712 ;; Try to skip back over unary operator characters, to register
716 (c-backward-syntactic-ws)
719 (/= (skip-chars-backward "-+!*&~@`#") 0))))
728 (c-backward-syntactic-ws)
744 ;; etc. with contents, or symbol or suchlike) each iteration. This
752 (progn (skip-chars-backward " \t")
758 (progn (skip-chars-forward " \t")
897 ;; c-(backward|forward)-sws.
898 (c-backward-syntactic-ws)
911 (unless (c-safe (c-backward-sexp) t)
952 (goto-char (1+ (c-down-list-backward
961 ;; Passed a symbol sexp or line
1000 (and (c-safe (c-backward-sexp) t)
1068 (c-backward-syntactic-ws)
1071 (/= (skip-chars-backward "-+!*&~@`#") 0)))
1092 (let ((skip-chars c-stmt-delim-chars)
1097 (while (progn (skip-chars-forward skip-chars to)
1113 skip-chars (substring c-stmt-delim-chars 0 -2)))
1116 (backward-char))
1117 (skip-chars-backward " \t" from)
1123 (c-backward-syntactic-ws from)
1143 (c-syntactic-skip-backward (substring c-stmt-delim-chars 1) nil t)
1148 (progn (backward-char)
1172 (c-syntactic-skip-backward (substring c-stmt-delim-chars 1) nil t)
1175 (save-excursion (backward-char)
1241 (defun c-backward-single-comment ()
1242 "Move backward past whitespace and the closest preceding comment, if any.
1258 (skip-chars-backward " \t\n\r\f\v")
1261 (backward-char))
1270 ;; backward over a line comment if point is at the end of the
1288 (defsubst c-backward-comments ()
1289 "Move backward past all preceding whitespace and comments.
1294 c-backward-syntactic-ws, this function doesn't move back over
1314 ;; only in the backward direction, which seems a bit
1319 (backward-char)
1329 ;; o If a syntactic whitespace region contains anything but simple
1340 ;; o The `c-is-sws' property is put on the simple whitespace chars at
1347 ;; Note that some part of the beginning of a sequence of simple
1366 ;; a later call to `c-forward-sws' or `c-backward-sws' will use the
1466 ;; `c-forward-sws' or `c-backward-sws' are used outside
1473 ;; Adjust the end to remove the properties in any following simple
1478 ;; keep the rung mark which could make a later `c-backward-sws'
1481 (skip-chars-forward " \t\f\v")
1511 ;; unmarked part of the simple ws region.
1513 rung-is-marked next-rung-is-marked simple-ws-end
1518 ;; cache in the majority of cases, but otoh is `c-backward-sws' by far
1522 ;; Skip simple ws and do a quick check on the following character to see
1525 (skip-chars-forward " \t\n\r\f\v")
1537 ;; Got no marked rung here. Since the simple ws might have started
1558 (backward-char))
1565 (and (> (skip-chars-forward " \t\n\r\f\v") 0)
1568 ;; We'll loop here if there is simple ws after the last rung.
1587 (setq simple-ws-end (point))
1591 ((/= (point) simple-ws-end)
1599 (progn (skip-chars-backward " \t")
1602 (progn (backward-char)
1617 (skip-chars-forward " \t\n\r\f\v")
1626 (not (get-text-property simple-ws-end 'c-in-sws))))
1628 ;; See if there's a marked rung in the encountered simple ws. If
1640 rung-pos (1+ simple-ws-end) next-rung-pos rung-end-pos
1646 (c-remove-is-sws (1+ simple-ws-end) next-rung-pos)
1647 (unless (and rung-is-marked (= rung-pos simple-ws-end))
1649 (1+ simple-ws-end))
1664 rung-pos (1+ simple-ws-end) next-rung-pos rung-end-pos
1699 (defun c-backward-sws ()
1700 ;; Used by `c-backward-syntactic-ws' to implement the unbounded search.
1705 ;; part of the simple ws region.
1707 rung-is-marked simple-ws-beg cmt-skip-pos)
1709 ;; Skip simple horizontal ws and do a quick check on the preceding
1712 ;; chars. Newlines are complicated in the backward direction, so we can't
1713 ;; skip over them.
1714 (skip-chars-backward " \t\f")
1717 (backward-char)
1720 ;; Try to find a rung position in the simple ws preceding point, so that
1721 ;; we can get a cache hit even if the last bit of the simple ws has
1723 (setq simple-ws-beg (point))
1724 (skip-chars-backward " \t\n\r\f\v")
1729 ;; there might be later unmarked parts in the simple ws region.
1731 ;; simple ws is also typically edited often, so it could be wasted.
1733 (goto-char simple-ws-beg))
1753 "c-backward-sws cached move %s <- %s (min %s)"
1757 (if (and (< (min (skip-chars-backward " \t\f\v")
1759 (setq simple-ws-beg (point))
1760 (skip-chars-backward " \t\n\r\f\v")))
1766 (goto-char simple-ws-beg)
1769 ;; We'll loop here if there is simple ws before the first rung.
1775 "c-backward-sws extending rung with [%s..%s] (min %s)"
1789 (c-backward-comments)
1790 (setq cmt-skip-pos (point))
1794 (/= cmt-skip-pos simple-ws-beg)
1800 ;; over by `c-backward-comments'. If we go past it then we
1802 (goto-char simple-ws-beg)
1804 (while (and (> (point) cmt-skip-pos)
1805 (progn (backward-char)
1809 (if (< (point) cmt-skip-pos)
1813 (progn (goto-char cmt-skip-pos)
1817 ;; the end of the macro, to get a good `simple-ws-beg'
1818 ;; position for the cache. Note that `c-backward-comments'
1820 ;; the macro, and then `simple-ws-beg' must be kept on the
1822 (goto-char simple-ws-beg)
1823 (skip-chars-backward " \t\n\r\f\v")
1827 (if (< (point) simple-ws-beg)
1830 (setq simple-ws-beg (point)))
1836 (skip-chars-forward " \t\n\r\f\v" simple-ws-beg)
1838 simple-ws-beg)
1840 ;; the simple ws at point since we might be after a line
1842 ;; narrowed out, and we can't risk marking the simple ws
1850 (skip-chars-backward " \t\f\v")
1856 (not (get-text-property (1- simple-ws-beg) 'c-in-sws))
1858 ;; Cache if there's a marked rung in the encountered simple ws.
1860 (skip-chars-backward " \t\n\r\f\v")
1866 "c-backward-sws caching [%s..%s] - [%s..%s] (min %s)"
1868 simple-ws-beg (min (1+ rung-pos) (point-max))
1874 (c-remove-is-sws (1+ next-rung-pos) simple-ws-beg)
1875 (unless (and rung-is-marked (= simple-ws-beg rung-pos))
1882 (c-put-is-sws simple-ws-beg
1885 (c-put-in-sws (setq simple-ws-beg (point)
1886 last-put-in-sws-pos simple-ws-beg)
1888 (c-put-is-sws (setq rung-pos simple-ws-beg)
1892 "c-backward-sws not caching [%s..%s] - [%s..%s] (min %s)"
1894 simple-ws-beg (min (1+ rung-pos) (point-max))
1897 simple-ws-beg (point))
1906 "c-backward-sws clearing at %s for cache separation"
1916 "c-backward-sws clearing thoroughly at %s for cache separation"
1937 (c-skip-ws-forward end)
1940 (c-skip-ws-forward end+1)
2069 ;; If point-min has moved backward then we drop the state
2122 ;; search in the backward direction since the point might be in
2252 ;; scan backward for the start paren and then start over.
2254 (setq pos (c-up-list-backward pos)
2277 (fset 'c-real-parse-state (symbol-function 'c-parse-state)))
2302 (fset 'c-parse-state (symbol-function (if c-debug-parse-state
2462 (skip-syntax-backward "w_")
2467 (and (looking-at c-symbol-start)
2474 (skip-chars-backward "-!%&*+/<=>^|~[]()")
2475 (and (if (< (skip-chars-backward "`") 0)
2479 (looking-at c-symbol-key)
2485 (= (c-backward-token-2 0) 0))
2489 (and (= (c-backward-token-2 1) 0)
2502 (defsubst c-simple-skip-symbol-backward ()
2503 ;; If the point is at the end of a symbol then skip backward to the
2508 (or (< (skip-syntax-backward "w_") 0)
2512 (if (and (< (skip-chars-backward "-!%&*+/<=>^|~[]()") 0)
2513 (< (skip-chars-backward "`") 0)
2514 (looking-at c-symbol-key)
2523 ;; backward search; if given it's assumed to be at the boundary
2530 (skip-syntax-backward "w_" back-limit)
2531 (when (< (skip-syntax-backward ".()" back-limit) 0)
2535 ;; since we've skipped backward over punctuator
2546 ;; middle of one. BACK-LIMIT may be used to bound the backward
2552 (cond ((< (skip-syntax-backward "w_" (1- start)) 0)
2553 (skip-syntax-forward "w_"))
2554 ((< (skip-syntax-backward ".()" back-limit) 0)
2559 ;; we've skipped backward over punctuator or paren
2603 (- (c-backward-token-2 (- count) balanced limit))
2666 (defun c-backward-token-2 (&optional count balanced limit)
2667 "Move backward by tokens.
2681 ;; The count is zero so try to skip to the beginning of the
2690 ;; whitespace after the point then we must move backward,
2703 (progn (backward-char)
2708 ;; limits in `backward-char', `scan-sexps' and `goto-char' below.
2713 (c-backward-syntactic-ws)
2714 (backward-char)
2733 tokens like \"==\" as single tokens, i.e. all sequences of symbol
2739 (defun c-backward-token-1 (&optional count balanced limit)
2740 "Like `c-backward-token-2' but doesn't treat multicharacter operator
2741 tokens like \"==\" as single tokens, i.e. all sequences of symbol
2743 for compatibility only; it's only a wrapper over `c-backward-token-2'."
2745 (c-backward-token-2 count balanced limit)))
2841 ;; parentheses), then we can never skip more than a
2851 ;; `re-search-forward' instead of `skip-chars-forward' to get
2976 (defun c-syntactic-skip-backward (skip-chars &optional limit paren-level)
2977 "Like `skip-chars-backward' but only look at syntactically relevant chars,
3012 (< (skip-chars-backward skip-chars limit) 0)
3125 ;; end of a comment if `skip-chars' is something like "^/".
3126 (c-backward-syntactic-ws)
3134 ;; `c-syntactic-skip-backward' that uses backward movement to keep
3140 ;; ;; The regexp matching chars `c-syntactic-skip-backward' needs to
3162 ;;(defun c-syntactic-skip-backward (skip-chars &optional limit paren-level)
3163 ;; "Like `skip-chars-backward' but only look at syntactically relevant chars,
3168 ;;If LIMIT is given, it limits the backward search and the point will be
3189 ;; (skip-chars-backward skip-chars)
3193 ;; ;; `skip-chars-backward' above, but keep to
3197 ;; ;; `re-search-backward' with a single char regexp
3199 ;; (re-search-backward
3216 ;; (c-backward-sexp)
3226 ;; (c-backward-syntactic-ws)
3229 ;; (backward-char)))))
3238 ;; ;; at the end of a comment if `skip-chars' is
3240 ;; (c-backward-syntactic-ws)
3257 Optional LIM is used as the backward limit of the search. If omitted,
3363 (backward-char 1)
3370 (skip-chars-forward " \t")
3381 ;; Search backward.
3382 (skip-chars-backward " \t")
3387 (< (skip-syntax-backward c-string-syntax) 0)) ; String.
3388 (setq beg (c-safe (c-backward-sexp 1) (point))))
3396 (c-backward-single-comment)
3426 ;; Got to take care in the backward direction to handle
3428 (while (and (c-backward-single-comment)
3435 (while (and (progn (skip-chars-forward " \t")
3574 (c-backward-syntactic-ws)
3587 ;; Skip forward past comments only so we don't skip macros.
3706 (progn (backward-char)
3747 (progn (backward-char)
3772 (c-backward-syntactic-ws c-find-decl-syntactic-pos))
3796 (backward-char)
3822 (c-backward-comments)
3823 (backward-char)
3836 ;; search will simply skip to the beginning of it right
3850 ;; skip it entirely. (This won't skip past a string, but
3919 ;; only to skip comments and not macros, since they
4048 (setq type-list (cons (symbol-name type)
4110 (< (skip-chars-backward "<>") 0))
4117 (while (progn (skip-chars-forward "^<>" beg)
4125 (< (skip-chars-backward "<>") 0))
4132 (while (progn (skip-chars-forward "^<>" end)
4200 ;; single identifier symbol stepped over by `c-forward-name' if it's
4203 ;; such symbol in the name.
4329 (while (c-syntactic-re-search-forward c-symbol-start pos t)
4332 (looking-at c-symbol-key) ; Always matches.
4346 (not (looking-at c-symbol-start))
4437 ;; bracket arglist before, so skip to the end.
4547 (backward-char)
4555 (c-backward-syntactic-ws)
4557 (c-simple-skip-symbol-backward)
4609 (defun c-backward-<>-arglist (all-types &optional limit)
4617 ;; If the optional LIMIT is given, it bounds the backward search.
4624 (backward-char)
4628 (if (and (c-go-up-list-backward)
4636 (c-syntactic-skip-backward "^<;{}" limit t)
4653 (backward-char)
4678 ;; could be something as simple as "foo" in C or something as
4707 ;; Check for keyword. We go to the last symbol in
4710 (c-simple-skip-symbol-backward)
4724 (c-backward-syntactic-ws)
4725 (and (c-safe (backward-char 2) t)
4779 ;; an identifier that doesn't end with a symbol token.
4850 ;; Note that this function doesn't skip past the brace definition
5065 (defmacro c-fdoc-shift-type-backward (&optional short)
5152 ;; CONTEXT is a symbol that describes the context at the point:
5324 ;; If a known type was found, we still need to skip over any
5350 (c-backward-syntactic-ws)
5353 (c-simple-skip-symbol-backward)
5358 (< (skip-chars-backward ":~ \t\n\r\v\f") 0))
5361 (c-simple-skip-symbol-backward))
5486 (c-fdoc-shift-type-backward)
5499 (c-fdoc-shift-type-backward))
5508 ;; expression. Try to skip out to the same paren depth to
5546 ;; type one step backward.
5547 (c-fdoc-shift-type-backward)))
5628 ;; "backtracking" code, do not shift backward if we're not
5635 (c-fdoc-shift-type-backward)
5673 ;; Shift the type backward in the case that there's a
5679 (progn (c-fdoc-shift-type-backward) t)
5786 ;; If we had a complete symbol table here (which rules out
5846 (c-backward-syntactic-ws)
5847 (if (< (skip-syntax-backward "w_") 0)
5848 ;; It's a symbol. Accept it only if it's one of the
5851 (looking-at c-simple-stmt-key)
5873 (c-fdoc-shift-type-backward t))
5902 ;; (i) a goto target like "foo:" - returns the symbol `goto-target';
5909 ;; Returns the symbol `qt-2kwds-colon'.
5910 ;; (v) QT's construct "signals:". Returns the symbol `qt-1kwd-colon'.
5943 qt-symbol-idx
6003 (c-backward-syntactic-ws)
6048 (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+" nil t)
6052 ;; (c-syntactic-skip-backward "^-]:?;}=*/%&|,<>!@+"
6077 (progn (backward-char)
6086 (backward-char)
6088 (setq qt-symbol-idx
6102 ((and qt-symbol-idx
6132 (while (c-syntactic-re-search-forward c-symbol-key nil t)
6188 (c-skip-ws-forward)
6212 (c-backward-syntactic-ws)
6227 (c-backward-token-2 0 t lim)
6228 (while (and (or (looking-at c-symbol-start)
6230 (zerop (c-backward-token-2 1 t lim))))))
6259 (backward-up-list 1)
6297 ;; LIM is used as bound for backward buffer searches.
6323 ;; The declarator is a paren expression, so skip past it
6339 ;; position that bounds the backward search for the argument list.
6376 (c-syntactic-skip-backward "^)]}")
6390 (unless (c-go-list-backward) (throw 'knr nil)) ;
6403 (eq (c-backward-token-2) 0)
6406 (c-go-up-list-backward)
6407 (eq (c-backward-token-2) 0)
6434 (or (c-go-list-backward) ; backwards over [ .... ]
6437 (defun c-skip-conditional ()
6438 ;; skip forward over conditional at point, including any predicate
6462 (and (zerop (c-backward-token-2 1 t lim))
6465 (zerop (c-backward-token-2 1 t lim))
6471 ;; like an ordinary symbol (i.e. like "operator =" in C++) then the
6479 (zerop (c-backward-token-2 1 nil lim))
6483 (zerop (c-backward-token-2 1 nil lim))
6487 (defsubst c-backward-to-block-anchor (&optional lim)
6500 (defsubst c-backward-to-decl-anchor (&optional lim)
6531 (and (c-safe (c-backward-sexp) t)
6555 ;; position that bounds the backward search.
6582 (c-backward-syntactic-ws lim)
6585 (backward-char)
6643 (eq (c-backward-token-2) 0)
6645 (eq (c-backward-token-2) 0)
6736 ;; The optional LIMIT limits the backward search for the start of
6746 (c-syntactic-skip-backward c-block-prefix-charset limit t)
6756 (c-backward-<>-arglist nil limit)
6758 (c-syntactic-skip-backward c-block-prefix-charset limit t)
6769 (when (c-syntactic-re-search-forward c-symbol-start
6798 (not (or (looking-at c-symbol-start)
6807 (= (c-backward-token-2) 0))
6826 (if (looking-at c-symbol-key)
6827 ;; Accept any plain symbol token on the ground that
6829 ;; like `c-forward-decl-or-cast-1' skip forward over
6843 (if (c-syntactic-re-search-forward c-symbol-start
6927 (c-backward-token-2 1 t lim)
6936 (cond ((/= (c-backward-token-2 1 t lim) 0) nil)
6957 (zerop (c-backward-token-2 1 t lim)))
6981 (skip-chars-backward "^<>")
6991 (/= (c-backward-token-2 1 t lim) 0))
7036 (c-backward-syntactic-ws)
7060 (backward-char)
7061 (c-backward-syntactic-ws)
7089 ;; LIM limits the backward search. CONTAINING-SEXP is the start
7110 (progn (c-backward-syntactic-ws)
7113 (progn (backward-char)
7131 (= (c-backward-token-2 1 nil closest-lim) 0)
7176 (c-backward-syntactic-ws lim)
7186 (defun c-looking-at-inexpr-block-backward (paren-state)
7218 (defsubst c-add-syntax (symbol &rest args)
7219 ;; A simple function to prepend a new syntax element to
7223 (setq c-syntactic-context (cons (cons symbol args)
7226 (defsubst c-append-syntax (symbol &rest args)
7230 (list (cons symbol args)))))
7232 (defun c-add-stmt-syntax (syntax-symbol
7242 ;; Do the generic processing to anchor the given syntax symbol on
7244 ;; statements on the same line, and then search backward until we
7250 ;; skip past open parens and containing statements. All the added
7254 ;; syntax symbol. They are appended after the anchor point.
7267 (apply 'c-add-syntax syntax-symbol (point) syntax-extra-args)
7276 (apply 'c-add-syntax syntax-symbol nil syntax-extra-args)
7292 (c-backward-single-comment))
7297 ;; Skip to the beginning of this statement or backward
7375 (c-backward-syntactic-ws containing-sexp)
7430 (defun c-add-class-syntax (symbol
7441 (if (and (eq symbol 'inclass) (= (point) (c-point 'boi)))
7443 (c-add-syntax symbol containing-decl-open)
7449 (c-add-syntax symbol (point))
7469 (skip-chars-forward " \t")
7493 ;; The most semantically accurate symbol here is
7604 ;; symbol of the keyword that tells what kind of block it
7676 (c-backward-syntactic-ws lim)
7680 (skip-chars-forward " \t")
7756 (and (c-safe (c-backward-syntactic-ws)
7757 (c-backward-sexp)
7760 (c-safe (c-backward-syntactic-ws)
7761 (c-backward-sexp)
7764 (c-safe (c-backward-sexp) t)
7779 (c-looking-at-inexpr-block-backward c-state-cache))
7847 (c-backward-to-block-anchor lim)
7881 (c-backward-to-block-anchor lim)
7939 (looking-at c-symbol-key))
7954 (skip-chars-forward " \t")
7972 (zerop (c-backward-token-2 1 t))
7994 ;; even though the semantically correct symbol still
8069 (skip-chars-forward " \t")
8080 (c-backward-syntactic-ws lim)
8084 (c-backward-syntactic-ws lim)))
8113 ;; don't add inclass symbol since relative point already
8148 ;; don't add inclass symbol since relative point already
8161 (c-syntactic-skip-backward "^;,=<>" lim t)
8170 (or (c-backward-<>-arglist nil lim)
8171 (backward-char))
8174 (backward-char)
8183 (c-syntactic-skip-backward "^;,=" lim t))
8193 (setq placeholder (c-up-list-backward))
8200 (c-backward-syntactic-ws lim)
8205 (c-syntactic-skip-backward "^,;" lim t)
8235 (c-backward-syntactic-ws)
8256 (if (string-equal (symbol-name containing-decl-kwd) "extern")
8260 (intern (concat (symbol-name containing-decl-kwd)
8323 (c-backward-syntactic-ws lim)
8330 ;; Speed up the backward search a bit.
8346 ;; sure we skip back past any access specifiers
8358 (c-backward-syntactic-ws lim)
8385 (if (string-equal (symbol-name containing-decl-kwd)
8391 (symbol-name containing-decl-kwd))))
8460 (if (and (c-safe (backward-up-list 1) t)
8464 (skip-chars-forward " \t"))
8486 ;; a function arglist. That makes us skip out of
8503 (if (and (c-safe (backward-up-list 1) t)
8507 (skip-chars-forward " \t"))
8533 (c-backward-syntactic-ws (c-point 'bod))
8534 (if (not (looking-at c-symbol-key))
8551 (if (and (c-safe (backward-up-list 1) t)
8555 (skip-chars-forward " \t"))
8571 (skip-chars-forward " \t")
8574 (skip-chars-forward " \t")
8579 (c-backward-syntactic-ws lim)
8609 (skip-chars-backward " \t")
8640 (c-safe (goto-char (c-up-list-backward (point))) t)
8660 (c-skip-ws-forward indent-point)
8691 (c-looking-at-inexpr-block-backward c-state-cache))
8717 (c-backward-to-block-anchor lim)
8750 (c-backward-to-decl-anchor lim)
8793 ;; c-backward-to-block-anchor not necessary here; those
8800 (c-backward-to-decl-anchor lim)
8857 (c-backward-to-block-anchor lim)
8897 (c-backward-to-decl-anchor lim)
8934 ;; c-backward-to-block-anchor not necessary here; those
8945 (skip-chars-forward " \t")
9009 (defun c-evaluate-offset (offset langelem symbol)
9032 langelem symbol))
9038 offset symbol)
9045 (setq val (c-evaluate-offset (car offset) langelem symbol))
9055 (car offset) symbol res val method)
9062 (car offset) symbol res val method)
9072 (setq val (c-evaluate-offset (car offset) langelem symbol))
9086 (car offset) symbol res val)
9096 (setq res (c-evaluate-offset (car offset) langelem symbol)
9101 (symbol-value offset))
9104 (c-benign-error "Unknown offset format %S for %s" offset symbol)
9111 offset symbol res)
9116 ;; syntactic symbol and followed by any analysis data it provides.
9118 ;; given then the first is the anchor position (or nil). The symbol
9123 (let* ((symbol (c-langelem-sym langelem))
9124 (match (assq symbol c-offsets-alist))
9127 (setq offset (c-evaluate-offset offset langelem symbol))
9129 (c-benign-error "No offset found for syntactic symbol %s" symbol))
9134 (and (symbolp offset) (symbol-value offset))