emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2a6f1527f6b: CC Mode: Correct and simplify quoted number regexps


From: Alan Mackenzie
Subject: master 2a6f1527f6b: CC Mode: Correct and simplify quoted number regexps
Date: Mon, 14 Oct 2024 17:30:31 -0400 (EDT)

branch: master
commit 2a6f1527f6b3080c3879e6159424b824c86801a7
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    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.
---
 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 35516a53bae..fe3ddaa170f 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1774,14 +1774,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.")
 
@@ -1808,11 +1808,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....\".")
@@ -1828,14 +1828,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.")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]