diff options
| author | Martin Stjernholm | 2003-09-24 13:55:49 +0000 |
|---|---|---|
| committer | Martin Stjernholm | 2003-09-24 13:55:49 +0000 |
| commit | a6782a6efda9a70f4c50d9f62d07435c694377a9 (patch) | |
| tree | 6765f74b61831adc799b4d40858dce912d57ffe9 | |
| parent | 449a2b0d2eb2d9d65ca5d1a5e6d6e5b9ebd963ed (diff) | |
| download | emacs-a6782a6efda9a70f4c50d9f62d07435c694377a9.tar.gz emacs-a6782a6efda9a70f4c50d9f62d07435c694377a9.zip | |
(c-font-lock-declarations): Fixed recognition of constructors and
destructors for classes whose names are matched by
`*-font-lock-extra-types'.
(c-font-lock-invalid-string): Fixed eob problem that primarily
affected XEmacs. Don't use faces to find unterminated strings since
Emacs and XEmacs fontify strings differently - this function should
now work better in XEmacs.
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index e9f99d14022..c5a587f41e5 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -514,26 +514,21 @@ stuff. Used on level 1 and higher." | |||
| 514 | (defun c-font-lock-invalid-string () | 514 | (defun c-font-lock-invalid-string () |
| 515 | ;; Assuming the point is after the opening character of a string, | 515 | ;; Assuming the point is after the opening character of a string, |
| 516 | ;; fontify that char with `c-invalid-face-name' if the string | 516 | ;; fontify that char with `c-invalid-face-name' if the string |
| 517 | ;; decidedly isn't terminated properly. Assumes the string already | 517 | ;; decidedly isn't terminated properly. |
| 518 | ;; is syntactically fontified. | 518 | (let ((start (1- (point)))) |
| 519 | (let ((end (1+ (c-point 'eol)))) | 519 | (save-excursion |
| 520 | (and (eq (get-text-property (point) 'face) 'font-lock-string-face) | 520 | (and (nth 3 (parse-partial-sexp start (c-point 'eol))) |
| 521 | (= (next-single-property-change (point) 'face nil end) end) | 521 | (if (c-major-mode-is '(c-mode c++-mode objc-mode pike-mode)) |
| 522 | ;; We're at eol inside a string. The first check above is | 522 | ;; There's no \ before the newline. |
| 523 | ;; necessary in XEmacs since it doesn't fontify the string | 523 | (not (eq (char-before (point)) ?\\)) |
| 524 | ;; delimiters themselves. Thus an empty string won't have | 524 | ;; Quoted newlines aren't supported. |
| 525 | ;; the string face anywhere. | 525 | t) |
| 526 | (if (c-major-mode-is '(c-mode c++-mode objc-mode pike-mode)) | 526 | (if (c-major-mode-is 'pike-mode) |
| 527 | ;; There's no \ before the newline. | 527 | ;; There's no # before the string, so newlines |
| 528 | (not (eq (char-before (1- end)) ?\\)) | 528 | ;; aren't allowed. |
| 529 | ;; Quoted newlines aren't supported. | 529 | (not (eq (char-before start) ?#)) |
| 530 | t) | 530 | t) |
| 531 | (if (c-major-mode-is 'pike-mode) | 531 | (c-put-font-lock-face start (1+ start) c-invalid-face-name))))) |
| 532 | ;; There's no # before the string, so newlines | ||
| 533 | ;; aren't allowed. | ||
| 534 | (not (eq (char-before (1- (point))) ?#)) | ||
| 535 | t) | ||
| 536 | (c-put-font-lock-face (1- (point)) (point) c-invalid-face-name)))) | ||
| 537 | 532 | ||
| 538 | (c-lang-defconst c-basic-matchers-before | 533 | (c-lang-defconst c-basic-matchers-before |
| 539 | "Font lock matchers for basic keywords, labels, references and various | 534 | "Font lock matchers for basic keywords, labels, references and various |
| @@ -1497,15 +1492,21 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1497 | ;; identifier as a type and then backed up again in | 1492 | ;; identifier as a type and then backed up again in |
| 1498 | ;; this case. | 1493 | ;; this case. |
| 1499 | identifier-type | 1494 | identifier-type |
| 1500 | (or (eq identifier-type 'found) | 1495 | (or (memq identifier-type '(found known)) |
| 1501 | (and (eq (char-after identifier-start) ?~) | 1496 | (and (eq (char-after identifier-start) ?~) |
| 1502 | ;; `at-type' probably won't be 'found for | 1497 | ;; `at-type' probably won't be 'found for |
| 1503 | ;; destructors since the "~" is then part | 1498 | ;; destructors since the "~" is then part |
| 1504 | ;; of the type name being checked against | 1499 | ;; of the type name being checked against |
| 1505 | ;; the list of known types, so do a check | 1500 | ;; the list of known types, so do a check |
| 1506 | ;; without that operator. | 1501 | ;; without that operator. |
| 1507 | (c-check-type (1+ identifier-start) | 1502 | (or (save-excursion |
| 1508 | identifier-end)))) | 1503 | (goto-char (1+ identifier-start)) |
| 1504 | (c-forward-syntactic-ws) | ||
| 1505 | (c-with-syntax-table | ||
| 1506 | c-identifier-syntax-table | ||
| 1507 | (looking-at c-known-type-key))) | ||
| 1508 | (c-check-type (1+ identifier-start) | ||
| 1509 | identifier-end))))) | ||
| 1509 | (throw 'at-decl-or-cast t)) | 1510 | (throw 'at-decl-or-cast t)) |
| 1510 | 1511 | ||
| 1511 | (if got-identifier | 1512 | (if got-identifier |