diff options
| author | Russell Belfer <rb@github.com> | 2014-01-23 16:12:39 -0800 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2014-01-24 10:54:05 -0800 |
| commit | c7c260a5ff217c822e227428e712970e02fa56d9 (patch) | |
| tree | 9e72fce3c50b8b10a0b59e4475d8adc8b127796b /src/diff_driver.c | |
| parent | 5d82c0df13ad3bd8edf85ba8d5f3796e93f926d8 (diff) | |
| download | libgit2-c7c260a5ff217c822e227428e712970e02fa56d9.tar.gz | |
Got some permission to use userdiff patterns
I contacted a number of Git authors and lined up their permission
to relicense their work for use in libgit2 and copied over their
code for diff driver xfuncname patterns. At this point, the code
I've copied is taken verbatim from core Git although Thomas Rast
warned me that the C++ patterns, at least, really need an update.
I've left off patterns where I don't feel like I have permission
at this point until I hear from more authors.
Diffstat (limited to 'src/diff_driver.c')
| -rw-r--r-- | src/diff_driver.c | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/src/diff_driver.c b/src/diff_driver.c index 56b5b5a51..9249d1415 100644 --- a/src/diff_driver.c +++ b/src/diff_driver.c @@ -45,44 +45,7 @@ struct git_diff_driver { char name[GIT_FLEX_ARRAY]; }; -typedef struct { - const char *name; - const char *fns; - const char *words; - int flags; -} git_diff_driver_definition; - -#define WORD_DEFAULT "|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+" - -/* builtin driver definition macros have same signature as in core git - * userdiff.c so that the data can be extracted verbatim - */ -#define PATTERNS(NAME, FN_PATS, WORD_PAT) \ - { NAME, FN_PATS, WORD_PAT WORD_DEFAULT, 0 } -#define IPATTERN(NAME, FN_PATS, WORD_PAT) \ - { NAME, FN_PATS, WORD_PAT WORD_DEFAULT, REG_ICASE } - -static git_diff_driver_definition builtin_defs[] = { -PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$", - "[^<>= \t]+"), -PATTERNS("java", - "!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n" - "^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$", - /* -- */ - "[a-zA-Z_][a-zA-Z0-9_]*" - "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" - "|[-+*/<>%&^|=!]=" - "|--|\\+\\+|<<=?|>>>?=?|&&|\\|\\|"), -PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$", - /* -- */ - "(@|@@|\\$)?[a-zA-Z_][a-zA-Z0-9_]*" - "|[-+0-9.e]+|0[xXbB]?[0-9a-fA-F]+|\\?(\\\\C-)?(\\\\M-)?." - "|//=?|[-+*/<>%&^|=!]=|<<=?|>>=?|===|\\.{1,3}|::|[!=]~"), -}; - -#undef IPATTERN -#undef PATTERNS -#undef WORD_DEFAULT +#include "userdiff.h" struct git_diff_driver_registry { git_strmap *drivers; |
