Branch
Hash :
4049e5c6
Author :
Date :
2021-12-10T14:45:09
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
struct foo {}
let foo: CStr;
let foo: &'a CStr;
let foo: &'a Foo<dyn Bar>;
Option::Some(foo);
Option::None;
// we can differentiate between enum variants and class names
// so let's make the bug a feature!
enum Foo {
Const,
Tuple(i8,i8),
Struct {
foo: u8
}
}
pub trait Summary {
fn summarize(&self) -> String;
}
type Point = (u8, u8);
----------------------------------------------------
[
["keyword", "struct"],
["type-definition", "foo"],
["punctuation", "{"],
["punctuation", "}"],
["keyword", "let"],
" foo",
["punctuation", ":"],
["class-name", "CStr"],
["punctuation", ";"],
["keyword", "let"],
" foo",
["punctuation", ":"],
["operator", "&"],
["lifetime-annotation", "'a"],
["class-name", "CStr"],
["punctuation", ";"],
["keyword", "let"],
" foo",
["punctuation", ":"],
["operator", "&"],
["lifetime-annotation", "'a"],
["class-name", "Foo"],
["operator", "<"],
["keyword", "dyn"],
["class-name", "Bar"],
["operator", ">"],
["punctuation", ";"],
["class-name", "Option"],
["punctuation", "::"],
["class-name", "Some"],
["punctuation", "("],
"foo",
["punctuation", ")"],
["punctuation", ";"],
["class-name", "Option"],
["punctuation", "::"],
["class-name", "None"],
["punctuation", ";"],
["comment", "// we can differentiate between enum variants and class names"],
["comment", "// so let's make the bug a feature!"],
["keyword", "enum"],
["type-definition", "Foo"],
["punctuation", "{"],
["class-name", "Const"],
["punctuation", ","],
["class-name", "Tuple"],
["punctuation", "("],
["keyword", "i8"],
["punctuation", ","],
["keyword", "i8"],
["punctuation", ")"],
["punctuation", ","],
["class-name", "Struct"],
["punctuation", "{"],
"\r\n\t\tfoo",
["punctuation", ":"],
["keyword", "u8"],
["punctuation", "}"],
["punctuation", "}"],
["keyword", "pub"],
["keyword", "trait"],
["type-definition", "Summary"],
["punctuation", "{"],
["keyword", "fn"],
["function-definition", "summarize"],
["punctuation", "("],
["operator", "&"],
["keyword", "self"],
["punctuation", ")"],
["punctuation", "->"],
["class-name", "String"],
["punctuation", ";"],
["punctuation", "}"],
["keyword", "type"],
["type-definition", "Point"],
["operator", "="],
["punctuation", "("],
["keyword", "u8"],
["punctuation", ","],
["keyword", "u8"],
["punctuation", ")"],
["punctuation", ";"]
]
----------------------------------------------------
Checks for class names and enum variants.