Skip to content

Commit

Permalink
C#: Fixed keywords in type lists blocking type names (#2277)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Mar 29, 2020
1 parent be909b1 commit 947a55b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 16 deletions.
1 change: 1 addition & 0 deletions components/prism-csharp.js
Expand Up @@ -246,6 +246,7 @@
'keyword': keywords,
'class-name': {
pattern: RegExp(typeExpression),
greedy: true,
inside: typeInside
},
'punctuation': /,/
Expand Down
2 changes: 1 addition & 1 deletion components/prism-csharp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions tests/languages/csharp/generic-constraint_feature.test
Expand Up @@ -44,6 +44,7 @@ readonly struct Foo<T> where T : unmanaged {}
]],
["punctuation", "{"],
["punctuation", "}"],

["keyword", "delegate"],
["return-type", [
["keyword", "void"]
Expand Down Expand Up @@ -76,6 +77,7 @@ readonly struct Foo<T> where T : unmanaged {}
]]
]],
["punctuation", ";"],

["keyword", "class"],
["class-name", [
"Foo",
Expand All @@ -88,14 +90,15 @@ readonly struct Foo<T> where T : unmanaged {}
["punctuation", ":"],
["type-list", [
["class-name", [
"IFoo"
]],
"<",
["keyword", "int"],
">"
"IFoo",
["punctuation", "<"],
["keyword", "int"],
["punctuation", ">"]
]]
]],
["punctuation", "{"],
["punctuation", "}"],

["keyword", "readonly"],
["keyword", "struct"],
["class-name", [
Expand Down
20 changes: 10 additions & 10 deletions tests/languages/csharp/preprocessor_feature.test
Expand Up @@ -18,18 +18,18 @@
["preprocessor", ["#", ["directive", "define"], " DEBUG"]],
["preprocessor", ["#", ["directive", "if"], " DEBUG"]],
["preprocessor", ["#", ["directive", "endif"]]],

["preprocessor", ["#", ["directive", "elif"]]],
["preprocessor", ["#", ["directive", "else"]]],
["preprocessor", ["#", ["directive", "endregion"]]],
["preprocessor", ["#", ["directive", "error"]]],
["preprocessor", ["#", ["directive", "line"]]],
["preprocessor", ["#", ["directive", "pragma"]]],
["preprocessor", ["#", ["directive", "region"]]],
["preprocessor", ["#", ["directive", "undef"]]],
["preprocessor", ["#", ["directive", "warning"]]]
["preprocessor", ["#", ["directive", "else"]]],
["preprocessor", ["#", ["directive", "endregion"]]],
["preprocessor", ["#", ["directive", "error"]]],
["preprocessor", ["#", ["directive", "line"]]],
["preprocessor", ["#", ["directive", "pragma"]]],
["preprocessor", ["#", ["directive", "region"]]],
["preprocessor", ["#", ["directive", "undef"]]],
["preprocessor", ["#", ["directive", "warning"]]]
]

----------------------------------------------------

Checks for preprocessor directives.
Checks for preprocessor directives.
19 changes: 19 additions & 0 deletions tests/languages/csharp/type-list_feature.test
@@ -1,6 +1,8 @@
class Foo<T> : Bar<IList<Bar>, T>, IBar<Bar, T>, IFoo
where T : class, IBar<IFoo>, IFoo<Bar> {}

public class Foo : IBar<int> {}

public delegate ErrorCode GetInfoMethod<H, A, I>(H handle, A value, I paramName,
Size_t paramValueSize, IntPtr paramValue, out Size_t paramValueSizeRet)
where H : unmanaged, IInfoHandle<A, I> where A : unmanaged where I : unmanaged, Enum;
Expand Down Expand Up @@ -65,6 +67,23 @@ public delegate ErrorCode GetInfoMethod<H, A, I>(H handle, A value, I paramName,
["punctuation", "{"],
["punctuation", "}"],

["keyword", "public"],
["keyword", "class"],
["class-name", [
"Foo"
]],
["punctuation", ":"],
["type-list", [
["class-name", [
"IBar",
["punctuation", "<"],
["keyword", "int"],
["punctuation", ">"]
]]
]],
["punctuation", "{"],
["punctuation", "}"],

["keyword", "public"],
["keyword", "delegate"],
["return-type", [
Expand Down

0 comments on commit 947a55b

Please sign in to comment.