diff options
author | Johannes Sixt <j6t@kdbg.org> | 2021-10-10 20:03:03 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-11 01:24:21 +0300 |
commit | 637b80cd6a2a73eb6723aec2f52aed1135d99de4 (patch) | |
tree | 523f84e2e59077c69d6eec3fd516df830459feb4 /userdiff.c | |
parent | bfaaf191a5470cb81ce327bc3b9ef9e277c9767b (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.c | 6 |
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 */ |