diff options
Diffstat (limited to 'vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go')
| -rw-r--r-- | vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go b/vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go new file mode 100644 index 0000000..7eea429 --- /dev/null +++ b/vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | package lexers | ||
| 2 | |||
| 3 | import ( | ||
| 4 | . "github.com/alecthomas/chroma/v2" // nolint | ||
| 5 | ) | ||
| 6 | |||
| 7 | // Cheetah lexer. | ||
| 8 | var Cheetah = Register(MustNewLexer( | ||
| 9 | &Config{ | ||
| 10 | Name: "Cheetah", | ||
| 11 | Aliases: []string{"cheetah", "spitfire"}, | ||
| 12 | Filenames: []string{"*.tmpl", "*.spt"}, | ||
| 13 | MimeTypes: []string{"application/x-cheetah", "application/x-spitfire"}, | ||
| 14 | }, | ||
| 15 | cheetahRules, | ||
| 16 | )) | ||
| 17 | |||
| 18 | func cheetahRules() Rules { | ||
| 19 | return Rules{ | ||
| 20 | "root": { | ||
| 21 | {`(##[^\n]*)$`, ByGroups(Comment), nil}, | ||
| 22 | {`#[*](.|\n)*?[*]#`, Comment, nil}, | ||
| 23 | {`#end[^#\n]*(?:#|$)`, CommentPreproc, nil}, | ||
| 24 | {`#slurp$`, CommentPreproc, nil}, | ||
| 25 | {`(#[a-zA-Z]+)([^#\n]*)(#|$)`, ByGroups(CommentPreproc, Using("Python"), CommentPreproc), nil}, | ||
| 26 | {`(\$)([a-zA-Z_][\w.]*\w)`, ByGroups(CommentPreproc, Using("Python")), nil}, | ||
| 27 | {`(\$\{!?)(.*?)(\})(?s)`, ByGroups(CommentPreproc, Using("Python"), CommentPreproc), nil}, | ||
| 28 | {`(?sx) | ||
| 29 | (.+?) # anything, followed by: | ||
| 30 | (?: | ||
| 31 | (?=\#[#a-zA-Z]*) | # an eval comment | ||
| 32 | (?=\$[a-zA-Z_{]) | # a substitution | ||
| 33 | \Z # end of string | ||
| 34 | ) | ||
| 35 | `, Other, nil}, | ||
| 36 | {`\s+`, Text, nil}, | ||
| 37 | }, | ||
| 38 | } | ||
| 39 | } | ||
