mirror of
https://github.com/go-gitea/gitea
synced 2024-12-24 22:54:35 +01:00
86e2789960
* update github.com/PuerkitoBio/goquery * update github.com/alecthomas/chroma * update github.com/blevesearch/bleve/v2 * update github.com/caddyserver/certmagic * update github.com/go-enry/go-enry/v2 * update github.com/go-git/go-billy/v5 * update github.com/go-git/go-git/v5 * update github.com/go-redis/redis/v8 * update github.com/go-testfixtures/testfixtures/v3 * update github.com/jaytaylor/html2text * update github.com/json-iterator/go * update github.com/klauspost/compress * update github.com/markbates/goth * update github.com/mattn/go-isatty * update github.com/mholt/archiver/v3 * update github.com/microcosm-cc/bluemonday * update github.com/minio/minio-go/v7 * update github.com/prometheus/client_golang * update github.com/unrolled/render * update github.com/xanzy/go-gitlab * update github.com/yuin/goldmark * update github.com/yuin/goldmark-highlighting Co-authored-by: techknowlogick <techknowlogick@gitea.io>
58 lines
2.3 KiB
Go
Vendored
58 lines
2.3 KiB
Go
Vendored
package h
|
|
|
|
import (
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
"github.com/alecthomas/chroma/lexers/internal"
|
|
)
|
|
|
|
// HLB lexer.
|
|
var HLB = internal.Register(MustNewLazyLexer(
|
|
&Config{
|
|
Name: "HLB",
|
|
Aliases: []string{"hlb"},
|
|
Filenames: []string{"*.hlb"},
|
|
MimeTypes: []string{},
|
|
},
|
|
hlbRules,
|
|
))
|
|
|
|
func hlbRules() Rules {
|
|
return 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},
|
|
},
|
|
}
|
|
}
|