diff options
Diffstat (limited to 'userdiff.c')
-rw-r--r-- | userdiff.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/userdiff.c b/userdiff.c index 2ccbee50cb..8b732e40bc 100644 --- a/userdiff.c +++ b/userdiff.c @@ -35,6 +35,8 @@ IPATTERN("fortran", * they would have been matched above as a variable anyway. */ "|[-+]?[0-9.]+([AaIiDdEeFfLlTtXx][Ss]?[-+]?[0-9.]*)?(_[a-zA-Z0-9][a-zA-Z0-9_]*)?" "|//|\\*\\*|::|[/<>=]="), +IPATTERN("fountain", "^((\\.[^.]|(int|ext|est|int\\.?/ext|i/e)[. ]).*)$", + "[^ \t-]+"), PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$", "[^<>= \t]+"), PATTERNS("java", @@ -146,6 +148,18 @@ PATTERNS("csharp", "[a-zA-Z_][a-zA-Z0-9_]*" "|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?" "|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"), +IPATTERN("css", + "![:;][[:space:]]*$\n" + "^[_a-z0-9].*$", + /* -- */ + /* + * This regex comes from W3C CSS specs. Should theoretically also + * allow ISO 10646 characters U+00A0 and higher, + * but they are not handled in this regex. + */ + "-?[_a-zA-Z][-_a-zA-Z0-9]*" /* identifiers */ + "|-?[0-9]+|\\#[0-9a-fA-F]+" /* numbers */ +), { "default", NULL, -1, { NULL, 0 } }, }; #undef PATTERNS @@ -248,25 +262,22 @@ struct userdiff_driver *userdiff_find_by_name(const char *name) { struct userdiff_driver *userdiff_find_by_path(const char *path) { - static struct git_attr *attr; - struct git_attr_check check; - - if (!attr) - attr = git_attr("diff"); - check.attr = attr; + static struct attr_check *check; + if (!check) + check = attr_check_initl("diff", NULL); if (!path) return NULL; - if (git_check_attr(path, 1, &check)) + if (git_check_attr(path, check)) return NULL; - if (ATTR_TRUE(check.value)) + if (ATTR_TRUE(check->items[0].value)) return &driver_true; - if (ATTR_FALSE(check.value)) + if (ATTR_FALSE(check->items[0].value)) return &driver_false; - if (ATTR_UNSET(check.value)) + if (ATTR_UNSET(check->items[0].value)) return NULL; - return userdiff_find_by_name(check.value); + return userdiff_find_by_name(check->items[0].value); } struct userdiff_driver *userdiff_get_textconv(struct userdiff_driver *driver) |