Hash :
42b15463
Author :
Date :
2020-03-24T20:30:58
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
class Foo
interface BarBaz
struct Foo
enum Foo
class Foo<A, B>
interface Bar<out T>
// 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)),
};
----------------------------------------------------
[
["keyword", "class"],
["class-name", ["Foo"]],
["keyword", "interface"],
["class-name", ["BarBaz"]],
["keyword", "struct"],
["class-name", ["Foo"]],
["keyword", "enum"],
["class-name", ["Foo"]],
["keyword", "class"],
["class-name", [
"Foo",
["punctuation", "<"],
"A",
["punctuation", ","],
" B",
["punctuation", ">"]
]],
["keyword", "interface"],
["class-name", [
"Bar",
["punctuation", "<"],
["keyword", "out"],
" T",
["punctuation", ">"]
]],
["comment", "// not variables"],
["keyword", "public"],
["keyword", "static"],
["return-type", [
"RGBColor"
]],
["function", "FromRainbow"],
["punctuation", "("],
["class-name", [
"Rainbow"
]],
" colorBand",
["punctuation", ")"],
["operator", "=>"],
"\n\tcolorBand ",
["keyword", "switch"],
["punctuation", "{"],
"\n\t\tRainbow",
["punctuation", "."],
"Red ",
["operator", "=>"],
["keyword", "new"],
["constructor-invocation", [
"RGBColor"
]],
["punctuation", "("],
["number", "0xFF"],
["punctuation", ","],
["number", "0x00"],
["punctuation", ","],
["number", "0x00"],
["punctuation", ")"],
["punctuation", ","],
"\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", ";"]
]
----------------------------------------------------
Checks for class names at the class declaration.