Userdiff patterns for C#
Add userdiff patterns for C#. This code is an improved version of code by Adam Petaccia from 21 June 2009 mail to the list. Signed-off-by: Petr Onderka <gsvick@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
64fdc08dac
commit
b221207db9
@ -441,6 +441,8 @@ patterns are available:
|
|||||||
|
|
||||||
- `cpp` suitable for source code in the C and C++ languages.
|
- `cpp` suitable for source code in the C and C++ languages.
|
||||||
|
|
||||||
|
- `csharp` suitable for source code in the C# language.
|
||||||
|
|
||||||
- `html` suitable for HTML/XHTML documents.
|
- `html` suitable for HTML/XHTML documents.
|
||||||
|
|
||||||
- `java` suitable for source code in the Java language.
|
- `java` suitable for source code in the Java language.
|
||||||
|
@ -32,7 +32,7 @@ EOF
|
|||||||
|
|
||||||
sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
|
sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
|
||||||
|
|
||||||
builtin_patterns="bibtex cpp html java objc pascal php python ruby tex"
|
builtin_patterns="bibtex cpp csharp html java objc pascal php python ruby tex"
|
||||||
for p in $builtin_patterns
|
for p in $builtin_patterns
|
||||||
do
|
do
|
||||||
test_expect_success "builtin $p pattern compiles" '
|
test_expect_success "builtin $p pattern compiles" '
|
||||||
|
16
userdiff.c
16
userdiff.c
@ -82,6 +82,22 @@ PATTERNS("cpp",
|
|||||||
"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
|
"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
|
||||||
"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
|
"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
|
||||||
"|[^[:space:]]|[\x80-\xff]+"),
|
"|[^[:space:]]|[\x80-\xff]+"),
|
||||||
|
PATTERNS("csharp",
|
||||||
|
/* Keywords */
|
||||||
|
"!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
|
||||||
|
/* Methods and constructors */
|
||||||
|
"^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
|
||||||
|
/* Properties */
|
||||||
|
"^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
|
||||||
|
/* Type definitions */
|
||||||
|
"^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
|
||||||
|
/* Namespace */
|
||||||
|
"^[ \t]*(namespace[ \t]+.*)$",
|
||||||
|
/* -- */
|
||||||
|
"[a-zA-Z_][a-zA-Z0-9_]*"
|
||||||
|
"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
|
||||||
|
"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
|
||||||
|
"|[^[:space:]]|[\x80-\xff]+"),
|
||||||
{ "default", NULL, -1, { NULL, 0 } },
|
{ "default", NULL, -1, { NULL, 0 } },
|
||||||
};
|
};
|
||||||
#undef PATTERNS
|
#undef PATTERNS
|
||||||
|
Loading…
Reference in New Issue
Block a user