[gtksourceview/gtksourceview-4-8] Merge branch 'c-floating-point' into 'master'



commit 0e79122ebcaae6ad00dd040667854855dc9a8494
Author: Christian Hergert <christian hergert me>
Date:   Tue Dec 7 21:15:13 2021 +0000

    Merge branch 'c-floating-point' into 'master'
    
    c.lang: number improvements
    
    See merge request GNOME/gtksourceview!230
    
    (cherry picked from commit decac3cbe68b034347eb38547aa7c89f7f437013)
    
    cf46c69d c.lang: make exponent digits required
    f9a50d9b c.lang: support hexadecimal floating constants

 data/language-specs/c.lang       | 5 +++--
 tests/syntax-highlighting/file.c | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/data/language-specs/c.lang b/data/language-specs/c.lang
index 9b6e2d77..b9de0340 100644
--- a/data/language-specs/c.lang
+++ b/data/language-specs/c.lang
@@ -143,8 +143,9 @@
     <context id="float" style-ref="floating-point">
       <match extended="true">
         (?&lt;![\w\.])
-        ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]*)? |
-         ([0-9]+[Ee][+-]?[0-9]*))
+        ((\.[0-9]+ | [0-9]+\.[0-9]*) ([Ee][+-]?[0-9]+)? |
+         ([0-9]+[Ee][+-]?[0-9]+) |
+         (0[xX][a-fA-F0-9]*\.?[a-fA-F0-9]*[pP][+-]?[0-9]+))
         [fFlL]?
         (?![\w\.])
       </match>
diff --git a/tests/syntax-highlighting/file.c b/tests/syntax-highlighting/file.c
index ed0bb82a..74769b74 100644
--- a/tests/syntax-highlighting/file.c
+++ b/tests/syntax-highlighting/file.c
@@ -8,6 +8,7 @@ int main (void)
     int b = 089;
     int c = 89.;
     int d = 'a';
+    double hexadecimal_floating_constant = 0x1.2p3;
     printf ("Hello %s!\n", "world");
     return 0;
 }


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