diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-03-31 16:30:54 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-03-31 16:30:54 -0700 |
commit | c228a5c077d564d84e52fb1aabf3d623230c894d (patch) | |
tree | 50694b2bc9e5eb48c34bb747dc3ed7fbe6a1c600 /userdiff.c | |
parent | Merge branch 'dw/doc-status-no-longer-shows-pound-prefix' (diff) | |
parent | userdiff: have 'cpp' hunk header pattern catch more C++ anchor points (diff) | |
download | tgif-c228a5c077d564d84e52fb1aabf3d623230c894d.tar.xz |
Merge branch 'js/userdiff-cc'
Improves the pattern to match the hunk-header for C/C++.
* js/userdiff-cc:
userdiff: have 'cpp' hunk header pattern catch more C++ anchor points
t4018: test cases showing that the cpp pattern misses many anchor points
t4018: test cases for the built-in cpp pattern
t4018: reduce test files for pattern compilation tests
t4018: convert custom pattern test to the new infrastructure
t4018: convert java pattern test to the new infrastructure
t4018: convert perl pattern tests to the new infrastructure
t4018: an infrastructure to test hunk headers
userdiff: support unsigned and long long suffixes of integer constants
userdiff: support C++ ->* and .* operators in the word regexp
Diffstat (limited to 'userdiff.c')
-rw-r--r-- | userdiff.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/userdiff.c b/userdiff.c index 10b61ec37d..fad52d6392 100644 --- a/userdiff.c +++ b/userdiff.c @@ -125,15 +125,13 @@ PATTERNS("tex", "^(\\\\((sub)*section|chapter|part)\\*{0,1}\\{.*)$", "\\\\[a-zA-Z@]+|\\\\.|[a-zA-Z0-9\x80-\xff]+"), PATTERNS("cpp", /* Jump targets or access declarations */ - "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:.*$\n" - /* C/++ functions/methods at top level */ - "^([A-Za-z_][A-Za-z_0-9]*([ \t*]+[A-Za-z_][A-Za-z_0-9]*([ \t]*::[ \t]*[^[:space:]]+)?){1,}[ \t]*\\([^;]*)$\n" - /* compound type at top level */ - "^((struct|class|enum)[^;]*)$", + "!^[ \t]*[A-Za-z_][A-Za-z_0-9]*:[[:space:]]*($|/[/*])\n" + /* functions/methods, variables, and compounds at top level */ + "^((::[[:space:]]*)?[A-Za-z_].*)$", /* -- */ "[a-zA-Z_][a-zA-Z0-9_]*" - "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" - "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"), + "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lLuU]*" + "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->\\*?|\\.\\*"), PATTERNS("csharp", /* Keywords */ "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n" |