Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
sieve.py79 linesDownload Raw Back to lexers
1"""2    pygments.lexers.sieve3    ~~~~~~~~~~~~~~~~~~~~~4 5    Lexer for Sieve file format.6 7    https://tools.ietf.org/html/rfc52288    https://tools.ietf.org/html/rfc51739    https://tools.ietf.org/html/rfc522910    https://tools.ietf.org/html/rfc523011    https://tools.ietf.org/html/rfc523212    https://tools.ietf.org/html/rfc523513    https://tools.ietf.org/html/rfc542914    https://tools.ietf.org/html/rfc858015 16    :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.17    :license: BSD, see LICENSE for details.18"""19 20from pygments.lexer import RegexLexer, bygroups21from pygments.token import Comment, Name, Literal, String, Text, Punctuation, \22    Keyword23 24__all__ = ["SieveLexer"]25 26 27class SieveLexer(RegexLexer):28    """29    Lexer for sieve format.30    """31    name = 'Sieve'32    filenames = ['*.siv', '*.sieve']33    aliases = ['sieve']34    url = 'https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)'35    version_added = '2.6'36 37    tokens = {38        'root': [39            (r'\s+', Text),40            (r'[();,{}\[\]]', Punctuation),41            # import:42            (r'(?i)require',43             Keyword.Namespace),44            # tags:45            (r'(?i)(:)(addresses|all|contains|content|create|copy|comparator|'46             r'count|days|detail|domain|fcc|flags|from|handle|importance|is|'47             r'localpart|length|lowerfirst|lower|matches|message|mime|options|'48             r'over|percent|quotewildcard|raw|regex|specialuse|subject|text|'49             r'under|upperfirst|upper|value)',50             bygroups(Name.Tag, Name.Tag)),51            # tokens:52            (r'(?i)(address|addflag|allof|anyof|body|discard|elsif|else|envelope|'53             r'ereject|exists|false|fileinto|if|hasflag|header|keep|'54             r'notify_method_capability|notify|not|redirect|reject|removeflag|'55             r'setflag|size|spamtest|stop|string|true|vacation|virustest)',56             Name.Builtin),57            (r'(?i)set',58             Keyword.Declaration),59            # number:60            (r'([0-9.]+)([kmgKMG])?',61             bygroups(Literal.Number, Literal.Number)),62            # comment:63            (r'#.*$',64             Comment.Single),65            (r'/\*.*\*/',66             Comment.Multiline),67            # string:68            (r'"[^"]*?"',69             String),70            # text block:71            (r'text:',72             Name.Tag, 'text'),73        ],74        'text': [75            (r'[^.].*?\n', String),76            (r'^\.', Punctuation, "#pop"),77        ]78    }79 
codekingpro/portable-devtools · Team Ai