From b9c65ca789cc7e5ffd7f964bba0e52d75ff37458 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Mon, 14 Oct 2024 21:27:04 +0000 Subject: [PATCH] CC Mode: Correct and simplify quoted number regexps C++ Mode now gives correct fontification when \' is inserted between the adjacent apostrophes in the number 0xde'adb''eef. * lisp/progmodes/cc-mode.el (c-maybe-quoted-number-head): Simplify and correct. (c-maybe-quoted-number-tail, c-maybe-quoted-number): Simplify. (cherry picked from commit 2a6f1527f6b3080c3879e6159424b824c86801a7) --- lisp/progmodes/cc-mode.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 71d343e1304..2fd1fb68fc0 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1761,14 +1761,14 @@ position of `after-change-functions'.") (defconst c-maybe-quoted-number-head (concat "\\(0\\(" - "\\([Xx]\\([[:xdigit:]]\\('[[:xdigit:]]\\|[[:xdigit:]]\\)*'?\\)?\\)" + "[Xx]\\([[:xdigit:]]\\('?[[:xdigit:]]\\)*\\)?" "\\|" - "\\([Bb]\\([01]\\('[01]\\|[01]\\)*'?\\)?\\)" + "[Bb]\\([01]\\('?[01]\\)*\\)?" "\\|" - "\\('[0-7]\\|[0-7]\\)*'?" + "\\('?[0-7]\\)*" "\\)" "\\|" - "[1-9]\\('[0-9]\\|[0-9]\\)*'?" + "[1-9]\\('?[0-9]\\)*" "\\)") "Regexp matching the head of a numeric literal, including with digit separators.") @@ -1795,11 +1795,11 @@ position of `after-change-functions'.") (defconst c-maybe-quoted-number-tail (concat "\\(" - "\\([xX']?[[:xdigit:]]\\('[[:xdigit:]]\\|[[:xdigit:]]\\)*\\)" + "\\([xX']?[[:xdigit:]]\\('?[[:xdigit:]]\\)*\\)" "\\|" - "\\([bB']?[01]\\('[01]\\|[01]\\)*\\)" + "\\([bB']?[01]\\('?[01]\\)*\\)" "\\|" - "\\('?[0-9]\\('[0-9]\\|[0-9]\\)*\\)" + "\\('?[0-9]\\)+" "\\)") "Regexp matching the tail of a numeric literal, including with digit separators. Note that this is a strict tail, so won't match, e.g. \"0x....\".") @@ -1815,14 +1815,14 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") (defconst c-maybe-quoted-number (concat "\\(0\\(" - "\\([Xx][[:xdigit:]]\\('[[:xdigit:]]\\|[[:xdigit:]]\\)*\\)" + "\\([Xx][[:xdigit:]]\\('?[[:xdigit:]]\\)*\\)" "\\|" - "\\([Bb][01]\\('[01]\\|[01]\\)*\\)" + "\\([Bb][01]\\('?[01]\\)*\\)" "\\|" - "\\('[0-7]\\|[0-7]\\)*" + "\\('?[0-7]\\)*" "\\)" "\\|" - "[1-9]\\('[0-9]\\|[0-9]\\)*" + "[1-9]\\('?[0-9]\\)*" "\\)") "Regexp matching a numeric literal, including with digit separators.") -- 2.39.5