aboutsummaryrefslogtreecommitdiffstats
path: root/userdiff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-10-25 16:06:59 -0700
committerJunio C Hamano <gitster@pobox.com>2021-10-25 16:06:59 -0700
commitf3f157ff2774527a84bad7df1a95a63b7a2f4a4b (patch)
tree7963abedbdfd67d759fff7af3717d47039935909 /userdiff.c
parent6a1bb089fda35768b7649a91bf890e619c32e8e8 (diff)
parent386076ec92c702104cb15bc23e4521dac10c7c2d (diff)
downloadgit-f3f157ff2774527a84bad7df1a95a63b7a2f4a4b.tar.gz
Merge branch 'js/userdiff-cpp'
Userdiff patterns for the C++ language has been updated. * js/userdiff-cpp: userdiff-cpp: back out the digit-separators in numbers userdiff-cpp: learn the C++ spaceship operator userdiff-cpp: permit the digit-separating single-quote in numbers userdiff-cpp: prepare test cases with yet unsupported features userdiff-cpp: tighten word regex t4034: add tests showing problematic cpp tokenizations t4034/cpp: actually test that operator tokens are not split
Diffstat (limited to 'userdiff.c')
-rw-r--r--userdiff.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/userdiff.c b/userdiff.c
index af02b1878c..8578cb0d12 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -64,9 +64,15 @@ PATTERNS("cpp",
/* functions/methods, variables, and compounds at top level */
"^((::[[:space:]]*)?[A-Za-z_].*)$",
/* -- */
+ /* identifiers and keywords */
"[a-zA-Z_][a-zA-Z0-9_]*"
- "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*"
- "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"),
+ /* decimal and octal integers as well as floatingpoint numbers */
+ "|[0-9][0-9.]*([Ee][-+]?[0-9]+)?[fFlLuU]*"
+ /* hexadecimal and binary integers */
+ "|0[xXbB][0-9a-fA-F]+[lLuU]*"
+ /* floatingpoint numbers that begin with a decimal point */
+ "|\\.[0-9][0-9]*([Ee][-+]?[0-9]+)?[fFlL]?"
+ "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*|<=>"),
PATTERNS("csharp",
/* Keywords */
"!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"