Debian Codegraph @

runtime/syntax/go.yaml

raw
1 filetype: go
2
3 detect:
4 filename: "\\.go$"
5
6 rules:
7 # Conditionals and control flow
8 - special: "\\b(break|case|continue|default|go|goto|range|return|println|fallthrough)\\b"
9 - statement: "\\b(else|for|if|switch|select)\\b"
10 - preproc: "\\b(package|import|const|var|type|struct|func|defer|iota|make|new|copy|len|cap|panic|append|close|delete|print|recover)\\b"
11 - symbol.operator: "[-+/*=<>!~%&|^]|:="
12
13 # Types
14 - symbol: "(,|\\.)"
15 - type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b"
16 - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b"
17 - type.keyword: "\\b(struct)\\b"
18 - constant.bool: "\\b(true|false|nil)\\b"
19
20 # Brackets
21 - symbol.brackets: "(\\{|\\})"
22 - symbol.brackets: "(\\(|\\))"
23 - symbol.brackets: "(\\[|\\])"
24
25 # Numbers and strings
26 - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
27
28 - constant.string:
29 start: "\""
30 end: "\""
31 skip: "\\\\."
32 rules:
33 - constant.specialChar: "%."
34 - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
35 - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
36
37 - constant.string:
38 start: "'"
39 end: "'"
40 skip: "\\\\."
41 rules:
42 - error: "..+"
43 - constant.specialChar: "%."
44 - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
45 - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
46
47 - constant.string:
48 start: "`"
49 end: "`"
50 rules: []
51
52 - comment:
53 start: "//"
54 end: "$"
55 rules:
56 - todo: "(TODO|XXX|FIXME):?"
57
58 - comment:
59 start: "/\\*"
60 end: "\\*/"
61 rules:
62 - todo: "(TODO|XXX|FIXME):?"