summaryrefslogtreecommitdiff
path: root/vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-10-25 00:47:47 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-10-25 00:47:47 +0200
commitc6cc0108ca7738023b45e0eeac0fa2390532dd93 (patch)
tree36890e6cd3091bbab8efbe686cc56f467f645bfd /vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go
parent0130404a1dc663d4aa68d780c9bcb23a4243e68d (diff)
downloadjbmafp-master.tar.gz
Added vendor lock on depsHEADmaster
Diffstat (limited to 'vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go')
-rw-r--r--vendor/github.com/alecthomas/chroma/v2/lexers/cheetah.go39
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 @@
+package lexers
+
+import (
+ . "github.com/alecthomas/chroma/v2" // nolint
+)
+
+// Cheetah lexer.
+var Cheetah = Register(MustNewLexer(
+ &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},
+ },
+ }
+}