package g import ( . "github.com/alecthomas/chroma" // nolint "github.com/alecthomas/chroma/lexers/internal" ) // GDScript lexer. var GDScript = internal.Register(MustNewLexer( &Config{ Name: "GDScript", Aliases: []string{"gdscript", "gd"}, Filenames: []string{"*.gd"}, MimeTypes: []string{"text/x-gdscript", "application/x-gdscript"}, }, Rules{ "root": { {`\n`, Text, nil}, {`^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil}, {`^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil}, {`[^\S\n]+`, Text, nil}, {`#.*$`, CommentSingle, nil}, {`[]{}:(),;[]`, Punctuation, nil}, {`\\\n`, Text, nil}, {`\\`, Text, nil}, {`(in|and|or|not)\b`, OperatorWord, nil}, {`!=|==|<<|>>|&&|\+=|-=|\*=|/=|%=|&=|\|=|\|\||[-~+/*%=<>&^.!|$]`, Operator, nil}, Include("keywords"), {`(def)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("funcname")}, {`(class)((?:\s|\\\s)+)`, ByGroups(Keyword, Text), Push("classname")}, Include("builtins"), {`([rR]|[uUbB][rR]|[rR][uUbB])(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("tdqs")}, {`([rR]|[uUbB][rR]|[rR][uUbB])(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("tsqs")}, {`([rR]|[uUbB][rR]|[rR][uUbB])(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("dqs")}, {`([rR]|[uUbB][rR]|[rR][uUbB])(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("sqs")}, {`([uUbB]?)(""")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "tdqs")}, {`([uUbB]?)(''')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "tsqs")}, {`([uUbB]?)(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Combined("stringescape", "dqs")}, {`([uUbB]?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Combined("stringescape", "sqs")}, Include("name"), Include("numbers"), }, "keywords": { {Words(``, `\b`, `if`, `elif`, `else`, `for`, `do`, `while`, `switch`, `case`, `break`, `continue`, `pass`, `return`, `class`, `extends`, `tool`, `signal`, `func`, `static`, `const`, `enum`, `var`, `onready`, `export`, `setget`, `breakpoint`), Keyword, nil}, }, "builtins": { {Words(`(?