Mercurial > yakumo_izuru > aya
comparison vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go @ 66:787b5ee0289d draft
Use vendored modules
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
author | yakumo.izuru |
---|---|
date | Sun, 23 Jul 2023 13:18:53 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
65:6d985efa0f7a | 66:787b5ee0289d |
---|---|
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 } |