X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=runtime%2Fsyntax%2Fgo.yaml;h=fab3baa10fd47f71c6a5c3faee055b8a8242a78b;hb=a0a154d957ee2e2a94925b863674403ee483f61e;hp=e8c2a327022a2777fb792fa0990259578ac77d4a;hpb=1cd4b2c4dc45c8a58412d597fd82de46bcef5f8b;p=micro.git diff --git a/runtime/syntax/go.yaml b/runtime/syntax/go.yaml index e8c2a327..fab3baa1 100644 --- a/runtime/syntax/go.yaml +++ b/runtime/syntax/go.yaml @@ -4,49 +4,59 @@ detect: filename: "\\.go$" rules: - - statement: "\\b(break|case|continue|default|else|for|go|goto|if|range|return|switch)\\b" - - statement: "\\b(package|import|const|var|type|struct|func|go|defer|iota)\\b" - - statement: "[-+/*=<>!~%&|^]|:=" - - identifier: "[a-zA-Z0-9]*\\(" + # Conditionals and control flow + - special: "\\b(break|case|continue|default|go|goto|range|return)\\b" + - statement: "\\b(else|for|if|switch)\\b" + - preproc: "\\b(package|import|const|var|type|struct|func|go|defer|iota)\\b" + - symbol.operator: "[-+/*=<>!~%&|^]|:=" + + # Types + - symbol: "(,|\\.)" - type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b" - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b" - - constant: "\\b(true|false|nil)\\b" - - statement: "(\\{|\\})" - - statement: "(\\(|\\))" - - statement: "(\\[|\\])" - - statement: "!" - - statement: "," - - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b" - - constant.specialChar: "\\([0-7]{3|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" + - type.keyword: "\\b(struct)\\b" + - constant.bool: "\\b(true|false|nil)\\b" - - comment: - start: "//" - end: "$" - rules: - - todo: "(TODO|XXX|FIXME):?" + # Brackets + - symbol.brackets: "(\\{|\\})" + - symbol.brackets: "(\\(|\\))" + - symbol.brackets: "(\\[|\\])" - - comment: - start: "/\\*" - end: "\\*/" - rules: - - todo: "(TODO|XXX|FIXME):?" + # Numbers and strings + - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" - constant.string: start: "\"" end: "\"" + skip: "\\\\." rules: - - constant.specialChar: "\\\\." - constant.specialChar: "%." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" - constant.string: start: "'" end: "'" + skip: "\\\\." rules: - - preproc: "..+" + - error: "..+" - constant.specialChar: "%." - - constant.specialChar: "\\\\." + - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" + - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" - constant.string: start: "`" end: "`" rules: [] + + - comment: + start: "//" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?" + + - comment: + start: "/\\*" + end: "\\*/" + rules: + - todo: "(TODO|XXX|FIXME):?"