]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/go.yaml
ede5555f7faff8891e5508dffc3192ad95214a37
[micro.git] / runtime / syntax / go.yaml
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)\\b"
9     - statement: "\\b(else|for|if|switch)\\b"
10     - preproc: "\\b(package|import|const|var|type|struct|func|go|defer|iota)\\b"
11     - symbol.operator: "[-+/*=<>!~%&|^]|:="
12
13       # Types
14     - special: "[a-zA-Z0-9]*\\("
15     - symbol: "(,|\\.)"
16     - type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b"
17     - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b"
18       ##I'm... not sure, but aren't structs a type?
19     - type.keyword: "\\b(struct)\\b"
20     - constant.bool: "\\b(true|false|nil)\\b"
21
22       # Brackets
23     - symbol.brackets: "(\\{|\\})"
24     - symbol.brackets: "(\\(|\\))"
25     - symbol.brackets: "(\\[|\\])"
26
27       # Numbers and strings
28     - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
29
30     - constant.string:
31         start: "\""
32         end: "(?<!\\\\)\""
33         rules:
34             - constant.specialChar: "%."
35             - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
36             - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
37
38     - constant.string:
39         start: "'"
40         end: "(?<!\\\\)'"
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):?"