Hash :
2f7f7364
Author :
Date :
2021-10-05T21:15:33
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
class Foo
interface BarBaz
struct Foo
enum Foo
record Foo
class Foo<A, B>
interface Bar<out T>
record Foo<A, B>
record TestData(string Name);
// not variables
public static RGBColor FromRainbow(Rainbow colorBand) =>
colorBand switch
{
Rainbow.Red => new RGBColor(0xFF, 0x00, 0x00),
_ => throw new ArgumentException(message: "invalid enum value", paramName: nameof(colorBand)),
};
try {} catch (ArgumentException e) {}
----------------------------------------------------
[
["keyword", "class"],
["class-name", ["Foo"]],
["keyword", "interface"],
["class-name", ["BarBaz"]],
["keyword", "struct"],
["class-name", ["Foo"]],
["keyword", "enum"],
["class-name", ["Foo"]],
["keyword", "record"],
["class-name", ["Foo"]],
["keyword", "class"],
["class-name", [
"Foo",
["punctuation", "<"],
"A",
["punctuation", ","],
" B",
["punctuation", ">"]
]],
["keyword", "interface"],
["class-name", [
"Bar",
["punctuation", "<"],
["keyword", "out"],
" T",
["punctuation", ">"]
]],
["keyword", "record"],
["class-name", [
"Foo",
["punctuation", "<"],
"A",
["punctuation", ","],
" B",
["punctuation", ">"]
]],
["keyword", "record"],
["class-name", ["TestData"]],
["punctuation", "("],
["class-name", [
["keyword", "string"]
]],
" Name",
["punctuation", ")"],
["punctuation", ";"],
["comment", "// not variables"],
["keyword", "public"],
["keyword", "static"],
["return-type", ["RGBColor"]],
["function", "FromRainbow"],
["punctuation", "("],
["class-name", ["Rainbow"]],
" colorBand",
["punctuation", ")"],
["operator", "=>"],
"\r\n\tcolorBand ",
["keyword", "switch"],
["punctuation", "{"],
"\r\n\t\tRainbow",
["punctuation", "."],
"Red ",
["operator", "=>"],
["keyword", "new"],
["constructor-invocation", ["RGBColor"]],
["punctuation", "("],
["number", "0xFF"],
["punctuation", ","],
["number", "0x00"],
["punctuation", ","],
["number", "0x00"],
["punctuation", ")"],
["punctuation", ","],
"\r\n\t\t_ ",
["operator", "=>"],
["keyword", "throw"],
["keyword", "new"],
["constructor-invocation", ["ArgumentException"]],
["punctuation", "("],
["named-parameter", "message"],
["punctuation", ":"],
["string", "\"invalid enum value\""],
["punctuation", ","],
["named-parameter", "paramName"],
["punctuation", ":"],
["keyword", "nameof"],
["punctuation", "("],
"colorBand",
["punctuation", ")"],
["punctuation", ")"],
["punctuation", ","],
["punctuation", "}"],
["punctuation", ";"],
["keyword", "try"],
["punctuation", "{"],
["punctuation", "}"],
["keyword", "catch"],
["punctuation", "("],
["class-name", ["ArgumentException"]],
" e",
["punctuation", ")"],
["punctuation", "{"],
["punctuation", "}"]
]
----------------------------------------------------
Checks for class names at the class declaration.