trunk/c.c: C# supports generics too, thankfully in a superficially similar way to C++ and Java.

trunk/Test/bug1515910.cs: extend a test case; the eponymous bug still isn't fixed, because it wants support for C# "where" clauses.

trunk/NEWS: report the good news.


git-svn-id: svn://svn.code.sf.net/p/ctags/code/trunk@652 c5d04d22-be80-434c-894e-aa346cc9e8e8
This commit is contained in:
elliotth 2008-03-29 22:36:53 +00:00
parent a567ea61ed
commit 075ea649c0
3 changed files with 20 additions and 1 deletions

1
NEWS
View File

@ -8,6 +8,7 @@ ctags-@VERSION@ (@DATE@)
* Fixed parsing of "else" [C#, Bug #1830344].
* Fixed parsing of derived enums [C#, Bug #1515910].
* Fixed parsing of "foreach" [C#, Bug #1830343].
* Fixed parsing of simple generic classes [C#, Bug #1515910].
* Fixed bug with detecting identifiers inside variables [Python, Bug #1809024].
* Fixed bug with detecting identifiers at the start of variables [Python, Bug #1856363].
* Fixed parsing of triple single-quoted multi-line strings [Python, Bug #1906062].

View File

@ -1,3 +1,15 @@
// Simple generic classes.
public class MyGenericClass1<T> { }
// Derived enums.
enum Enum1 : byte {
Value1, Values
}
// Verbatim strings.
public class C {
private string str1 = @"abc\";
private int int1 = 123;
private string str2 = @"abc\";
private string str3 = "abc";
}

8
c.c
View File

@ -2051,12 +2051,18 @@ static void analyzePostParens (statementInfo *const st, parenInfo *const info)
}
}
static boolean languageSupportsGenerics (void)
{
return (boolean) (isLanguage (Lang_cpp) || isLanguage (Lang_csharp) ||
isLanguage (Lang_java));
}
static void processAngleBracket (void)
{
int c = cppGetc ();
if (c == '>') {
/* already found match for template */
} else if ((isLanguage (Lang_cpp) || isLanguage (Lang_java)) && c != '<' && c != '=') {
} else if (languageSupportsGenerics () && c != '<' && c != '=') {
/* this is a template */
cppUngetc (c);
skipToMatch ("<>");