From d6cbf65251c9a7b0c6376f67722fc5c3e6c62757 Mon Sep 17 00:00:00 2001 From: Happy-Ferret Date: Mon, 2 May 2022 04:30:21 +0200 Subject: [PATCH] Add Go support Initial naive Go language syntax highlighting as of Go 1.18 Based on https://go.dev/ref/spec#Lexical_elements --- Languages/Go.ildf | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Languages/Go.ildf diff --git a/Languages/Go.ildf b/Languages/Go.ildf new file mode 100644 index 00000000..7210222d --- /dev/null +++ b/Languages/Go.ildf @@ -0,0 +1,61 @@ +Name: "Go" +Details: "The Go programming language" +Extension: ".go" +Multiline Comment Open: "/*" +Multiline Comment Close: "*/" +Line Comment: "//" +String Literal: "\"" +String Literal Escape: "\\" +Character Literal: "'" +Character Literal Escape: "\\" +C-Like: true + +Octal Literal Prefix: "0" +Hexadecimal Literal Prefix: "0x" +Binary Literal Prefix: "0b" +Negative Literal Prefix: "-" + +Before Named Paragraph Expansion: "{\n" +After Named Paragraph Expansion: "}\n" + +keyword break +keyword case +keyword chan +keyword const +keyword continue +keyword default +keyword defer +keyword else +keyword fallthrough +keyword for +keyword func +keyword go +keyword goto +keyword if +keyword import +keyword interface +# "Hack": We define main as a keyword to avoid automatic hyperlinks when package and func are both "main". +keyword main +keyword map +keyword package +keyword range +keyword return +keyword select +keyword struct +keyword switch +keyword type +keyword var + +colouring { + runs of unquoted { + runs of !identifier { + keyword of !reserved => !reserved + keyword of !function => !function + keyword of !constant => !constant + keyword of !element => { + optionally spaced prefix . => !element + optionally spaced prefix -> => !element + } + } + } +}