summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/alecthomas/chroma/lexers/c
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2024-01-13 19:26:26 +1100
committerJesse Duffield <jessedduffield@gmail.com>2024-01-13 19:26:26 +1100
commit3a191b913fb11826b0f54e3051767f6c7dd388c8 (patch)
treece91bdd0b7c0115ce770ce24571eb6fa49c8d55a /vendor/github.com/alecthomas/chroma/lexers/c
parente9962b98a761a054b9ba8c042904d8e5572e59be (diff)
Add release notes popup after updaterelease-notes
We're using glamour for rendering the markdown, and I'm interested in using it in other places too
Diffstat (limited to 'vendor/github.com/alecthomas/chroma/lexers/c')
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/c.go96
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/caddyfile.go216
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go65
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go67
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go60
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go67
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go41
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/cl.go310
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/clojure.go42
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/cmake.go48
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/cobol.go55
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/coffee.go95
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/coldfusion.go52
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/coq.go67
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/cpp.go110
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/cql.go74
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/crystal.go266
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/csharp.go56
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/css.go121
-rw-r--r--vendor/github.com/alecthomas/chroma/lexers/c/cython.go139
20 files changed, 2047 insertions, 0 deletions
diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/c.go b/vendor/github.com/alecthomas/chroma/lexers/c/c.go
new file mode 100644
index 000000000..3698c4f29
--- /dev/null
+++ b/vendor/github.com/alecthomas/chroma/lexers/c/c.go
@@ -0,0 +1,96 @@
+package c
+
+import (
+ . "github.com/alecthomas/chroma" // nolint
+ "github.com/alecthomas/chroma/lexers/internal"
+)
+
+// C lexer.
+var C = internal.Register(MustNewLazyLexer(
+ &Config{
+ Name: "C",
+ Aliases: []string{"c"},
+ Filenames: []string{"*.c", "*.h", "*.idc", "*.x[bp]m"},
+ MimeTypes: []string{"text/x-chdr", "text/x-csrc", "image/x-xbitmap", "image/x-xpixmap"},
+ EnsureNL: true,
+ },
+ cRules,
+))
+
+func cRules() Rules {
+ return Rules{
+ "whitespace": {
+ {`^#if\s+0`, CommentPreproc, Push("if0")},
+ {`^#`, CommentPreproc, Push("macro")},
+ {`^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("if0")},
+ {`^(\s*(?:/[*].*?[*]/\s*)?)(#)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("macro")},
+ {`\n`, Text, nil},
+ {`\s+`, Text, nil},
+ {`\\\n`, Text, nil},
+ {`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil},
+ {`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil},
+ {`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil},
+ },
+ "statements": {
+ {`(L?)(")`, ByGroups(LiteralStringAffix, LiteralString), Push("string")},
+ {`(L?)(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')`, ByGroups(LiteralStringAffix, LiteralStringChar, LiteralStringChar, LiteralStringChar), nil},
+ {`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*`, LiteralNumberFloat, nil},
+ {`(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil},
+ {`0x[0-9a-fA-F]+[LlUu]*`, LiteralNumberHex, nil},
+ {`0[0-7]+[LlUu]*`, LiteralNumberOct, nil},
+ {`\d+[LlUu]*`, LiteralNumberInteger, nil},
+ {`\*/`, Error, nil},
+ {`[~!%^&*+=|?:<>/-]`, Operator, nil},
+ {`[()\[\],.]`, Punctuation, nil},
+ {Words(``, `\b`, `asm`, `auto`, `break`, `case`, `const`, `continue`, `default`, `do`, `else`, `enum`, `extern`, `for`, `goto`, `if`, `register`, `restricted`, `return`, `sizeof`, `static`, `struct`, `switch`, `typedef`, `union`, `volatile`, `while`), Keyword, nil},
+ {`(bool|int|long|float|short|double|char((8|16|32)_t)?|unsigned|signed|void|u?int(_fast|_least|)(8|16|32|64)_t)\b`, KeywordType, nil},
+ {Words(``, `\b`, `inline`, `_inline`, `__inline`, `naked`, `restrict`, `thread`, `typename`), KeywordReserved, nil},
+ {`(__m(128i|128d|128|64))\b`, KeywordReserved, nil},
+ {Words(`__`, `\b`, `asm`, `int8`, `based`, `except`, `int16`, `stdcall`, `cdecl`, `fastcall`, `int32`, `declspec`, `finally`, `int64`, `try`, `leave`, `wchar_t`, `w64`, `unaligned`, `raise`, `noop`, `identifier`, `forceinline`, `assume`), KeywordReserved, nil},
+ {`(true|false|NULL)\b`, NameBuiltin, nil},
+ {`([a-zA-Z_]\w*)(\s*)(:)(?!:)`, ByGroups(NameLabel, Text, Punctuation), nil},
+ {`[a-zA-Z_]\w*`, Name, nil},
+ },
+ "root": {
+ Include("whitespace"),
+ {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), Push("function")},
+ {`((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)`, ByGroups(UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), nil},
+ Default(Push("statement")),
+ },
+ "statement": {
+ Include("whitespace"),
+ Include("statements"),
+ {`[{}]`, Punctuation, nil},
+ {`;`, Punctuation, Pop(1)},
+ },
+ "function": {
+ Include("whitespace"),
+ Include("statements"),
+ {`;`, Punctuation, nil},
+ {`\{`, Punctuation, Push()},
+ {`\}`, Punctuation, Pop(1)},
+ },
+ "string": {
+ {`"`, LiteralString, Pop(1)},
+ {`\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})`, LiteralStringEscape, nil},
+ {`[^\\"\n]+`, LiteralString, nil},
+ {`\\\n`, LiteralString, nil},
+ {`\\`, LiteralString, nil},
+ },
+ "macro": {
+ {`(include)(\s*(?:/[*].*?[*]/\s*)?)([^\n]+)`, ByGroups(CommentPreproc, Text, CommentPreprocFile), nil},
+ {`[^/\n]+`, CommentPreproc, nil},
+ {`/[*](.|\n)*?[*]/`, CommentMultiline, nil},
+ {`//.*?\n`, CommentSingle, Pop(1)},
+ {`/`, CommentPreproc, nil},
+ {`(?<=\\)\n`, CommentPreproc, nil},
+ {`\n`, CommentPreproc, Pop(1)},
+ },
+ "if0": {
+ {`^\s*#if.*?(?<!\\)\n`, CommentPreproc, Push()},
+ {`^\s*#el(?:se|if).*\n`, CommentPreproc, Pop(1)},
+ {`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
+ {`.*?\n`, Comment, nil},
+ },
+ }
+}
diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/caddyfile.go b/vendor/github.com/alecthomas/chroma/lexers/c/caddyfile.go
new file mode 100644
index 000000000..765947aac
--- /dev/null
+++ b/vendor/github.com/alecthomas/chroma/lexers/c/caddyfile.go
@@ -0,0 +1,216 @@
+package c
+
+import (
+ . "github.com/alecthomas/chroma" // nolint
+ "github.com/alecthomas/chroma/lexers/internal"
+)
+
+// caddyfileCommon are the rules common to both of the lexer variants
+func caddyfileCommonRules() Rules {
+ return Rules{
+ "site_block_common": {
+ // Import keyword
+ {`(import)(\s+)([^\s]+)`, ByGroups(Keyword, Text, NameVariableMagic), nil},
+ // Matcher definition
+ {`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
+ // Matcher token stub for docs
+ {`\[\<matcher\>\]`, NameDecorator, Push("matcher")},
+ // These cannot have matchers but may have things that look like
+ // matchers in their arguments, so we just parse as a subdirective.
+ {`try_files`, Keyword, Push("subdirective")},
+ // These are special, they can nest more directives
+ {`handle_errors|handle|route|handle_path|not`, Keyword, Push("nested_directive")},
+ // Any other directive
+ {`[^\s#]+`, Keyword, Push("directive")},
+ Include("base"),
+ },
+ "matcher": {
+ {`\{`, Punctuation, Push("block")},
+ // Not can be one-liner
+ {`not`, Keyword, Push("deep_not_matcher")},
+ // Any other same-line matcher
+ {`[^\s#]+`, Keyword, Push("arguments")},
+ // Terminators
+ {`\n`, Text, Pop(1)},
+ {`\}`, Punctuation, Pop(1)},
+ Include("base"),
+ },
+ "block": {
+ {`\}`, Punctuation, Pop(2)},
+ // Not can be one-liner
+ {`not`, Keyword, Push("not_matcher")},
+ // Any other subdirective
+ {`[^\s#]+`, Keyword, Push("subdirective")},
+ Include("base"),
+ },
+ "nested_block": {
+ {`\}`, Punctuation, Pop(2)},
+ // Matcher definition
+ {`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
+ // Something that starts with literally < is probably a docs stub
+ {`\<[^#]+\>`, Keyword, Push("nested_directive")},
+ // Any other directive
+ {`[^\s#]+`, Keyword, Push("nested_directive")},
+ Include("base"),
+ },
+ "not_matcher": {
+ {`\}`, Punctuation, Pop(2)},
+ {`\{(?=\s)`, Punctuation, Push("block")},
+ {`[^\s#]+`, Keyword, Push("arguments")},
+ {`\s+`, Text, nil},
+ },
+ "deep_not_matcher": {
+ {`\}`, Punctuation, Pop(2)},
+ {`\{(?=\s)`, Punctuation, Push("block")},
+ {`[^\s#]+`, Keyword, Push("deep_subdirective")},
+ {`\s+`, Text, nil},
+ },
+ "directive": {
+ {`\{(?=\s)`, Punctuation, Push("block")},
+ Include("matcher_token"),
+ Include("comments_pop_1"),
+ {`\n`, Text, Pop(1)},
+ Include("base"),
+ },
+ "nested_directive": {
+ {`\{(?=\s)`, Punctuation, Push("nested_block")},
+ Include("matcher_token"),
+ Include("comments_pop_1"),
+ {`\n`, Text, Pop(1)},
+ Include("base"),
+ },
+ "subdirective": {
+ {`\{(?=\s)`, Punctuation, Push("block")},
+ Include("comments_pop_1"),
+ {`\n`, Text, Pop(1)},
+ Include("base"),
+ },
+ "arguments": {
+ {`\{(?=\s)`, Punctuation, Push("block")},
+ Include("comments_pop_2"),
+ {`\\\n`, Text, nil}, // Skip escaped newlines
+ {`\n`, Text, Pop(2)},
+ Include("base"),
+ },
+ "deep_subdirective": {
+ {`\{(?=\s)`, Punctuation, Push("block")},
+ Include("comments_pop_3"),
+ {`\n`, Text, Pop(3)},
+ Include("base"),
+ },
+ "matcher_token": {
+ {`@[^\s]+`, NameDecorator, Push("arguments")}, // Named matcher
+ {`/[^\s]+`, NameDecorator, Push("arguments")}, // Path matcher
+ {`\*`, NameDecorator, Push("arguments")}, // Wildcard path matcher
+ {`\[\<matcher\>\]`, NameDecorator, Push("arguments")}, // Matcher token stub for docs
+ },
+ "comments": {
+ {`^#.*\n`, CommentSingle, nil}, // Comment at start of line
+ {`\s+#.*\n`, CommentSingle, nil}, // Comment preceded by whitespace
+ },
+ "comments_pop_1": {
+ {`^#.*\n`, CommentSingle, Pop(1)}, // Comment at start of line
+ {`\s+#.*\n`, CommentSingle, Pop(1)}, // Comment preceded by whitespace
+ },
+ "comments_pop_2": {
+ {`^#.*\n`, CommentSingle, Pop(2)}, // Comment at start of line
+ {`\s+#.*\n`, CommentSingle, Pop(2)}, // Comment preceded by whitespace
+ },
+ "comments_pop_3": {
+ {`^#.*\n`, CommentSingle, Pop(3)}, // Comment at start of line
+ {`\s+#.*\n`, CommentSingle, Pop(3)}, // Comment preceded by whitespace
+ },
+ "base": {
+ Include("comments"),
+ {`(on|off|first|last|before|after|internal|strip_prefix|strip_suffix|replace)\b`, NameConstant, nil},
+ {`(https?://)?([a-z0-9.-]+)(:)([0-9]+)`, ByGroups(Name, Name, Punctuation, LiteralNumberInteger), nil},
+ {`[a-z-]+/[a-z-+]+`, LiteralString, nil},
+ {`[0-9]+[km]?\b`, LiteralNumberInteger, nil},
+ {`\{[\w+.\$-]+\}`, LiteralStringEscape, nil}, // Placeholder
+ {`\[(?=[^#{}$]+\])`, Punctuation, nil},
+ {`\]|\|`, Punctuation, nil},
+ {`[^\s#{}$\]]+`, LiteralString, nil},
+ {`/[^\s#]*`, Name, nil},
+ {`\s+`, Text, nil},
+ },
+ }
+}
+
+// Caddyfile lexer.
+var Caddyfile = internal.Register(MustNewLazyLexer(
+ &Config{
+ Name: "Caddyfile",
+ Aliases: []string{"caddyfile", "caddy"},
+ Filenames: []string{"Caddyfile*"},
+ MimeTypes: []string{},
+ },
+ caddyfileRules,
+))
+
+func caddyfileRules() Rules {
+ return Rules{
+ "root": {
+ Include("comments"),
+ // Global options block
+ {`^\s*(\{)\s*$`, ByGroups(Punctuation), Push("globals")},
+ // Snippets
+ {`(\([^\s#]+\))(\s*)(\{)`, ByGroups(NameVariableAnonymous, Text, Punctuation), Push("snippet")},
+ // Site label
+ {`[^#{(\s,]+`, GenericHeading, Push("label")},
+ // Site label with placeholder
+ {`\{[\w+.\$-]+\}`, LiteralStringEscape, Push("label")},
+ {`\s+`, Text, nil},
+ },
+ "globals": {
+ {`\}`, Punctuation, Pop(1)},
+ {`[^\s#]+`, Keyword, Push("directive")},
+ Include("base"),
+ },
+ "snippet": {
+ {`\}`, Punctuation, Pop(1)},
+ // Matcher definition
+ {`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
+ // Any directive
+ {`[^\s#]+`, Keyword, Push("directive")},
+ Include("base"),
+ },
+ "label": {
+ // Allow multiple labels, comma separated, newlines after
+ // a comma means another label is coming
+ {`,\s*\n?`, Text, nil},
+ {` `, Text, nil},
+ // Site label with placeholder
+ {`\{[\w+.\$-]+\}`, LiteralStringEscape, nil},
+ // Site label
+ {`[^#{(\s,]+`, GenericHeading, nil},
+ // Comment after non-block label (hack because comments end in \n)
+ {`#.*\n`, CommentSingle, Push("site_block")},
+ // Note: if \n, we'll never pop out of the site_block, it's valid
+ {`\{(?=\s)|\n`, Punctuation, Push("site_block")},
+ },
+ "site_block": {
+ {`\}`, Punctuation, Pop(2)},
+ Include("site_block_common"),
+ },
+ }.Merge(caddyfileCommonRules())
+}
+
+// Caddyfile directive-only lexer.
+var CaddyfileDirectives = internal.Register(MustNewLazyLexer(
+ &Config{
+ Name: "Caddyfile Directives",
+ Aliases: []string{"caddyfile-directives", "caddyfile-d", "caddy-d"},
+ Filenames: []string{},
+ MimeTypes: []string{},
+ },
+ caddyfileDirectivesRules,
+))
+
+func caddyfileDirectivesRules() Rules {
+ return Rules{
+ // Same as "site_block" in Caddyfile
+ "root": {
+ Include("site_block_common"),
+ },
+ }.Merge(caddyfileCommonRules())
+}
diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go b/vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go
new file mode 100644
index 000000000..ec0d892c0
--- /dev/null
+++ b/vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go
@@ -0,0 +1,65 @@
+package c
+
+import (
+ . "github.com/alecthomas/chroma" // nolint
+ "github.com/alecthomas/chroma/lexers/internal"
+)
+
+// Cap'N'Proto Proto lexer.
+var CapNProto = internal.Register(MustNewLazyLexer(
+ &Config{
+ Name: "Cap'n Proto",
+ Aliases: []string{"capnp"},
+ Filenames: []string{"*.capnp"},
+ MimeTypes: []string{},
+ },
+ capNProtoRules,
+))
+
+func capNProtoRules() Rules {
+ return Rules{
+ "root": {
+ {`#.*?$`, CommentSingle, nil},
+ {`@[0-9a-zA-Z]*`, NameDecorator, nil},
+ {`=`, Literal, Push("expression")},
+ {`:`, NameClass, Push("type")},
+ {`\$`, NameAttribute, Push("annotation")},
+ {`(struct|enum|interface|union|import|using|const|annotation|extends|in|of|on|as|with|from|fixed)\b`, Keyword, nil},
+ {`[\w.]+`, Name, nil},
+ {`[^#@=:$\w]+`, Text, nil},
+ },
+ "type": {
+ {`[^][=;,(){}$]+`, NameClass, nil},
+ {`[[(]`, NameClass, Push("parentype")},
+ Default(Pop(1)),
+ },
+ "parentype": {
+ {`[^][;()]+`, NameClass, nil},
+ {`[[(]`, NameClass, Push()},
+ {`[])]`, NameClass, Pop(1)},
+ Default(Pop(1)),
+ },
+ "expression": {
+ {`[^][;,(){}$]+`, Literal, nil},
+ {`[[(]`, Literal, Push("parenexp")},
+ Default(Pop(1)),
+ },
+ "parenexp": {
+ {`[^][;()]+`, Literal, nil},
+ {`[[(]`, Literal, Push()},
+ {`[])]`, Literal, Pop(1)},
+ Default(Pop(1)),
+ },
+ "annotation": {
+ {`[^][;,(){}=:]+`, NameAttribute, nil},
+ {`[[(]`, NameAttribute, Push("annexp")},
+ Default(Pop(1)),
+ },
+ "annexp": {
+ {`[^][;()]+`, NameAttribute, nil},
+ {`[[(]`, NameAttribute, Push()},
+ {`[])]`, NameAttribute, Pop(1)},
+ Default(Pop(1)),
+ },
+ }
+}
diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go b/vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go
new file mode 100644
index 000000000..9d424d4b2
--- /dev/null
+++ b/vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go
@@ -0,0 +1,67 @@
+package c
+
+import (
+ . "github.com/alecthomas/chroma" // nolint
+ "github.com/alecthomas/chroma/lexers/internal"
+)
+
+// Ceylon lexer.
+var Ceylon = internal.Register(MustNewLazyLexer(
+ &Config{
+ Name: "Ceylon",
+ Aliases: []string{"ceylon"},
+ Filenames: []string{"*.ceylon"},
+ MimeTypes: []string{"text/x-ceylon"},
+ DotAll: true,
+ },
+ ceylonRules,
+))
+
+func ceylonRules() Rules {
+ return Rules{
+ "root": {
+ {`^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil},
+ {`[^\S\n]+`, Text, nil},
+ {`//.*?\n`, CommentSingle, nil},
+ {`/\*`, CommentMultiline, Push("comment")},
+ {`(shared|abstract|formal|default|actual|variable|deprecated|small|late|literal|doc|by|see|throws|optional|license|tagged|final|native|annotation|sealed)\b`, NameDecorator, nil},
+ {`(break|case|catch|continue|else|finally|for|in|if|return|switch|this|throw|try|while|is|exists|dynamic|nonempty|then|outer|assert|let)\b`, Keyword, nil},
+ {`(abstracts|extends|satisfies|super|given|of|out|assign)\b`, KeywordDeclaration, nil},
+ {`(function|value|void|new)\b`, KeywordType, nil},
+ {`(assembly|module|package)(\s+)`, ByGroups(KeywordNamespace, Text), nil},
+ {`(true|false|null)\b`, KeywordConstant, nil},
+ {`(class|interface|object|alias)(\s+)`, ByGroups(KeywordDeclaration, Text), Push("class")},
+ {`(import)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")},
+ {`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
+ {`'\\.'|'[^\\]'|'\\\{#[0-9a-fA-F]{4}\}'`, LiteralStringChar, nil},
+ {"\".*``.*``.*\"", LiteralStringInterpol, nil},
+ {`(\.)([a-z_]\w*)`, ByGroups(Operator, NameAttribute), nil},
+ {`[a-zA-Z_]\w*:`, NameLabel, nil},
+ {`[a-zA-Z_]\w*`, Name, nil},
+ {`[~^*!%&\[\](){}<>|+=:;,./?-]`, Operator, nil},
+ {`\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?`, LiteralNumberFloat, nil},
+ {`\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?`, LiteralNumberFloat, nil},
+ {`[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?`, LiteralNumberFloat, nil},
+ {`[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?`, LiteralNumberFloat, nil},
+ {`#([0-9a-fA-F]{4})(_[0-9a-fA-F]{4})+`, LiteralNumberHex, nil},
+ {`#[0-9a-fA-F]+`, LiteralNumberHex, nil},
+ {`\$([01]{4})(_[01]{4})+`, LiteralNumberBin, nil},
+ {`\$[01]+`, LiteralNumberBin, nil},
+ {`\d{1,3}(_\d{3})+[kMGTP]?`, LiteralNumberInteger, nil},
+ {`[0-9]+[kMGTP]?`, LiteralNumberInteger, nil},
+ {`\n`, Text, nil},
+ },
+ "class": {
+ {`[A-Za-z_]\w*`, NameClass, Pop(1)},
+ },
+ "import": {
+ {`[a-z][\w.]*`, NameNamespace, Pop(1)},
+ },
+ "comment": {
+ {`[^*/]`, CommentMultiline, nil},
+ {`/\*`, CommentMultiline, Push()},
+ {`\*/`, CommentMultiline, Pop(1)},
+ {`[*/]`, CommentMultiline, nil},
+ },
+ }
+}
diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go b/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go
new file mode 100644
index 000000000..f3050346f
--- /dev/null
+++ b/vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go
@@ -0,0 +1,60 @@
+package c
+
+import (
+ . "github.com/alecthomas/chroma" // nolint
+ "github.com/alecthomas/chroma/lexers/internal"
+)
+
+// Cfengine3 lexer.
+var Cfengine3 = internal.Register(MustNewLazyLexer(
+ &Config{
+ Name: "CFEngine3",
+ Aliases: []string{"cfengine3", "cf3"},
+ Filenames: []string{"*.cf"},
+ MimeTypes: []string{},
+ },
+ cfengine3Rules,
+))
+
+func cfengine3Rules() Rules {
+ return Rules{
+ "root": {
+ {`#.*?\n`, Comment, nil},
+ {`(body)(\s+)(\S+)(\s+)(control)`, ByGroups(Keyword, Text, Keyword, Text, Keyword), nil},
+ {`(body|bundle)(\s+)(\S+)(\s+)(\w+)(\()`, ByGroups(Keyword, Text, Keyword, Text, NameFunction, Punctuation), Push("arglist")},
+ {`(body|bundle)(\s+)(\S+)(\s+)(\w+)`, ByGroups(Keyword, Text, Keyword, Text, NameFunction), nil},
+ {`(")([^"]+)(")(\s+)(string|slist|int|real)(\s*)(=>)(\s*)`, ByGroups(Punctuation, NameVariable, Punctuation, Text, KeywordType, Text, Operator, Text), nil},
+ {`(\S+)(\s*)(=>)(\s*)`, ByGroups(KeywordReserved, Text, Operator, Text), nil},
+ {`"`, LiteralString, Push("string")},
+ {`(\w+)(\()`, ByGroups(NameFunction, Punctuation), nil},
+ {`([\w.!&|()]+)(::)`, ByGroups(NameClass, Punctuation), nil},
+ {`(\w+)(:)`, ByGroups(KeywordDeclaration, Punctuation), nil},
+ {`@[{(][^)}]+[})]`, NameVariable, nil},
+ {`[(){},;]`, Punctuation, nil},
+ {`=>`, Operator, nil},
+ {`->`, Operator, nil},
+ {`\d+\.\d+`, LiteralNumberFloat, nil},
+ {`\d+`, LiteralNumberInteger, nil},
+ {`\w+`, NameFunction, nil},
+ {`\s+`, Text, nil},
+ },
+ "string": {
+ {`\$[{(]`, LiteralStringInterpol, Push("interpol")},
+ {`\\.`, LiteralStringEscape, nil},
+ {`"`, LiteralString, Pop(1)},
+ {`\n`, LiteralString, nil},
+ {`.`, LiteralString, nil},
+ },
+ "interpol": {
+ {`\$[{(]`, LiteralStringInterpol, Push()},
+ {`[})]`, LiteralStringInterpol, Pop(1)},
+ {`[^${()}]+`, LiteralStringInterpol, nil},
+ },
+ "arglist": {
+ {`\)`, Punctuation, Pop(1)},
+ {`,`, Punctuation, nil},
+ {`\w+`, NameVariable, nil},
+ {`\s+`, Text, nil},
+ },
+ }
+}
diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go b/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go
new file mode 100644
index 000000000..58db9aac9
--- /dev/null
+++ b/vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go
@@ -0,0 +1,67 @@
+package c
+
+import (
+ . "github.com/alecthomas/chroma" // nolint
+ "github.com/alecthomas/chroma/lexers/internal"
+)
+
+// Chaiscript lexer.
+var Chaiscript = internal.Register(MustNewLazyLexer(
+ &Config{
+ Name: "ChaiScript",
+ Aliases: []string{"chai", "chaiscript"},
+ Filenames: []string{"*.chai"},
+ MimeTypes: []string{"text/x-chaiscript", "application/x-chaiscript"},
+ DotAll: true,
+ },
+ chaiscriptRules,
+))
+
+func chaiscriptRules() Rules {
+ return Rules{
+ "commentsandwhitespace": {
+ {`\s+`, Text, nil},
+ {`//.*?\n`, CommentSingle, nil},
+ {`/\*.*?\*/`, CommentMultiline, nil},
+ {`^\#.*?\n`, CommentSingle, nil},
+ },
+ "slashstartsregex": {
+ Include("commentsandwhitespace"),
+ {`/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)`, LiteralStringRegex, Pop(1)},
+ {`(?=/)`, Text, Push("#pop", "badregex")},
+ Default(Pop(1)),
+ },
+ "badregex": {
+ {`\n`, Text, Pop(1)},
+ },
+ "root": {
+ Include("commentsandwhitespace"),
+ {`\n`, Text, nil},
+ {`[^\S\n]+`, Text, nil},
+ {`\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|\.\.(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?`, Operator, Push("slashstartsregex")},
+ {`[{(\[;,]`, Punctuation, Push("slashstartsregex")},
+ {`[})\].]`, Punctuation, nil},
+ {`[=+\-*/]`, Operator, nil},
+ {`(for|in|while|do|break|return|continue|if|else|throw|try|catch)\b`, Keyword, Push("slashstartsregex")},
+ {`(var)\b`, KeywordDeclaration, Push("slashstartsregex")},
+ {`(attr|def|fun)\b`, KeywordReserved, nil},
+ {`(true|false)\b`, KeywordConstant, nil},
+ {`(eval|throw)\b`, NameBuiltin, nil},
+ {"`\\S+`", NameBuiltin, nil},
+ {`[$a-zA-Z_]\w*`, NameOther, nil},
+ {`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil},
+ {`0x[0-9a-fA-F]+`, LiteralNumberHex, nil},
+ {`[0-9]+`, LiteralNumberInteger, nil},
+ {`"`, LiteralStringDouble, Push("dqstring")},
+ {`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
+ },
+ "dqstring": {
+ {`\$\{[^"}]+?\}`, LiteralStringInterpol, nil},
+ {`\$`, LiteralStringDouble, nil},
+ {`\\\\`, LiteralStringDouble, nil},
+ {`\\"`, LiteralStringDouble, nil},
+ {`[^\\"$]+`, LiteralStringDouble, nil},
+ {`"`, LiteralStringDouble, Pop(1)},
+ },
+ }
+}
diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go b/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go
new file mode 100644
index 000000000..bd5fb9d9c
--- /dev/null
+++ b/vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go
@@ -0,0 +1,41 @@
+package c
+
+import (
+ . "github.com/alecthomas/chroma" // nolint
+ "github.com/alecthomas/chroma/lexers/internal"
+ . "github.com/alecthomas/chroma/lexers/p" // nolint
+)
+
+// Cheetah lexer.
+var Cheetah = internal.Register(MustNewLazyLexer(
+ &Config{
+ Name: "Cheetah",
+ Aliases: []string{"cheetah", "spitfire"},
+ Filenames: []string{"*.tmpl", "*.spt"},
+ MimeTypes: []string{"application/x-cheetah", "application/x-spitfire"},
+ },
+ cheetahRules,
+))
+
+func cheetahRules() Rules {
+ return Rules{
+ "root": {
+ {`(##[^\n]*)$`, ByGroups(Comment), nil},
+ {`#[*](.|\n)*?[*]#`, Comment, nil},
+ {`#end[^#\n]*(?:#|$)`, CommentPreproc, nil},
+ {`#slurp$`, CommentPreproc, nil},
+ {`(#[a-zA-Z]+)([^#\n]*)(#|$)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
+ {`(\$)([a-zA-Z_][\w.]*\w)`, ByGroups(CommentPreproc, Using(Python)), nil},
+ {`(\$\{!?)(.*?)(\})(?s)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
+ {`(?sx)
+ (.+?) # anything, followed by:
+ (?:
+ (?=\#[#a-zA-Z]*) | # an eval comment
+ (?=\$[a-zA-Z_{]) | # a substitution
+ \Z # end of string
+ )
+ `, Other, nil},
+ {`\s+`, Text, nil},
+ },
+ }
+}
diff --git a/vendor/github.com/alecthomas/chroma/lexers/c/cl.go b/vendor/github.com/alecthomas/chroma/lexers/c/cl.go
new file mode 100644
index 000000000..bb162734c
--- /dev/null
+++ b/vendor/github.com/alecthomas/chroma/lexers/c/cl.go
@@ -0,0 +1,310 @@
+package c
+
+import (
+ . "github.com/alecthomas/chroma" // nolint
+ "github.com/alecthomas/chroma/lexers/internal"
+)
+
+var (
+ clBuiltinFunctions = []string{
+ "<", "<=", "=", ">", ">=", "-", "/", "/=", "*", "+", "1-", "1+",
+ "abort", "abs", "acons", "acos", "acosh", "add-method", "adjoin",
+ "adjustable-array-p", "adjust-array", "allocate-instance",
+ "alpha-char-p", "alphanumericp", "append", "apply", "apropos",
+ "apropos-list", "aref", "arithmetic-error-operands",
+ "arithmetic-error-operation", "array-dimension", "array-dimensions",
+ "array-displacement", "array-element-type", "array-has-fill-pointer-p",
+ "array-in-bounds-p", "arrayp", "array-rank", "array-row-major-index",
+ "array-total-size", "ash", "asin", "asinh", "assoc", "assoc-if",
+ "assoc-if-not", "atan", "atanh", "atom", "bit", "bit-and", "bit-andc1",
+ "bit-andc2", "bit-eqv", "bit-ior", "bit-nand", "bit-nor", "bit-not",
+ "bit-orc1", "bit-orc2", "bit-vector-p", "bit-xor", "boole",
+ "both-case-p", "boundp", "break", "broadcast-stream-streams",
+ "butlast", "byte", "byte-position", "byte-size", "caaaar", "caaadr",
+ "caaar", "caadar", "caaddr", "caadr", "caar", "cadaar", "cadadr",
+ "cadar", "caddar", "cadddr", "caddr", "cadr", "call-next-method", "car",
+ "cdaaar", "cdaadr", "cdaar", "cdadar", "cdaddr", "cdadr", "cdar",
+ "cddaar", "cddadr", "cddar", "cdddar", "cddddr", "cdddr", "cddr", "cdr",
+ "ceiling", "cell-error-name", "cerror", "change-class", "char", "char<",
+ "char<=", "char=", "char>", "char>=", "char/=", "character",
+ "characterp", "char-code", "char-downcase", "char-equal",
+ "char-greaterp", "char-int", "char-lessp", "char-name",
+ "char-not-equal", "char-not-greaterp", "char-not-lessp", "char-upcase",
+ "cis", "class-name", "class-of", "clear-input", "clear-output",
+ "close", "clrhash", "code-char", "coerce", "compile",
+ "compiled-function-p", "compile-file", "compile-file-pathname",
+ "compiler-macro-function", "complement", "complex", "complexp",
+ "compute-applicable-methods", "compute-restarts", "concatenate",
+ "concatenated-stream-streams", "conjugate", "cons", "consp",
+ "constantly", "constantp", "continue", "copy-alist", "copy-list",
+ "copy-pprint-dispatch", "copy-readtable", "copy-seq", "copy-structure",
+ "copy-symbol", "copy-tree", "cos", "cosh", "count", "count-if",
+ "count-if-not", "decode-float", "decode-universal-time", "delete",
+ "delete-duplicates", "delete-file", "delete-if", "delete-if-not",
+ "delete-package", "denominator", "deposit-field", "describe",
+ "describe-object", "digit-char", "digit-char-p", "directory",
+ "directory-namestring", "disassemble", "documentation", "dpb",
+ "dribble", "echo-stream-input-stream", "echo-stream-output-stream",
+ "ed", "eighth", "elt", "encode-universal-time", "endp",
+ "enough-namestring", "ensure-directories-exist",
+ "ensure-generic-function", "eq", "eql", "equal", "equalp", "error",
+ "eval", "evenp", "every", "exp", "export", "expt", "fboundp",
+ "fceiling", "fdefinition", "ffloor", "fifth", "file-author",
+ "file-error-pathname", "file-length", "file-namestring",
+ "file-position", "file-string-length", "file-write-date",
+ "fill", "fill-pointer", "find", "find-all-symbols", "find-class",
+ "find-if", "find-if-not", "find-method", "find-package", "find-restart",
+ "find-symbol", "finish-output", "first", "float", "float-digits",
+ "floatp", "float-precision", "float-radix", "float-sign", "floor",
+ "fmakunbound", "force-output", "format", "fourth", "fresh-line",
+ "fround", "ftruncate", "funcall", "function-keywords",
+ "function-lambda-expression", "functionp", "gcd", "gensym", "gentemp",
+ "get", "get-decoded-time", "get-dispatch-macro-character", "getf",
+ "gethash", "get-internal-real-time", "get-internal-run-time",
+ "get-macro-character", "get-output-stream-string", "get-properties",
+ "get-setf-expansion", "get-universal-time", "graphic-char-p",
+ "hash-table-count", "hash-table-p", "hash-table-rehash-size",
+ "hash-table-rehash-threshold", "hash-table-size", "hash-table-test",