66 |
;; positions, e.g. to improve speed and to eliminate glitches in |
;; positions, e.g. to improve speed and to eliminate glitches in |
67 |
;; interactive refontification. |
;; interactive refontification. |
68 |
;; |
;; |
69 |
|
;; Note: This doc is for internal use only. Other packages should not |
70 |
|
;; assume that these text properties are used as described here. |
71 |
|
;; |
72 |
;; 'syntax-table |
;; 'syntax-table |
73 |
;; Used to modify the syntax of some characters. Currently used to |
;; Used to modify the syntax of some characters. Currently used to |
74 |
;; mark the "<" and ">" of angle bracket parens with paren syntax. |
;; mark the "<" and ">" of angle bracket parens with paren syntax. |
512 |
;; that we've moved. |
;; that we've moved. |
513 |
(while (progn |
(while (progn |
514 |
(setq pos (point)) |
(setq pos (point)) |
515 |
(c-backward-syntactic-ws) ; might go back an awk-mode virtual semicolon, here. |
(if (c-mode-is-new-awk-p) |
516 |
; How about using c-awk-NL-prop for AWK Mode, here. |
(c-awk-backward-syntactic-ws) |
517 |
; Something like c-awk-backward-syntactic-ws. |
(c-backward-syntactic-ws)) |
|
; 2002/6/22. Doesn't matter! Leave it as it is. |
|
518 |
(/= (skip-chars-backward "-+!*&~@`#") 0))) ; ACM, 2002/5/31; |
(/= (skip-chars-backward "-+!*&~@`#") 0))) ; ACM, 2002/5/31; |
519 |
; Make a variable in |
; Make a variable in |
520 |
; cc-langs.el, maybe |
; cc-langs.el, maybe |
822 |
;; Skip over the unary operators that can start the statement. |
;; Skip over the unary operators that can start the statement. |
823 |
(goto-char pos) |
(goto-char pos) |
824 |
(while (progn |
(while (progn |
825 |
(c-backward-syntactic-ws) |
(if (c-mode-is-new-awk-p) |
826 |
|
(c-awk-backward-syntactic-ws) |
827 |
|
(c-backward-syntactic-ws)) |
828 |
(/= (skip-chars-backward "-+!*&~@`#") 0)) ; Hopefully the # won't hurt awk. |
(/= (skip-chars-backward "-+!*&~@`#") 0)) ; Hopefully the # won't hurt awk. |
829 |
(setq pos (point))) |
(setq pos (point))) |
830 |
(goto-char pos) |
(goto-char pos) |
2667 |
|
|
2668 |
(defalias 'c-in-literal |
(defalias 'c-in-literal |
2669 |
(if (fboundp 'buffer-syntactic-context) |
(if (fboundp 'buffer-syntactic-context) |
2670 |
'c-fast-in-literal ; Xemacs |
'c-fast-in-literal ; XEmacs |
2671 |
'c-slow-in-literal)) ; GNU Emacs |
'c-slow-in-literal)) ; GNU Emacs |
2672 |
|
|
2673 |
;; The defalias above isn't enough to shut up the byte compiler. |
;; The defalias above isn't enough to shut up the byte compiler. |
5426 |
))) |
))) |
5427 |
|
|
5428 |
(defun c-guess-basic-syntax () |
(defun c-guess-basic-syntax () |
5429 |
"Return the syntactic context of the current line." |
"Return the syntactic context of the current line. |
5430 |
|
This function does not do any hidden buffer changes." |
5431 |
(save-excursion |
(save-excursion |
5432 |
(save-restriction |
(save-restriction |
5433 |
(beginning-of-line) |
(beginning-of-line) |
5434 |
(let* ((indent-point (point)) |
(c-save-buffer-state |
5435 |
(case-fold-search nil) |
((indent-point (point)) |
5436 |
(paren-state (c-parse-state)) |
(case-fold-search nil) |
5437 |
literal containing-sexp char-before-ip char-after-ip lim |
(paren-state (c-parse-state)) |
5438 |
c-syntactic-context placeholder c-in-literal-cache step-type |
literal containing-sexp char-before-ip char-after-ip lim |
5439 |
tmpsymbol keyword injava-inher special-brace-list |
c-syntactic-context placeholder c-in-literal-cache step-type |
5440 |
;; narrow out any enclosing class or extern "C" block |
tmpsymbol keyword injava-inher special-brace-list |
5441 |
(inclass-p (c-narrow-out-enclosing-class paren-state |
;; narrow out any enclosing class or extern "C" block |
5442 |
indent-point)) |
(inclass-p (c-narrow-out-enclosing-class paren-state |
5443 |
;; `c-state-cache' is shadowed here so that we don't |
indent-point)) |
5444 |
;; throw it away due to the narrowing that might be done |
;; `c-state-cache' is shadowed here so that we don't |
5445 |
;; by the function above. That means we must not do any |
;; throw it away due to the narrowing that might be done |
5446 |
;; changes during the execution of this function, since |
;; by the function above. That means we must not do any |
5447 |
;; `c-invalidate-state-cache' then would change this local |
;; changes during the execution of this function, since |
5448 |
;; variable and leave a bogus value in the global one. |
;; `c-invalidate-state-cache' then would change this local |
5449 |
(c-state-cache (if inclass-p |
;; variable and leave a bogus value in the global one. |
5450 |
(c-whack-state-before (point-min) paren-state) |
(c-state-cache (if inclass-p |
5451 |
paren-state)) |
(c-whack-state-before (point-min) paren-state) |
5452 |
(c-state-cache-start (point-min)) |
paren-state)) |
5453 |
inenclosing-p macro-start in-macro-expr |
(c-state-cache-start (point-min)) |
5454 |
;; There's always at most one syntactic element which got |
inenclosing-p macro-start in-macro-expr |
5455 |
;; a relpos. It's stored in syntactic-relpos. |
;; There's always at most one syntactic element which got |
5456 |
syntactic-relpos |
;; a relpos. It's stored in syntactic-relpos. |
5457 |
(c-stmt-delim-chars c-stmt-delim-chars)) |
syntactic-relpos |
5458 |
|
(c-stmt-delim-chars c-stmt-delim-chars)) |
5459 |
;; Check for meta top-level enclosing constructs such as |
;; Check for meta top-level enclosing constructs such as |
5460 |
;; extern language definitions. |
;; extern language definitions. |
5461 |
(save-excursion |
(save-excursion |