Skip to content

Commit a0b6a9d

Browse files
committed
Merge branch 'po/userdiff-csharp'
* po/userdiff-csharp: Userdiff patterns for C#
2 parents bb8634b + b221207 commit a0b6a9d

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Documentation/gitattributes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ patterns are available:
441441

442442
- `cpp` suitable for source code in the C and C++ languages.
443443

444+
- `csharp` suitable for source code in the C# language.
445+
444446
- `html` suitable for HTML/XHTML documents.
445447

446448
- `java` suitable for source code in the Java language.

t/t4018-diff-funcname.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ EOF
3232

3333
sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
3434

35-
builtin_patterns="bibtex cpp html java objc pascal php python ruby tex"
35+
builtin_patterns="bibtex cpp csharp html java objc pascal php python ruby tex"
3636
for p in $builtin_patterns
3737
do
3838
test_expect_success "builtin $p pattern compiles" '

userdiff.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,22 @@ PATTERNS("cpp",
8282
"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
8383
"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
8484
"|[^[:space:]]|[\x80-\xff]+"),
85+
PATTERNS("csharp",
86+
/* Keywords */
87+
"!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
88+
/* Methods and constructors */
89+
"^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
90+
/* Properties */
91+
"^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
92+
/* Type definitions */
93+
"^[ \t]*(((static|public|internal|private|protected|new|unsafe|sealed|abstract|partial)[ \t]+)*(class|enum|interface|struct)[ \t]+.*)$\n"
94+
/* Namespace */
95+
"^[ \t]*(namespace[ \t]+.*)$",
96+
/* -- */
97+
"[a-zA-Z_][a-zA-Z0-9_]*"
98+
"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
99+
"|[-+*/<>%&^|=!]=|--|\\+\\+|<<=?|>>=?|&&|\\|\\||::|->"
100+
"|[^[:space:]]|[\x80-\xff]+"),
85101
{ "default", NULL, -1, { NULL, 0 } },
86102
};
87103
#undef PATTERNS

0 commit comments

Comments
 (0)