source: code/trunk/vendor/github.com/alecthomas/chroma/v2/lexers/myghty.go@ 67

Last change on this file since 67 was 67, checked in by Izuru Yakumo, 23 months ago

Use vendored modules

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 1.5 KB
Line 
1package lexers
2
3import (
4 . "github.com/alecthomas/chroma/v2" // nolint
5)
6
7// Myghty lexer.
8var Myghty = Register(MustNewLexer(
9 &Config{
10 Name: "Myghty",
11 Aliases: []string{"myghty"},
12 Filenames: []string{"*.myt", "autodelegate"},
13 MimeTypes: []string{"application/x-myghty"},
14 },
15 myghtyRules,
16))
17
18func myghtyRules() Rules {
19 return Rules{
20 "root": {
21 {`\s+`, Text, nil},
22 {`(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, Text, NameFunction, NameTag, UsingSelf("root"), NameTag), nil},
23 {`(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using("Python2"), NameTag), nil},
24 {`(<&[^|])(.*?)(,.*?)?(&>)`, ByGroups(NameTag, NameFunction, Using("Python2"), NameTag), nil},
25 {`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using("Python2"), NameTag), nil},
26 {`</&>`, NameTag, nil},
27 {`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using("Python2"), NameTag), nil},
28 {`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil},
29 {`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using("Python2"), Other), nil},
30 {`(?sx)
31 (.+?) # anything, followed by:
32 (?:
33 (?<=\n)(?=[%#]) | # an eval or comment line
34 (?=</?[%&]) | # a substitution or block or
35 # call start or end
36 # - don't consume
37 (\\\n) | # an escaped newline
38 \Z # end of string
39 )`, ByGroups(Other, Operator), nil},
40 },
41 }
42}
Note: See TracBrowser for help on using the repository browser.