summary refs log tree commit diff
path: root/userdiff.c
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2021-10-10 17:03:03 +0000
committerJunio C Hamano <gitster@pobox.com>2021-10-10 15:24:21 -0700
commit637b80cd6a2a73eb6723aec2f52aed1135d99de4 (patch)
tree523f84e2e59077c69d6eec3fd516df830459feb4 /userdiff.c
parentbfaaf191a5470cb81ce327bc3b9ef9e277c9767b (diff)
userdiff-cpp: permit the digit-separating single-quote in numbers
Since C++17, the single-quote can be used as digit separator:

   3.141'592'654
   1'000'000
   0xdead'beaf

Make it known to the word regex of the cpp driver, so that numbers are
not split into separate tokens at the single-quotes.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'userdiff.c')
-rw-r--r--userdiff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/userdiff.c b/userdiff.c
index 8b49194f56..c1084650dd 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -67,11 +67,11 @@ PATTERNS("cpp",
 	 /* identifiers and keywords */
 	 "[a-zA-Z_][a-zA-Z0-9_]*"
 	 /* decimal and octal integers as well as floatingpoint numbers */
-	 "|[0-9][0-9.]*([Ee][-+]?[0-9]+)?[fFlLuU]*"
+	 "|[0-9][0-9.']*([Ee][-+]?[0-9]+)?[fFlLuU]*"
 	 /* hexadecimal and binary integers */
-	 "|0[xXbB][0-9a-fA-F]+[lLuU]*"
+	 "|0[xXbB][0-9a-fA-F']+[lLuU]*"
 	 /* floatingpoint numbers that begin with a decimal point */
-	 "|\\.[0-9]+([Ee][-+]?[0-9]+)?[fFlL]?"
+	 "|\\.[0-9][0-9']*([Ee][-+]?[0-9]+)?[fFlL]?"
 	 "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
 PATTERNS("csharp",
 	 /* Keywords */