From 637b80cd6a2a73eb6723aec2f52aed1135d99de4 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 10 Oct 2021 17:03:03 +0000 Subject: 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 Signed-off-by: Junio C Hamano --- userdiff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'userdiff.c') 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 */ -- cgit v1.2.1