mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-23 19:11:38 +01:00
89e93d90b3
Merge branch 'master' into use-glamour select Glamour Theme based on BackgroundColor Merge branch 'master' into use-glamour Merge branch 'master' into use-glamour update termev update go.mod label color colorate use glamour for issue content Vendor: Add glamour Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/181 Reviewed-by: techknowlogick <techknowlogick@gitea.io> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
55 lines
2.3 KiB
Go
55 lines
2.3 KiB
Go
package lexers
|
|
|
|
import (
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
"github.com/alecthomas/chroma/lexers/internal"
|
|
)
|
|
|
|
// HLB lexer.
|
|
var HLB = internal.Register(MustNewLexer(
|
|
&Config{
|
|
Name: "HLB",
|
|
Aliases: []string{"hlb"},
|
|
Filenames: []string{"*.hlb"},
|
|
MimeTypes: []string{},
|
|
},
|
|
Rules{
|
|
"root": {
|
|
{`(#.*)`, ByGroups(CommentSingle), nil},
|
|
{`((\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\b)|(\b(0|[1-9][0-9]*)\b))`, ByGroups(LiteralNumber), nil},
|
|
{`((\b(true|false)\b))`, ByGroups(NameBuiltin), nil},
|
|
{`(\bstring\b|\bint\b|\bbool\b|\bfs\b|\boption\b)`, ByGroups(KeywordType), nil},
|
|
{`(\b[a-zA-Z_][a-zA-Z0-9]*\b)(\()`, ByGroups(NameFunction, Punctuation), Push("params")},
|
|
{`(\{)`, ByGroups(Punctuation), Push("block")},
|
|
{`(\n|\r|\r\n)`, Text, nil},
|
|
{`.`, Text, nil},
|
|
},
|
|
"string": {
|
|
{`"`, LiteralString, Pop(1)},
|
|
{`\\"`, LiteralString, nil},
|
|
{`[^\\"]+`, LiteralString, nil},
|
|
},
|
|
"block": {
|
|
{`(\})`, ByGroups(Punctuation), Pop(1)},
|
|
{`(#.*)`, ByGroups(CommentSingle), nil},
|
|
{`((\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\b)|(\b(0|[1-9][0-9]*)\b))`, ByGroups(LiteralNumber), nil},
|
|
{`((\b(true|false)\b))`, ByGroups(KeywordConstant), nil},
|
|
{`"`, LiteralString, Push("string")},
|
|
{`(with)`, ByGroups(KeywordReserved), nil},
|
|
{`(as)([\t ]+)(\b[a-zA-Z_][a-zA-Z0-9]*\b)`, ByGroups(KeywordReserved, Text, NameFunction), nil},
|
|
{`(\bstring\b|\bint\b|\bbool\b|\bfs\b|\boption\b)([\t ]+)(\{)`, ByGroups(KeywordType, Text, Punctuation), Push("block")},
|
|
{`(?!\b(?:scratch|image|resolve|http|checksum|chmod|filename|git|keepGitDir|local|includePatterns|excludePatterns|followPaths|generate|frontendInput|shell|run|readonlyRootfs|env|dir|user|network|security|host|ssh|secret|mount|target|localPath|uid|gid|mode|readonly|tmpfs|sourcePath|cache|mkdir|createParents|chown|createdTime|mkfile|rm|allowNotFound|allowWildcards|copy|followSymlinks|contentsOnly|unpack|createDestPath)\b)(\b[a-zA-Z_][a-zA-Z0-9]*\b)`, ByGroups(NameOther), nil},
|
|
{`(\n|\r|\r\n)`, Text, nil},
|
|
{`.`, Text, nil},
|
|
},
|
|
"params": {
|
|
{`(\))`, ByGroups(Punctuation), Pop(1)},
|
|
{`(variadic)`, ByGroups(Keyword), nil},
|
|
{`(\bstring\b|\bint\b|\bbool\b|\bfs\b|\boption\b)`, ByGroups(KeywordType), nil},
|
|
{`(\b[a-zA-Z_][a-zA-Z0-9]*\b)`, ByGroups(NameOther), nil},
|
|
{`(\n|\r|\r\n)`, Text, nil},
|
|
{`.`, Text, nil},
|
|
},
|
|
},
|
|
))
|