vendor
github.com
alecthomas
chroma
v2
lexers
embedded
abap.xml abnf.xml actionscript.xml actionscript_3.xml ada.xml al.xml angular2.xml antlr.xml apacheconf.xml apl.xml applescript.xml arduino.xml armasm.xml awk.xml ballerina.xml bash.xml batchfile.xml bibtex.xml bicep.xml blitzbasic.xml bnf.xml brainfuck.xml c++.xml c.xml cap_n_proto.xml ceylon.xml cfengine3.xml cfstatement.xml chaiscript.xml clojure.xml cmake.xml cobol.xml coffeescript.xml common_lisp.xml coq.xml crystal.xml csharp.xml css.xml cython.xml d.xml dart.xml diff.xml django_jinja.xml dtd.xml dylan.xml ebnf.xml elixir.xml elm.xml emacslisp.xml erlang.xml factor.xml fennel.xml fish.xml forth.xml fortran.xml fsharp.xml gas.xml gdscript.xml gherkin.xml glsl.xml gnuplot.xml go_template.xml graphql.xml groff.xml groovy.xml handlebars.xml haskell.xml hcl.xml hexdump.xml hlb.xml hy.xml idris.xml igor.xml ini.xml io.xml j.xml java.xml javascript.xml json.xml julia.xml jungle.xml kotlin.xml lighttpd.xml llvm.xml lua.xml mathematica.xml matlab.xml mcfunction.xml meson.xml metal.xml minizinc.xml mlir.xml modula-2.xml monkeyc.xml morrowindscript.xml mysql.xml nasm.xml newspeak.xml nginx.xml nim.xml nix.xml objective-c.xml ocaml.xml octave.xml onesenterprise.xml openscad.xml pacmanconf.xml perl.xml php.xml pig.xml pkgconfig.xml pl_pgsql.xml plutus_core.xml pony.xml postscript.xml povray.xml powerquery.xml powershell.xml prolog.xml promql.xml protobuf.xml puppet.xml python.xml python_2.xml qbasic.xml qml.xml r.xml racket.xml ragel.xml react.xml reasonml.xml reg.xml rexx.xml ruby.xml rust.xml sas.xml sass.xml scala.xml scheme.xml scilab.xml scss.xml sieve.xml smalltalk.xml snobol.xml solidity.xml sparql.xml sql.xml squidconf.xml standard_ml.xml stylus.xml swift.xml systemd.xml systemverilog.xml tablegen.xml tasm.xml tcl.xml tcsh.xml termcap.xml terminfo.xml terraform.xml tex.xml thrift.xml toml.xml tradingview.xml transact-sql.xml turing.xml turtle.xml twig.xml typescript.xml typoscriptcssdata.xml typoscripthtmldata.xml vb_net.xml verilog.xml vhdl.xml vue.xml wdte.xml whiley.xml xml.xml xorg.xml yaml.xml yang.xml zed.xml zig.xmlstyles
abap.go algol.go algol_nu.go api.go arduino.go autumn.go average.go base16-snazzy.go borland.go bw.go colorful.go doom-one.go doom-one2.go dracula.go emacs.go friendly.go fruity.go github.go gruvbox.go hr_dark.go hr_high_contrast.go igor.go lovelace.go manni.go monokai.go monokailight.go murphy.go native.go nord.go onesenterprise.go paraiso-dark.go paraiso-light.go pastie.go perldoc.go pygments.go rainbow_dash.go rrt.go solarized-dark.go solarized-dark256.go solarized-light.go swapoff.go tango.go trac.go vim.go vs.go vulcan.go witchhazel.go xcode-dark.go xcode.gootiai10
copy
.gitignore LICENSE README.md copy.go copy_namedpipes.go copy_namedpipes_x.go fileinfo_go1.15.go fileinfo_go1.16.go options.go permission_control.go preserve_ltimes.go preserve_ltimes_x.go preserve_owner.go preserve_owner_x.go preserve_times.go stat_times.go stat_times_darwin.go stat_times_freebsd.go stat_times_js.go stat_times_windows.go stat_times_x.go test_setup.go test_setup_x.gotdewolff
yuin
goldmark
extension
cjk.go definition_list.go footnote.go gfm.go linkify.go strikethrough.go table.go tasklist.go typographer.goparser
attribute.go atx_heading.go auto_link.go blockquote.go code_block.go code_span.go delimiter.go emphasis.go fcode_block.go html_block.go link.go link_ref.go list.go list_item.go paragraph.go parser.go raw_html.go setext_headings.go thematic_break.gogolang.org
x
net
LICENSE PATENTSsys
unix
.gitignore README.md affinity_linux.go aliases.go asm_aix_ppc64.s asm_bsd_386.s asm_bsd_amd64.s asm_bsd_arm.s asm_bsd_arm64.s asm_bsd_ppc64.s asm_bsd_riscv64.s asm_linux_386.s asm_linux_amd64.s asm_linux_arm.s asm_linux_arm64.s asm_linux_loong64.s asm_linux_mips64x.s asm_linux_mipsx.s asm_linux_ppc64x.s asm_linux_riscv64.s asm_linux_s390x.s asm_openbsd_mips64.s asm_solaris_amd64.s asm_zos_s390x.s bluetooth_linux.go cap_freebsd.go constants.go dev_aix_ppc.go dev_aix_ppc64.go dev_darwin.go dev_dragonfly.go dev_freebsd.go dev_linux.go dev_netbsd.go dev_openbsd.go dev_zos.go dirent.go endian_big.go endian_little.go env_unix.go epoll_zos.go fcntl.go fcntl_darwin.go fcntl_linux_32bit.go fdset.go fstatfs_zos.go gccgo.go gccgo_c.c gccgo_linux_amd64.go ifreq_linux.go ioctl_linux.go ioctl_signed.go ioctl_unsigned.go ioctl_zos.go mkall.sh mkerrors.sh pagesize_unix.go pledge_openbsd.go ptrace_darwin.go ptrace_ios.go race.go race0.go readdirent_getdents.go readdirent_getdirentries.go sockcmsg_dragonfly.go sockcmsg_linux.go sockcmsg_unix.go sockcmsg_unix_other.go syscall.go syscall_aix.go syscall_aix_ppc.go syscall_aix_ppc64.go syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go syscall_darwin_arm64.go syscall_darwin_libSystem.go syscall_dragonfly.go syscall_dragonfly_amd64.go syscall_freebsd.go syscall_freebsd_386.go syscall_freebsd_amd64.go syscall_freebsd_arm.go syscall_freebsd_arm64.go syscall_freebsd_riscv64.go syscall_hurd.go syscall_hurd_386.go syscall_illumos.go syscall_linux.go syscall_linux_386.go syscall_linux_alarm.go syscall_linux_amd64.go syscall_linux_amd64_gc.go syscall_linux_arm.go syscall_linux_arm64.go syscall_linux_gc.go syscall_linux_gc_386.go syscall_linux_gc_arm.go syscall_linux_gccgo_386.go syscall_linux_gccgo_arm.go syscall_linux_loong64.go syscall_linux_mips64x.go syscall_linux_mipsx.go syscall_linux_ppc.go syscall_linux_ppc64x.go syscall_linux_riscv64.go syscall_linux_s390x.go syscall_linux_sparc64.go syscall_netbsd.go syscall_netbsd_386.go syscall_netbsd_amd64.go syscall_netbsd_arm.go syscall_netbsd_arm64.go syscall_openbsd.go syscall_openbsd_386.go syscall_openbsd_amd64.go syscall_openbsd_arm.go syscall_openbsd_arm64.go syscall_openbsd_libc.go syscall_openbsd_mips64.go syscall_openbsd_ppc64.go syscall_openbsd_riscv64.go syscall_solaris.go syscall_solaris_amd64.go syscall_unix.go syscall_unix_gc.go syscall_unix_gc_ppc64x.go syscall_zos_s390x.go sysvshm_linux.go sysvshm_unix.go sysvshm_unix_other.go timestruct.go unveil_openbsd.go xattr_bsd.go zerrors_aix_ppc.go zerrors_aix_ppc64.go zerrors_darwin_amd64.go zerrors_darwin_arm64.go zerrors_dragonfly_amd64.go zerrors_freebsd_386.go zerrors_freebsd_amd64.go zerrors_freebsd_arm.go zerrors_freebsd_arm64.go zerrors_freebsd_riscv64.go zerrors_linux.go zerrors_linux_386.go zerrors_linux_amd64.go zerrors_linux_arm.go zerrors_linux_arm64.go zerrors_linux_loong64.go zerrors_linux_mips.go zerrors_linux_mips64.go zerrors_linux_mips64le.go zerrors_linux_mipsle.go zerrors_linux_ppc.go zerrors_linux_ppc64.go zerrors_linux_ppc64le.go zerrors_linux_riscv64.go zerrors_linux_s390x.go zerrors_linux_sparc64.go zerrors_netbsd_386.go zerrors_netbsd_amd64.go zerrors_netbsd_arm.go zerrors_netbsd_arm64.go zerrors_openbsd_386.go zerrors_openbsd_amd64.go zerrors_openbsd_arm.go zerrors_openbsd_arm64.go zerrors_openbsd_mips64.go zerrors_openbsd_ppc64.go zerrors_openbsd_riscv64.go zerrors_solaris_amd64.go zerrors_zos_s390x.go zptrace_armnn_linux.go zptrace_linux_arm64.go zptrace_mipsnn_linux.go zptrace_mipsnnle_linux.go zptrace_x86_linux.go zsyscall_aix_ppc.go zsyscall_aix_ppc64.go zsyscall_aix_ppc64_gc.go zsyscall_aix_ppc64_gccgo.go zsyscall_darwin_amd64.go zsyscall_darwin_amd64.s zsyscall_darwin_arm64.go zsyscall_darwin_arm64.s zsyscall_dragonfly_amd64.go zsyscall_freebsd_386.go zsyscall_freebsd_amd64.go zsyscall_freebsd_arm.go zsyscall_freebsd_arm64.go zsyscall_freebsd_riscv64.go zsyscall_illumos_amd64.go zsyscall_linux.go zsyscall_linux_386.go zsyscall_linux_amd64.go zsyscall_linux_arm.go zsyscall_linux_arm64.go zsyscall_linux_loong64.go zsyscall_linux_mips.go zsyscall_linux_mips64.go zsyscall_linux_mips64le.go zsyscall_linux_mipsle.go zsyscall_linux_ppc.go zsyscall_linux_ppc64.go zsyscall_linux_ppc64le.go zsyscall_linux_riscv64.go zsyscall_linux_s390x.go zsyscall_linux_sparc64.go zsyscall_netbsd_386.go zsyscall_netbsd_amd64.go zsyscall_netbsd_arm.go zsyscall_netbsd_arm64.go zsyscall_openbsd_386.go zsyscall_openbsd_386.s zsyscall_openbsd_amd64.go zsyscall_openbsd_amd64.s zsyscall_openbsd_arm.go zsyscall_openbsd_arm.s zsyscall_openbsd_arm64.go zsyscall_openbsd_arm64.s zsyscall_openbsd_mips64.go zsyscall_openbsd_mips64.s zsyscall_openbsd_ppc64.go zsyscall_openbsd_ppc64.s zsyscall_openbsd_riscv64.go zsyscall_openbsd_riscv64.s zsyscall_solaris_amd64.go zsyscall_zos_s390x.go zsysctl_openbsd_386.go zsysctl_openbsd_amd64.go zsysctl_openbsd_arm.go zsysctl_openbsd_arm64.go zsysctl_openbsd_mips64.go zsysctl_openbsd_ppc64.go zsysctl_openbsd_riscv64.go zsysnum_darwin_amd64.go zsysnum_darwin_arm64.go zsysnum_dragonfly_amd64.go zsysnum_freebsd_386.go zsysnum_freebsd_amd64.go zsysnum_freebsd_arm.go zsysnum_freebsd_arm64.go zsysnum_freebsd_riscv64.go zsysnum_linux_386.go zsysnum_linux_amd64.go zsysnum_linux_arm.go zsysnum_linux_arm64.go zsysnum_linux_loong64.go zsysnum_linux_mips.go zsysnum_linux_mips64.go zsysnum_linux_mips64le.go zsysnum_linux_mipsle.go zsysnum_linux_ppc.go zsysnum_linux_ppc64.go zsysnum_linux_ppc64le.go zsysnum_linux_riscv64.go zsysnum_linux_s390x.go zsysnum_linux_sparc64.go zsysnum_netbsd_386.go zsysnum_netbsd_amd64.go zsysnum_netbsd_arm.go zsysnum_netbsd_arm64.go zsysnum_openbsd_386.go zsysnum_openbsd_amd64.go zsysnum_openbsd_arm.go zsysnum_openbsd_arm64.go zsysnum_openbsd_mips64.go zsysnum_openbsd_ppc64.go zsysnum_openbsd_riscv64.go zsysnum_zos_s390x.go ztypes_aix_ppc.go ztypes_aix_ppc64.go ztypes_darwin_amd64.go ztypes_darwin_arm64.go ztypes_dragonfly_amd64.go ztypes_freebsd_386.go ztypes_freebsd_amd64.go ztypes_freebsd_arm.go ztypes_freebsd_arm64.go ztypes_freebsd_riscv64.go ztypes_linux.go ztypes_linux_386.go ztypes_linux_amd64.go ztypes_linux_arm.go ztypes_linux_arm64.go ztypes_linux_loong64.go ztypes_linux_mips.go ztypes_linux_mips64.go ztypes_linux_mips64le.go ztypes_linux_mipsle.go ztypes_linux_ppc.go ztypes_linux_ppc64.go ztypes_linux_ppc64le.go ztypes_linux_riscv64.go ztypes_linux_s390x.go ztypes_linux_sparc64.go ztypes_netbsd_386.go ztypes_netbsd_amd64.go ztypes_netbsd_arm.go ztypes_netbsd_arm64.go ztypes_openbsd_386.go ztypes_openbsd_amd64.go ztypes_openbsd_arm.go ztypes_openbsd_arm64.go ztypes_openbsd_mips64.go ztypes_openbsd_ppc64.go ztypes_openbsd_riscv64.go ztypes_solaris_amd64.go ztypes_zos_s390x.gogopkg.in
vendor/github.com/alecthomas/chroma/v2/lexers/caddyfile.go
raw
1package lexers
2
3import (
4 . "github.com/alecthomas/chroma/v2" // nolint
5)
6
7// caddyfileCommon are the rules common to both of the lexer variants
8func caddyfileCommonRules() Rules {
9 return Rules{
10 "site_block_common": {
11 // Import keyword
12 {`(import)(\s+)([^\s]+)`, ByGroups(Keyword, Text, NameVariableMagic), nil},
13 // Matcher definition
14 {`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
15 // Matcher token stub for docs
16 {`\[\<matcher\>\]`, NameDecorator, Push("matcher")},
17 // These cannot have matchers but may have things that look like
18 // matchers in their arguments, so we just parse as a subdirective.
19 {`try_files`, Keyword, Push("subdirective")},
20 // These are special, they can nest more directives
21 {`handle_errors|handle|route|handle_path|not`, Keyword, Push("nested_directive")},
22 // Any other directive
23 {`[^\s#]+`, Keyword, Push("directive")},
24 Include("base"),
25 },
26 "matcher": {
27 {`\{`, Punctuation, Push("block")},
28 // Not can be one-liner
29 {`not`, Keyword, Push("deep_not_matcher")},
30 // Any other same-line matcher
31 {`[^\s#]+`, Keyword, Push("arguments")},
32 // Terminators
33 {`\n`, Text, Pop(1)},
34 {`\}`, Punctuation, Pop(1)},
35 Include("base"),
36 },
37 "block": {
38 {`\}`, Punctuation, Pop(2)},
39 // Not can be one-liner
40 {`not`, Keyword, Push("not_matcher")},
41 // Any other subdirective
42 {`[^\s#]+`, Keyword, Push("subdirective")},
43 Include("base"),
44 },
45 "nested_block": {
46 {`\}`, Punctuation, Pop(2)},
47 // Matcher definition
48 {`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
49 // Something that starts with literally < is probably a docs stub
50 {`\<[^#]+\>`, Keyword, Push("nested_directive")},
51 // Any other directive
52 {`[^\s#]+`, Keyword, Push("nested_directive")},
53 Include("base"),
54 },
55 "not_matcher": {
56 {`\}`, Punctuation, Pop(2)},
57 {`\{(?=\s)`, Punctuation, Push("block")},
58 {`[^\s#]+`, Keyword, Push("arguments")},
59 {`\s+`, Text, nil},
60 },
61 "deep_not_matcher": {
62 {`\}`, Punctuation, Pop(2)},
63 {`\{(?=\s)`, Punctuation, Push("block")},
64 {`[^\s#]+`, Keyword, Push("deep_subdirective")},
65 {`\s+`, Text, nil},
66 },
67 "directive": {
68 {`\{(?=\s)`, Punctuation, Push("block")},
69 Include("matcher_token"),
70 Include("comments_pop_1"),
71 {`\n`, Text, Pop(1)},
72 Include("base"),
73 },
74 "nested_directive": {
75 {`\{(?=\s)`, Punctuation, Push("nested_block")},
76 Include("matcher_token"),
77 Include("comments_pop_1"),
78 {`\n`, Text, Pop(1)},
79 Include("base"),
80 },
81 "subdirective": {
82 {`\{(?=\s)`, Punctuation, Push("block")},
83 Include("comments_pop_1"),
84 {`\n`, Text, Pop(1)},
85 Include("base"),
86 },
87 "arguments": {
88 {`\{(?=\s)`, Punctuation, Push("block")},
89 Include("comments_pop_2"),
90 {`\\\n`, Text, nil}, // Skip escaped newlines
91 {`\n`, Text, Pop(2)},
92 Include("base"),
93 },
94 "deep_subdirective": {
95 {`\{(?=\s)`, Punctuation, Push("block")},
96 Include("comments_pop_3"),
97 {`\n`, Text, Pop(3)},
98 Include("base"),
99 },
100 "matcher_token": {
101 {`@[^\s]+`, NameDecorator, Push("arguments")}, // Named matcher
102 {`/[^\s]+`, NameDecorator, Push("arguments")}, // Path matcher
103 {`\*`, NameDecorator, Push("arguments")}, // Wildcard path matcher
104 {`\[\<matcher\>\]`, NameDecorator, Push("arguments")}, // Matcher token stub for docs
105 },
106 "comments": {
107 {`^#.*\n`, CommentSingle, nil}, // Comment at start of line
108 {`\s+#.*\n`, CommentSingle, nil}, // Comment preceded by whitespace
109 },
110 "comments_pop_1": {
111 {`^#.*\n`, CommentSingle, Pop(1)}, // Comment at start of line
112 {`\s+#.*\n`, CommentSingle, Pop(1)}, // Comment preceded by whitespace
113 },
114 "comments_pop_2": {
115 {`^#.*\n`, CommentSingle, Pop(2)}, // Comment at start of line
116 {`\s+#.*\n`, CommentSingle, Pop(2)}, // Comment preceded by whitespace
117 },
118 "comments_pop_3": {
119 {`^#.*\n`, CommentSingle, Pop(3)}, // Comment at start of line
120 {`\s+#.*\n`, CommentSingle, Pop(3)}, // Comment preceded by whitespace
121 },
122 "base": {
123 Include("comments"),
124 {`(on|off|first|last|before|after|internal|strip_prefix|strip_suffix|replace)\b`, NameConstant, nil},
125 {`(https?://)?([a-z0-9.-]+)(:)([0-9]+)`, ByGroups(Name, Name, Punctuation, LiteralNumberInteger), nil},
126 {`[a-z-]+/[a-z-+]+`, LiteralString, nil},
127 {`[0-9]+[km]?\b`, LiteralNumberInteger, nil},
128 {`\{[\w+.\$-]+\}`, LiteralStringEscape, nil}, // Placeholder
129 {`\[(?=[^#{}$]+\])`, Punctuation, nil},
130 {`\]|\|`, Punctuation, nil},
131 {`[^\s#{}$\]]+`, LiteralString, nil},
132 {`/[^\s#]*`, Name, nil},
133 {`\s+`, Text, nil},
134 },
135 }
136}
137
138// Caddyfile lexer.
139var Caddyfile = Register(MustNewLexer(
140 &Config{
141 Name: "Caddyfile",
142 Aliases: []string{"caddyfile", "caddy"},
143 Filenames: []string{"Caddyfile*"},
144 MimeTypes: []string{},
145 },
146 caddyfileRules,
147))
148
149func caddyfileRules() Rules {
150 return Rules{
151 "root": {
152 Include("comments"),
153 // Global options block
154 {`^\s*(\{)\s*$`, ByGroups(Punctuation), Push("globals")},
155 // Snippets
156 {`(\([^\s#]+\))(\s*)(\{)`, ByGroups(NameVariableAnonymous, Text, Punctuation), Push("snippet")},
157 // Site label
158 {`[^#{(\s,]+`, GenericHeading, Push("label")},
159 // Site label with placeholder
160 {`\{[\w+.\$-]+\}`, LiteralStringEscape, Push("label")},
161 {`\s+`, Text, nil},
162 },
163 "globals": {
164 {`\}`, Punctuation, Pop(1)},
165 {`[^\s#]+`, Keyword, Push("directive")},
166 Include("base"),
167 },
168 "snippet": {
169 {`\}`, Punctuation, Pop(1)},
170 // Matcher definition
171 {`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
172 // Any directive
173 {`[^\s#]+`, Keyword, Push("directive")},
174 Include("base"),
175 },
176 "label": {
177 // Allow multiple labels, comma separated, newlines after
178 // a comma means another label is coming
179 {`,\s*\n?`, Text, nil},
180 {` `, Text, nil},
181 // Site label with placeholder
182 {`\{[\w+.\$-]+\}`, LiteralStringEscape, nil},
183 // Site label
184 {`[^#{(\s,]+`, GenericHeading, nil},
185 // Comment after non-block label (hack because comments end in \n)
186 {`#.*\n`, CommentSingle, Push("site_block")},
187 // Note: if \n, we'll never pop out of the site_block, it's valid
188 {`\{(?=\s)|\n`, Punctuation, Push("site_block")},
189 },
190 "site_block": {
191 {`\}`, Punctuation, Pop(2)},
192 Include("site_block_common"),
193 },
194 }.Merge(caddyfileCommonRules())
195}
196
197// Caddyfile directive-only lexer.
198var CaddyfileDirectives = Register(MustNewLexer(
199 &Config{
200 Name: "Caddyfile Directives",
201 Aliases: []string{"caddyfile-directives", "caddyfile-d", "caddy-d"},
202 Filenames: []string{},
203 MimeTypes: []string{},
204 },
205 caddyfileDirectivesRules,
206))
207
208func caddyfileDirectivesRules() Rules {
209 return Rules{
210 // Same as "site_block" in Caddyfile
211 "root": {
212 Include("site_block_common"),
213 },
214 }.Merge(caddyfileCommonRules())
215}