|
| 1 | +package s |
| 2 | + |
| 3 | +import ( |
| 4 | + . "github.com/alecthomas/chroma" // nolint |
| 5 | + "github.com/alecthomas/chroma/lexers/internal" |
| 6 | +) |
| 7 | + |
| 8 | +// Sieve lexer. |
| 9 | +var Sieve = internal.Register(MustNewLazyLexer( |
| 10 | + &Config{ |
| 11 | + Name: "Sieve", |
| 12 | + Aliases: []string{"sieve"}, |
| 13 | + Filenames: []string{"*.siv", "*.sieve"}, |
| 14 | + MimeTypes: []string{}, |
| 15 | + }, |
| 16 | + func() Rules { |
| 17 | + return Rules{ |
| 18 | + "root": { |
| 19 | + {`\s+`, Text, nil}, |
| 20 | + {`[();,{}\[\]]`, Punctuation, nil}, |
| 21 | + {`(?i)require`, KeywordNamespace, nil}, |
| 22 | + {`(?i)(:)(addresses|all|contains|content|create|copy|comparator|count|days|detail|domain|fcc|flags|from|handle|importance|is|localpart|length|lowerfirst|lower|matches|message|mime|options|over|percent|quotewildcard|raw|regex|specialuse|subject|text|under|upperfirst|upper|value)`, ByGroups(NameTag, NameTag), nil}, |
| 23 | + {`(?i)(address|addflag|allof|anyof|body|discard|elsif|else|envelope|ereject|exists|false|fileinto|if|hasflag|header|keep|notify_method_capability|notify|not|redirect|reject|removeflag|setflag|size|spamtest|stop|string|true|vacation|virustest)`, NameBuiltin, nil}, |
| 24 | + {`(?i)set`, KeywordDeclaration, nil}, |
| 25 | + {`([0-9.]+)([kmgKMG])?`, ByGroups(LiteralNumber, LiteralNumber), nil}, |
| 26 | + {`#.*$`, CommentSingle, nil}, |
| 27 | + {`/\*.*\*/`, CommentMultiline, nil}, |
| 28 | + {`"[^"]*?"`, LiteralString, nil}, |
| 29 | + {`text:`, NameTag, Push("text")}, |
| 30 | + }, |
| 31 | + "text": { |
| 32 | + {`[^.].*?\n`, LiteralString, nil}, |
| 33 | + {`^\.`, Punctuation, Pop(1)}, |
| 34 | + }, |
| 35 | + } |
| 36 | + }, |
| 37 | +)) |
0 commit comments