mirror of
https://github.com/go-gitea/gitea
synced 2024-12-23 23:56:00 +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>
64 lines
2.6 KiB
Go
Vendored
64 lines
2.6 KiB
Go
Vendored
package r
|
|
|
|
import (
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
"github.com/alecthomas/chroma/lexers/internal"
|
|
)
|
|
|
|
// Rexx lexer.
|
|
var Rexx = internal.Register(MustNewLazyLexer(
|
|
&Config{
|
|
Name: "Rexx",
|
|
Aliases: []string{"rexx", "arexx"},
|
|
Filenames: []string{"*.rexx", "*.rex", "*.rx", "*.arexx"},
|
|
MimeTypes: []string{"text/x-rexx"},
|
|
NotMultiline: true,
|
|
CaseInsensitive: true,
|
|
},
|
|
rexxRules,
|
|
))
|
|
|
|
func rexxRules() Rules {
|
|
return Rules{
|
|
"root": {
|
|
{`\s`, TextWhitespace, nil},
|
|
{`/\*`, CommentMultiline, Push("comment")},
|
|
{`"`, LiteralString, Push("string_double")},
|
|
{`'`, LiteralString, Push("string_single")},
|
|
{`[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?`, LiteralNumber, nil},
|
|
{`([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b`, ByGroups(NameFunction, TextWhitespace, Operator, TextWhitespace, KeywordDeclaration), nil},
|
|
{`([a-z_]\w*)(\s*)(:)`, ByGroups(NameLabel, TextWhitespace, Operator), nil},
|
|
Include("function"),
|
|
Include("keyword"),
|
|
Include("operator"),
|
|
{`[a-z_]\w*`, Text, nil},
|
|
},
|
|
"function": {
|
|
{Words(``, `(\s*)(\()`, `abbrev`, `abs`, `address`, `arg`, `b2x`, `bitand`, `bitor`, `bitxor`, `c2d`, `c2x`, `center`, `charin`, `charout`, `chars`, `compare`, `condition`, `copies`, `d2c`, `d2x`, `datatype`, `date`, `delstr`, `delword`, `digits`, `errortext`, `form`, `format`, `fuzz`, `insert`, `lastpos`, `left`, `length`, `linein`, `lineout`, `lines`, `max`, `min`, `overlay`, `pos`, `queued`, `random`, `reverse`, `right`, `sign`, `sourceline`, `space`, `stream`, `strip`, `substr`, `subword`, `symbol`, `time`, `trace`, `translate`, `trunc`, `value`, `verify`, `word`, `wordindex`, `wordlength`, `wordpos`, `words`, `x2b`, `x2c`, `x2d`, `xrange`), ByGroups(NameBuiltin, TextWhitespace, Operator), nil},
|
|
},
|
|
"keyword": {
|
|
{`(address|arg|by|call|do|drop|else|end|exit|for|forever|if|interpret|iterate|leave|nop|numeric|off|on|options|parse|pull|push|queue|return|say|select|signal|to|then|trace|until|while)\b`, KeywordReserved, nil},
|
|
},
|
|
"operator": {
|
|
{`(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|¬>>|¬>|¬|\.|,)`, Operator, nil},
|
|
},
|
|
"string_double": {
|
|
{`[^"\n]+`, LiteralString, nil},
|
|
{`""`, LiteralString, nil},
|
|
{`"`, LiteralString, Pop(1)},
|
|
{`\n`, Text, Pop(1)},
|
|
},
|
|
"string_single": {
|
|
{`[^\'\n]`, LiteralString, nil},
|
|
{`\'\'`, LiteralString, nil},
|
|
{`\'`, LiteralString, Pop(1)},
|
|
{`\n`, Text, Pop(1)},
|
|
},
|
|
"comment": {
|
|
{`[^*]+`, CommentMultiline, nil},
|
|
{`\*/`, CommentMultiline, Pop(1)},
|
|
{`\*`, CommentMultiline, nil},
|
|
},
|
|
}
|
|
}
|