Debian Codegraph @

runtime/syntax/kotlin.yaml

raw
1 filetype: kotlin
2
3 detect:
4 filename: "\\.kts?$"
5
6 rules:
7
8 # Operators
9 - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&)
10
11 # Statements Keywords
12 - statement: \b(as|by|class|constructor|companion|const|fun|import|in|infix|interface|inline|is|out|operator|package|return|suspend|super|this|when|val|var)\b
13 - statement.properties: \b(get|set)\b
14 - statement.control: \b(break|continue|else|do|if|try|catch|finally|for|while)\b
15 - statement.class: \b(abstract|annotation|data|enum|final|open|sealed)\b
16 - statement.member: \b(override|lateinit|init)\b
17 - statement.access: \b(internal|private|protected|public)\b
18 - statement.parameter: \b(crossinline|noinline|reified|vararg)\b
19
20 # Expression and types
21 - type: \b(dynamic|object|throw|typealias)\b
22
23 # Meta
24 - statement.meta: \@(\bfile|delegate|field|get|property|receiver|set|setparam|param|)\b
25
26 # Constant
27 - constant: \b(true|false|null)
28 - constant.number: ([0-9]+)
29
30 # Storage Types
31 - type.storage: \b(Byte|UByte|Char|Double|Float|Int|UInt|Long|ULong|Short|UShort|Boolean|Unit|Nothing)\b
32
33 # Collections
34 - type.collections: \b(Array)\b
35
36 # String
37 - constant.string:
38 start: \"
39 end: \"
40 skip: \\.
41 rules:
42 - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\')
43 - constant.unicode: \\u\{[[:xdigit:]]+}
44
45 # Shebang Line
46 - comment.shebang: ^(#!).*
47
48 # Line Comment
49 - comment.line: "//.*"
50
51 # Block Comment
52 - comment.block:
53 start: "/\\*"
54 end: "\\*/"
55 rules:
56 - todo: "(TODO|XXX|FIXME):?"
57
58 # Doc Block Comment
59 - comment.block:
60 start: "/\\*\\*"
61 end: "\\*/"
62 rules:
63 - todo: "(TODO|XXX|FIXME):?"
64
65 # Todo
66 - todo: "(TODO|XXX|FIXME):?"