commit/cc-mode: acm: Cope better with C++ and Objective-C protection
keywords in class declarations
6 years, 11 months
Bitbucket
1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/a8a9fbb96c60/
Changeset: a8a9fbb96c60
User: acm
Date: 2017-09-15 15:40:14+00:00
Summary: Cope better with C++ and Objective-C protection keywords in class declarations
This fix fixes the fontification of method inside a class at the time it is
typed, when there is a protection keyword clause preceding it.
* cc-engine.el (c-forward-keyword-clause): Handle protection keywords.
(c-looking-at-decl-block): Avoid scanning forward over protection keyword
clauses too eagerly.
* cc-langs.el (c-protection-key c-post-protection-token): New lang defconsts
and defvars.
* cc-mode.el (c-fl-decl-start): When we encounter a protection keyword
following a semicolon or brace, move forward over it before attempting to
parse a type.
Affected #: 3 files
diff -r e8243bf18226f0dc79f526d38a369fa78a76edf1 -r a8a9fbb96c60e0d68e7aee22ffaaee192a1fc966 cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -6937,7 +6937,7 @@
;; recognized are those specified by `c-type-list-kwds',
;; `c-ref-list-kwds', `c-colon-type-list-kwds',
;; `c-paren-nontype-kwds', `c-paren-type-kwds', `c-<>-type-kwds',
- ;; and `c-<>-arglist-kwds'.
+ ;; `c-<>-arglist-kwds', and `c-protection-kwds'.
;;
;; This function records identifier ranges on
;; `c-record-type-identifiers' and `c-record-ref-identifiers' if
@@ -7007,6 +7007,17 @@
(not (looking-at c-symbol-start))
(c-safe (c-forward-sexp) t))
(c-forward-syntactic-ws)
+ (setq safe-pos (point)))
+
+ ((and (c-keyword-member kwd-sym 'c-protection-kwds)
+ (or (null c-post-protection-token)
+ (and (looking-at c-post-protection-token)
+ (save-excursion
+ (goto-char (match-end 0))
+ (not (c-end-of-current-token))))))
+ (if c-post-protection-token
+ (goto-char (match-end 0)))
+ (c-forward-syntactic-ws)
(setq safe-pos (point))))
(when (c-keyword-member kwd-sym 'c-colon-type-list-kwds)
@@ -10178,8 +10189,16 @@
;; Could be more restrictive wrt invalid keywords,
;; but that'd only occur in invalid code so there's
;; no use spending effort on it.
- (let ((end (match-end 0)))
- (unless (c-forward-keyword-clause 0)
+ (let ((end (match-end 0))
+ (kwd-sym (c-keyword-sym (match-string 0))))
+ (unless
+ (and kwd-sym
+ ;; Moving over a protection kwd and the following
+ ;; ":" (in C++ Mode) to the next token could take
+ ;; us all the way up to `kwd-start', leaving us
+ ;; no chance to update `first-specifier-pos'.
+ (not (c-keyword-member kwd-sym 'c-protection-kwds))
+ (c-forward-keyword-clause 0))
(goto-char end)
(c-forward-syntactic-ws)))
diff -r e8243bf18226f0dc79f526d38a369fa78a76edf1 -r a8a9fbb96c60e0d68e7aee22ffaaee192a1fc966 cc-langs.el
--- a/cc-langs.el
+++ b/cc-langs.el
@@ -2267,6 +2267,18 @@
c++ '("private" "protected" "public")
objc '("@private" "@protected" "@public"))
+(c-lang-defconst c-protection-key
+ ;; A regexp match an element of `c-protection-kwds' cleanly.
+ t (c-make-keywords-re t (c-lang-const c-protection-kwds)))
+(c-lang-defvar c-protection-key (c-lang-const c-protection-key))
+
+(c-lang-defconst c-post-protection-token
+ "The token which (may) follow a protection keyword,
+e.g. the \":\" in C++ Mode's \"public:\". nil if there is no such token."
+ t nil
+ c++ ":")
+(c-lang-defvar c-post-protection-token (c-lang-const c-post-protection-token))
+
(c-lang-defconst c-block-decls-with-vars
"Keywords introducing declarations that can contain a block which
might be followed by variable declarations, e.g. like \"foo\" in
diff -r e8243bf18226f0dc79f526d38a369fa78a76edf1 -r a8a9fbb96c60e0d68e7aee22ffaaee192a1fc966 cc-mode.el
--- a/cc-mode.el
+++ b/cc-mode.el
@@ -1506,14 +1506,17 @@
(> (point) bod-lim)
(progn (c-forward-syntactic-ws)
(setq bo-decl (point))
- ;; Are we looking at a keyword such as "template" or
- ;; "typedef" which can decorate a type, or the type itself?
- (when (or (looking-at c-prefix-spec-kwds-re)
- (c-forward-type t))
- ;; We've found another candidate position.
- (setq new-pos (min new-pos bo-decl))
- (goto-char bo-decl))
- t)
+ (or (not (looking-at c-protection-key))
+ (c-forward-keyword-clause 1)))
+ (progn
+ ;; Are we looking at a keyword such as "template" or
+ ;; "typedef" which can decorate a type, or the type itself?
+ (when (or (looking-at c-prefix-spec-kwds-re)
+ (c-forward-type t))
+ ;; We've found another candidate position.
+ (setq new-pos (min new-pos bo-decl))
+ (goto-char bo-decl))
+ t)
;; Try and go out a level to search again.
(progn
(c-backward-syntactic-ws bod-lim)
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/cc-mode: acm: Don't match C++ template delims starting within a
token. FIxes bug #28418.
6 years, 12 months
Bitbucket
1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/e8243bf18226/
Changeset: e8243bf18226
User: acm
Date: 2017-09-12 15:50:54+00:00
Summary: Don't match C++ template delims starting within a token. FIxes bug #28418.
* cc-engine.el (c-restore-<>-properties): After failing an attempted match
from the start of a token (in particular, "<<"), move to the next token rather
than the nex character before searching for the next "<".
Affected #: 1 file
diff -r 3e60d214fbd331a6656b1bd6b43e12518bc9dfa2 -r e8243bf18226f0dc79f526d38a369fa78a76edf1 cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -6431,7 +6431,7 @@
(not (eq (c-get-char-property (point) 'c-type)
'c-decl-arg-start)))))))
(or (c-forward-<>-arglist nil)
- (forward-char)))))
+ (c-forward-token-2)))))
;; Functions to handle C++ raw strings.
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: 2 new changesets
7 years
Bitbucket
2 new commits in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/97ece44f19cf/
Changeset: 97ece44f19cf
User: kehoea
Date: 2017-09-07 08:16:19+00:00
Summary: Remove #'spaces-string, rect.el, call #'format instead.
lisp/ChangeLog addition:
2017-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
* rect.el (delete-extract-rectangle-line):
Use (format "%*s" N "") instead of (spaces-string N) in this
function.
* rect.el (extract-rectangle-line): Ditto.
* rect.el (spaces-strings): Removed.
* rect.el (spaces-string): Removed.
These aren't needed, (format "*s" N "") does the same job.
Affected #: 2 files
diff -r 97140cfdeca785747a13192343cf357ea21a3dc1 -r 97ece44f19cfad8a1892d2a542dcceea679ae93c lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2017-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * rect.el (delete-extract-rectangle-line):
+ Use (format "%*s" N "") instead of (spaces-string N) in this
+ function.
+ * rect.el (extract-rectangle-line): Ditto.
+ * rect.el (spaces-strings): Removed.
+ * rect.el (spaces-string): Removed.
+ These aren't needed, (format "*s" N "") does the same job.
+
2017-06-28 Aidan Kehoe <kehoea(a)parhasard.net>
* subr.el (char-width): Move this to C, necessary as part of the
diff -r 97140cfdeca785747a13192343cf357ea21a3dc1 -r 97ece44f19cfad8a1892d2a542dcceea679ae93c lisp/rect.el
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -133,39 +133,16 @@
(interactive "*r\nP")
(apply-on-rectangle 'delete-rectangle-line start end fill))
-
-;; I love ascii art ;-)
-(defconst spaces-strings '[""
- " "
- " "
- " "
- " "
- " "
- " "
- " "
- " "])
-
-;; This function is untouched --dv
-(defun spaces-string (n)
- (if (<= n 8) (aref spaces-strings n)
- (let ((val ""))
- (while (> n 8)
- (setq val (concat " " val)
- n (- n 8)))
- (concat val (aref spaces-strings n)))))
-
-
(defun delete-extract-rectangle-line (startcol endcol lines fill)
(let ((pt (point-at-eol)))
(if (< (move-to-column startcol (or fill 'coerce)) startcol)
- (setcdr lines (cons (spaces-string (- endcol startcol))
+ (setcdr lines (cons (format "%*s" (- endcol startcol) "")
(cdr lines)))
;; else
(setq pt (point))
(move-to-column endcol t)
(setcdr lines (cons (buffer-substring pt (point)) (cdr lines)))
- (delete-region pt (point)))
- ))
+ (delete-region pt (point)))))
;;;###autoload
(defun delete-extract-rectangle (start end &optional fill)
@@ -201,14 +178,12 @@
(let ((width (- (current-column)
(save-excursion (backward-char 1)
(current-column)))))
- (setq line (concat (substring line 0 (- (point) end 1))
- (spaces-string width)
- (substring line (+ (length line)
- (- (point) end)))))))
+ (setq line (format "%.*s%*s%s"
+ (- (point) end 1) line
+ width ""
+ (subseq line (+ (length line) (- (point) end)))))))
(if (or (> begextra 0) (> endextra 0))
- (setq line (concat (spaces-string begextra)
- line
- (spaces-string endextra))))
+ (setq line (format "%*s%s%*s" begextra "" line endextra "")))
(setcdr lines (cons line (cdr lines)))))
;;;###autoload
https://bitbucket.org/xemacs/xemacs/commits/8dea4d0549ac/
Changeset: 8dea4d0549ac
User: kehoea
Date: 2017-09-07 08:19:50+00:00
Summary: Fix up whitespace, rect.el
2017-09-07 Aidan Kehoe <kehoea(a)parhasard.net>
[...]
* rect.el (apply-on-rectangle):
* rect.el (delete-rectangle-line):
* rect.el (open-rectangle-line):
* rect.el (string-rectangle-line):
* rect.el (clear-rectangle-line):
* rect.el (rect):
Fixup whitespace in this file.
Affected #: 2 files
diff -r 97ece44f19cfad8a1892d2a542dcceea679ae93c -r 8dea4d0549ac0a49456d01bba96171399456c227 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -7,6 +7,13 @@
* rect.el (spaces-strings): Removed.
* rect.el (spaces-string): Removed.
These aren't needed, (format "*s" N "") does the same job.
+ * rect.el (apply-on-rectangle):
+ * rect.el (delete-rectangle-line):
+ * rect.el (open-rectangle-line):
+ * rect.el (string-rectangle-line):
+ * rect.el (clear-rectangle-line):
+ * rect.el (rect):
+ Fixup whitespace in this file.
2017-06-28 Aidan Kehoe <kehoea(a)parhasard.net>
diff -r 97ece44f19cfad8a1892d2a542dcceea679ae93c -r 8dea4d0549ac0a49456d01bba96171399456c227 lisp/rect.el
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -106,9 +106,7 @@
(goto-char startpt)
(while (< (point) endpt)
(apply function startcol endcol args)
- (forward-line 1)))
- ))
-
+ (forward-line 1)))))
(defun delete-rectangle-line (startcol endcol fill)
(let ((pt (point-at-eol)))
@@ -118,8 +116,7 @@
;; else
(setq pt (point))
(move-to-column endcol t)
- (delete-region pt (point))))
- ))
+ (delete-region pt (point))))))
;;;###autoload
(defun delete-rectangle (start end &optional fill)
@@ -155,7 +152,6 @@
(apply-on-rectangle 'delete-extract-rectangle-line start end lines fill)
(nreverse (cdr lines))))
-
;; #### NOTE: this is actually the only function that needs to do complicated
;; stuff like what's happening in `operate-on-rectangle', because the buffer
;; might be read-only. --dv
@@ -194,7 +190,6 @@
(apply-on-rectangle 'extract-rectangle-line start end lines)
(nreverse (cdr lines))))
-
;;;###autoload
(defvar killed-rectangle nil
"Rectangle for `yank-rectangle' to insert.")
@@ -220,7 +215,6 @@
(interactive "*")
(insert-rectangle killed-rectangle))
-
;; This function is untouched --dv
;;;###autoload
(defun insert-rectangle (rectangle)
@@ -244,7 +238,6 @@
(insert (car lines))
(setq lines (cdr lines)))))
-
(defun open-rectangle-line (startcol endcol fill)
(when (= (move-to-column startcol (or fill 'coerce)) startcol)
(unless (and (not fill)
@@ -262,7 +255,6 @@
(apply-on-rectangle 'open-rectangle-line start end fill)
(goto-char start))
-
(defun string-rectangle-line (startcol endcol string delete)
(move-to-column startcol t)
(if delete
@@ -290,7 +282,6 @@
(interactive "*r\nsString rectangle: ")
(apply-on-rectangle 'string-rectangle-line start end string t))
-
(defun clear-rectangle-line (startcol endcol fill)
(let ((pt (point-at-eol))
spaces)
@@ -303,8 +294,7 @@
(move-to-column endcol t)
(setq spaces (- (point) pt))
(delete-region pt (point))
- (indent-to (+ (current-column) spaces))))
- ))
+ (indent-to (+ (current-column) spaces))))))
;;;###autoload
(defun clear-rectangle (start end &optional fill)
@@ -317,7 +307,6 @@
(interactive "*r\nP")
(apply-on-rectangle 'clear-rectangle-line start end fill))
-
(provide 'rect)
;;; rect.el ends here
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/cc-mode: acm: Correct the fontification of quote marks after
buffer changes in CC Mode.
7 years
Bitbucket
1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/3e60d214fbd3/
Changeset: 3e60d214fbd3
User: acm
Date: 2017-09-03 10:33:48+00:00
Summary: Correct the fontification of quote marks after buffer changes in CC Mode.
* cc-mode.el (c-parse-quotes-before-change, c-parse-quotes-after-change):
Rewrite the functions, simplifying considerably, and removing unnecessary
optimisations. Invalidate two caches after manipulating text properties.
Affected #: 2 files
diff -r 5d15a9c876808dbfea2f62007f4b8dc401b27cf6 -r 3e60d214fbd331a6656b1bd6b43e12518bc9dfa2 cc-defs.el
--- a/cc-defs.el
+++ b/cc-defs.el
@@ -1187,6 +1187,29 @@
;; Gnu Emacs
`(c-clear-char-property-with-value-function ,from ,to ,property ,value)))
+(defmacro c-search-forward-char-property-with-value-on-char
+ (property value char &optional limit)
+ "Search forward for a text-property PROPERTY having value VALUE on a
+character with value CHAR.
+LIMIT bounds the search. The value comparison is done with `equal'.
+PROPERTY must be a constant.
+
+Leave point just after the character, and set the match data on
+this character, and return point. If the search fails, return
+nil; point is then left undefined."
+ `(let ((char-skip (concat "^" (char-to-string ,char)))
+ (-limit- ,limit)
+ (-value- ,value))
+ (while
+ (and
+ (progn (skip-chars-forward char-skip -limit-)
+ (< (point) -limit-))
+ (not (equal (c-get-char-property (point) ,property) -value-)))
+ (forward-char))
+ (when (< (point) -limit-)
+ (search-forward-regexp ".") ; to set the match-data.
+ (point))))
+
(defun c-clear-char-property-with-value-on-char-function (from to property
value char)
"Remove all text-properties PROPERTY with value VALUE on
diff -r 5d15a9c876808dbfea2f62007f4b8dc401b27cf6 -r 3e60d214fbd331a6656b1bd6b43e12518bc9dfa2 cc-mode.el
--- a/cc-mode.el
+++ b/cc-mode.el
@@ -1181,74 +1181,80 @@
;;
;; This function is called exclusively as a before-change function via the
;; variable `c-get-state-before-change-functions'.
- (c-save-buffer-state (p-limit limits found)
- ;; Special consideraton for deleting \ from '\''.
- (if (and (> end beg)
- (eq (char-before end) ?\\)
- (<= c-new-END end))
- (setq c-new-END (min (1+ end) (point-max))))
-
- ;; Do we have a ' (or something like ',',',',',') within range of
- ;; c-new-BEG?
+ (c-save-buffer-state ()
(goto-char c-new-BEG)
- (setq p-limit (max (- (point) 2) (point-min)))
- (while (and (skip-chars-backward "^\\\\'" p-limit)
- (> (point) p-limit))
- (when (eq (char-before) ?\\)
- (setq p-limit (max (1- p-limit) (point-min))))
- (backward-char)
- (setq c-new-BEG (point)))
+ ;; We need to scan for 's from the BO (logical) line.
(beginning-of-line)
- (while (and
- (setq found (search-forward-regexp "\\('\\([^'\\]\\|\\\\.\\)\\)*'"
- c-new-BEG 'limit))
- (< (point) (1- c-new-BEG))))
- (if found
- (setq c-new-BEG
- (if (and (eq (point) (1- c-new-BEG))
- (eq (char-after) ?')) ; "''" before c-new-BEG.
- (1- c-new-BEG)
- (match-beginning 0))))
+ (while (eq (char-before (1- (point))) ?\\)
+ (beginning-of-line 0))
+ (while (and (< (point) c-new-BEG)
+ (search-forward "'" c-new-BEG t))
+ (cond
+ ((c-quoted-number-straddling-point)
+ (goto-char (match-end 0))
+ (if (> (match-end 0) c-new-BEG)
+ (setq c-new-BEG (match-beginning 0))))
+ ((c-quoted-number-head-before-point)
+ (if (>= (point) c-new-BEG)
+ (setq c-new-BEG (match-beginning 0))))
+ ((looking-at "\\([^'\\]\\|\\\\.\\)'")
+ (goto-char (match-end 0))
+ (if (> (match-end 0) c-new-BEG)
+ (setq c-new-BEG (1- (match-beginning 0)))))
+ ((or (>= (point) (1- c-new-BEG))
+ (and (eq (point) (- c-new-BEG 2))
+ (eq (char-after) ?\\)))
+ (setq c-new-BEG (1- (point))))
+ (t nil)))
- ;; Check for a number with quote separators straddling c-new-BEG
- (when c-has-quoted-numbers
- (goto-char c-new-BEG)
- (when ;; (c-quoted-number-straddling-point)
- (c-quoted-number-head-before-point)
- (setq c-new-BEG (match-beginning 0))))
-
- ;; Do we have a ' (or something like ',',',',...,',') within range of
- ;; c-new-END?
(goto-char c-new-END)
- (setq p-limit (min (+ (point) 2) (point-max)))
- (while (and (skip-chars-forward "^\\\\'" p-limit)
- (< (point) p-limit))
- (when (eq (char-after) ?\\)
- (setq p-limit (min (1+ p-limit) (point-max))))
- (forward-char)
- (setq c-new-END (point)))
- (if (looking-at "[^']?\\('\\([^'\\]\\|\\\\.\\)\\)*'")
- (setq c-new-END (match-end 0)))
+ ;; We will scan from the BO (logical) line.
+ (beginning-of-line)
+ (while (eq (char-before (1- (point))) ?\\)
+ (beginning-of-line 0))
+ (while (and (< (point) c-new-END)
+ (search-forward "'" c-new-END t))
+ (cond
+ ((c-quoted-number-straddling-point)
+ (goto-char (match-end 0))
+ (if (> (match-end 0) c-new-END)
+ (setq c-new-END (match-end 0))))
+ ((c-quoted-number-tail-after-point)
+ (goto-char (match-end 0))
+ (if (> (match-end 0) c-new-END)
+ (setq c-new-END (match-end 0))))
+ ((looking-at "\\([^'\\]\\|\\\\.\\)'")
+ (goto-char (match-end 0))
+ (if (> (match-end 0) c-new-END)
+ (setq c-new-END (match-end 0))))
+ (t nil)))
+ ;; Having reached c-new-END, handle any 's after it whose context may be
+ ;; changed by the current buffer change.
+ (goto-char c-new-END)
+ (cond
+ ((c-quoted-number-tail-after-point)
+ (setq c-new-END (match-end 0)))
+ ((looking-at
+ "\\(\\\\.\\|.\\)?\\('\\([^'\\]\\|\\\\.\\)\\)*'")
+ (setq c-new-END (match-end 0))))
- ;; Check for a number with quote separators straddling c-new-END.
- (when c-has-quoted-numbers
- (goto-char c-new-END)
- (when ;; (c-quoted-number-straddling-point)
- (c-quoted-number-tail-after-point)
- (setq c-new-END (match-end 0))))
-
- ;; Remove the '(1) syntax-table property from all "'"s within (c-new-BEG
+ ;; Remove the '(1) syntax-table property from any "'"s within (c-new-BEG
;; c-new-END).
- (c-clear-char-property-with-value-on-char
- c-new-BEG c-new-END
- 'syntax-table '(1)
- ?')
- ;; Remove the c-digit-separator text property from the same "'"s.
- (when c-has-quoted-numbers
+ (goto-char c-new-BEG)
+ (when (c-search-forward-char-property-with-value-on-char
+ 'syntax-table '(1) ?\' c-new-END)
+ (c-invalidate-state-cache (1- (point)))
+ (c-truncate-semi-nonlit-pos-cache (1- (point)))
(c-clear-char-property-with-value-on-char
- c-new-BEG c-new-END
- 'c-digit-separator t
- ?'))))
+ (1- (point)) c-new-END
+ 'syntax-table '(1)
+ ?')
+ ;; Remove the c-digit-separator text property from the same "'"s.
+ (when c-has-quoted-numbers
+ (c-clear-char-property-with-value-on-char
+ (1- (point)) c-new-END
+ 'c-digit-separator t
+ ?')))))
(defun c-parse-quotes-after-change (beg end old-len)
;; This function applies syntax-table properties (value '(1)) and
@@ -1258,28 +1264,37 @@
;;
;; This function is called exclusively as an after-change function via the
;; variable `c-before-font-lock-functions'.
- (c-save-buffer-state (p-limit limits num-beg num-end clear-from-BEG-to)
+ (c-save-buffer-state (num-beg num-end)
;; Apply the needed syntax-table and c-digit-separator text properties to
;; quotes.
- (goto-char c-new-BEG)
- (while (and (< (point) c-new-END)
- (search-forward "'" c-new-END 'limit))
- (cond ((and (eq (char-before (1- (point))) ?\\)
- ;; Check we've got an odd number of \s, here.
- (save-excursion
- (backward-char)
- (eq (logand (skip-chars-backward "\\\\") 1) 1)))) ; not a real '.
- ((c-quoted-number-straddling-point)
- (setq num-beg (match-beginning 0)
- num-end (match-end 0))
- (c-put-char-properties-on-char num-beg num-end
- 'syntax-table '(1) ?')
- (c-put-char-properties-on-char num-beg num-end
- 'c-digit-separator t ?')
- (goto-char num-end))
- ((looking-at "\\([^\\']\\|\\\\.\\)'") ; balanced quoted expression.
- (goto-char (match-end 0)))
- (t (c-put-char-property (1- (point)) 'syntax-table '(1)))))))
+ (save-restriction
+ (goto-char c-new-BEG)
+ (while (and (< (point) c-new-END)
+ (search-forward "'" c-new-END 'limit))
+ (cond ((and (eq (char-before (1- (point))) ?\\)
+ ;; Check we've got an odd number of \s, here.
+ (save-excursion
+ (backward-char)
+ (eq (logand (skip-chars-backward "\\\\") 1) 1)))) ; not a real '.
+ ((c-quoted-number-straddling-point)
+ (setq num-beg (match-beginning 0)
+ num-end (match-end 0))
+ (c-invalidate-state-cache num-beg)
+ (c-truncate-semi-nonlit-pos-cache num-beg)
+ (c-put-char-properties-on-char num-beg num-end
+ 'syntax-table '(1) ?')
+ (c-put-char-properties-on-char num-beg num-end
+ 'c-digit-separator t ?')
+ (goto-char num-end))
+ ((looking-at "\\([^\\']\\|\\\\.\\)'") ; balanced quoted expression.
+ (goto-char (match-end 0)))
+ (t
+ (c-invalidate-state-cache (1- (point)))
+ (c-truncate-semi-nonlit-pos-cache (1- (point)))
+ (c-put-char-property (1- (point)) 'syntax-table '(1))))
+ ;; Prevent the next `c-quoted-number-straddling-point' getting
+ ;; confused by already processed single quotes.
+ (narrow-to-region (point) (point-max))))))
(defun c-before-change (beg end)
;; Function to be put in `before-change-functions'. Primarily, this calls
Repository URL: https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.