kotlin_poet_rs/tokens/
mod.rs

1#![doc = include_str!("README.md")]
2
3// SPACES
4
5/// Empty string
6pub const EMPTY: &str = "";
7/// Single space
8pub const SPACE: &str = " ";
9/// New line string
10pub const NEW_LINE: &str = "\n";
11/// New line character
12pub const NEW_LINE_CH: char = '\n';
13/// Default indentation value
14pub const INDENT: &str = "    ";
15
16// SYMBOLS
17/// '.' used to separate qualifiers
18pub const DOT: &str = ".";
19/// '*' symbol used for star projections
20pub const STAR: &str = "*";
21/// ':' separates parameter / property name and type
22pub const COLON: &str = ":";
23/// `=` assign operator
24pub const ASSIGN: &str = "=";
25/// ',' separates list of values
26pub const COMMA: &str = ",";
27/// ';' denotes statement end
28pub const SEMICOLON: &str = ";";
29/// '?' denotes nullability
30pub const QUESTION_MARK: &str = "?";
31/// `@` used as annotation prefix
32pub const AT: &str = "@";
33/// '`' used to escape non JVM compatible identifiers
34pub const TICK: &str = "`";
35/// `<` start of generic parameters
36pub const ANGLE_BRACKET_LEFT: &str = "<";
37/// `>` end of generic parameters
38pub const ANGLE_BRACKET_RIGHT: &str = ">";
39/// '->' separates lambda arguments from body
40pub const ARROW: &str = "->";
41/// '{' opens new scopes and lambda body
42pub const CURLY_BRACKET_LEFT: &str = "{";
43/// '}' closes scopes and lambda body
44pub const CURLY_BRACKET_RIGHT: &str = "}";
45/// '(' opens parameter / argument lists
46pub const ROUND_BRACKET_LEFT: &str = "(";
47/// ')' opens parameter / argument lists
48pub const ROUND_BRACKET_RIGHT: &str = ")";
49
50// Special variables
51
52/// 'value' special argument inside property's `set(value) {...}` and `get() {...}`
53pub const CONV_VAR_VALUE: &str = "value";
54/// 'filed' special variable inside property's `set(value) {...}` and `get() {...}`
55pub const CONV_VAR_FIELD: &str = "field";
56
57
58// CATEGORY
59pub const NAME_ESCAPED_TOKENS: &str = " -!\"#$%^&()*+,-=?@^_{|}~";
60pub const NAME_DISALLOWED_TOKENS: &str = ".:/\\[]<>";
61
62// Comments
63
64/// '//' used to start single line comments
65pub const INLINE_COMMENT_START: &str = "//";
66
67/// '/*' used to start block comments
68pub const BLOCK_COMMENT_START: &str = "/*";
69/// ' *' used in middle of block comments
70pub const BLOCK_COMMENT_MIDDLE: &str = " *";
71/// ' */' used to e end block comments
72pub const BLOCK_COMMENT_END: &str = " */";
73
74/// '/**' used to start kdoc comments
75pub const KDOC_COMMENT_START: &str = "/**";
76/// ' *' used in middle of kdoc comments
77pub const KDOC_COMMENT_MIDDLE: &str = " *";
78/// ' */' used to end kdoc comments
79pub const KDOC_COMMENT_END: &str = " */";
80
81pub mod keyword {
82    pub const CLASS: &str = "class";
83    /// 'this' keyword, refers to current context parameter or parent constructor
84    pub const THIS: &str = "this";
85    pub const AS: &str = "as";
86    pub const OPERATOR: &str = "operator";
87    pub const INLINE: &str = "inline";
88    pub const OVERRIDE: &str = "override";
89    pub const SUSPEND: &str = "suspend";
90    pub const SET: &str = "set";
91    pub const GET: &str = "get";
92    pub const PACKAGE: &str = "package";
93    pub const TYPEALIAS: &str = "typealias";
94    pub const FUN: &str = "fun";
95    pub const VAL: &str = "val";
96    pub const VAR: &str = "var";
97    pub const PUBLIC: &str = "public";
98    pub const INTERNAL: &str = "internal";
99    pub const PRIVATE: &str = "private";
100    pub const PROTECTED: &str = "protected";
101    pub const OPEN: &str = "open";
102    pub const SEALED: &str = "sealed";
103    pub const OBJECT: &str = "object";
104    pub const ENUM: &str = "enum";
105    /// 'data' class keyword
106    pub const DATA: &str = "data";
107    pub const INTERFACE: &str = "interface";
108    pub const FINAL: &str = "final";
109    pub const ABSTRACT: &str = "abstract";
110    pub const IMPORT: &str = "import";
111    pub const CONST: &str = "const";
112    /// 'by' keyword
113    pub const BY: &str = "by";
114    /// 'constructor' keyword
115    pub const CONSTRUCTOR: &str = "constructor";
116    /// 'init' keyword, used for initializing class after constructor call
117    pub const INIT: &str = "init";
118    /// `companion`
119    pub const COMPANION: &str = "companion";
120    /// `inner`
121    pub const INNER: &str = "inner";
122
123    // Generics
124    pub const WHERE: &str = "where";
125    pub const IN: &str = "in";
126    pub const OUT: &str = "out";
127
128    // Annotation target
129    pub const FILE: &str = "file";
130    pub const PROPERTY: &str = "property";
131    pub const FIELD: &str = "field";
132    pub const RECEIVER: &str = "receiver";
133    pub const PARAM: &str = "param";
134    pub const SET_PARAM: &str = "setparam";
135    pub const DELEGATE: &str = "delegate";
136}