1package r 2 3import ( 4 . "github.com/alecthomas/chroma" // nolint 5 "github.com/alecthomas/chroma/lexers/internal" 6) 7 8// Rexx lexer. 9var Rexx = internal.Register(MustNewLexer( 10 &Config{ 11 Name: "Rexx", 12 Aliases: []string{"rexx", "arexx"}, 13 Filenames: []string{"*.rexx", "*.rex", "*.rx", "*.arexx"}, 14 MimeTypes: []string{"text/x-rexx"}, 15 NotMultiline: true, 16 CaseInsensitive: true, 17 }, 18 Rules{ 19 "root": { 20 {`\s`, TextWhitespace, nil}, 21 {`/\*`, CommentMultiline, Push("comment")}, 22 {`"`, LiteralString, Push("string_double")}, 23 {`'`, LiteralString, Push("string_single")}, 24 {`[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?`, LiteralNumber, nil}, 25 {`([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b`, ByGroups(NameFunction, TextWhitespace, Operator, TextWhitespace, KeywordDeclaration), nil}, 26 {`([a-z_]\w*)(\s*)(:)`, ByGroups(NameLabel, TextWhitespace, Operator), nil}, 27 Include("function"), 28 Include("keyword"), 29 Include("operator"), 30 {`[a-z_]\w*`, Text, nil}, 31 }, 32 "function": { 33 {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}, 34 }, 35 "keyword": { 36 {`(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}, 37 }, 38 "operator": { 39 {`(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|¬>>|¬>|¬|\.|,)`, Operator, nil}, 40 }, 41 "string_double": { 42 {`[^"\n]+`, LiteralString, nil}, 43 {`""`, LiteralString, nil}, 44 {`"`, LiteralString, Pop(1)}, 45 {`\n`, Text, Pop(1)}, 46 }, 47 "string_single": { 48 {`[^\'\n]`, LiteralString, nil}, 49 {`\'\'`, LiteralString, nil}, 50 {`\'`, LiteralString, Pop(1)}, 51 {`\n`, Text, Pop(1)}, 52 }, 53 "comment": { 54 {`[^*]+`, CommentMultiline, nil}, 55 {`\*/`, CommentMultiline, Pop(1)}, 56 {`\*`, CommentMultiline, nil}, 57 }, 58 }, 59)) 60