Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
console.py115 linesDownload Raw Back to lexers
1"""2    pygments.lexers.console3    ~~~~~~~~~~~~~~~~~~~~~~~4 5    Lexers for misc console output.6 7    :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.8    :license: BSD, see LICENSE for details.9"""10 11from pygments.lexer import RegexLexer, include, bygroups12from pygments.token import Generic, Comment, String, Text, Keyword, Name, \13    Punctuation, Number, Whitespace14 15__all__ = ['VCTreeStatusLexer', 'PyPyLogLexer']16 17 18class VCTreeStatusLexer(RegexLexer):19    """20    For colorizing output of version control status commands, like "hg21    status" or "svn status".22    """23    name = 'VCTreeStatus'24    aliases = ['vctreestatus']25    filenames = []26    mimetypes = []27    url = ""28    version_added = '2.0'29 30    tokens = {31        'root': [32            (r'^A  \+  C\s+', Generic.Error),33            (r'^A\s+\+?\s+', String),34            (r'^M\s+', Generic.Inserted),35            (r'^C\s+', Generic.Error),36            (r'^D\s+', Generic.Deleted),37            (r'^[?!]\s+', Comment.Preproc),38            (r'      >\s+.*\n', Comment.Preproc),39            (r'\S+', Text),40            (r'\s+', Whitespace),41        ]42    }43 44 45class PyPyLogLexer(RegexLexer):46    """47    Lexer for PyPy log files.48    """49    name = "PyPy Log"50    aliases = ["pypylog", "pypy"]51    filenames = ["*.pypylog"]52    mimetypes = ['application/x-pypylog']53    url = 'pypy.org'54    version_added = '1.5'55 56    tokens = {57        "root": [58            (r"\[\w+\] \{jit-log-.*?$", Keyword, "jit-log"),59            (r"\[\w+\] \{jit-backend-counts$", Keyword, "jit-backend-counts"),60            include("extra-stuff"),61        ],62        "jit-log": [63            (r"\[\w+\] jit-log-.*?}$", Keyword, "#pop"),64            (r"^\+\d+: ", Comment),65            (r"--end of the loop--", Comment),66            (r"[ifp]\d+", Name),67            (r"ptr\d+", Name),68            (r"(\()(\w+(?:\.\w+)?)(\))",69             bygroups(Punctuation, Name.Builtin, Punctuation)),70            (r"[\[\]=,()]", Punctuation),71            (r"(\d+\.\d+|inf|-inf)", Number.Float),72            (r"-?\d+", Number.Integer),73            (r"'.*'", String),74            (r"(None|descr|ConstClass|ConstPtr|TargetToken)", Name),75            (r"<.*?>+", Name.Builtin),76            (r"(label|debug_merge_point|jump|finish)", Name.Class),77            (r"(int_add_ovf|int_add|int_sub_ovf|int_sub|int_mul_ovf|int_mul|"78             r"int_floordiv|int_mod|int_lshift|int_rshift|int_and|int_or|"79             r"int_xor|int_eq|int_ne|int_ge|int_gt|int_le|int_lt|int_is_zero|"80             r"int_is_true|"81             r"uint_floordiv|uint_ge|uint_lt|"82             r"float_add|float_sub|float_mul|float_truediv|float_neg|"83             r"float_eq|float_ne|float_ge|float_gt|float_le|float_lt|float_abs|"84             r"ptr_eq|ptr_ne|instance_ptr_eq|instance_ptr_ne|"85             r"cast_int_to_float|cast_float_to_int|"86             r"force_token|quasiimmut_field|same_as|virtual_ref_finish|"87             r"virtual_ref|mark_opaque_ptr|"88             r"call_may_force|call_assembler|call_loopinvariant|"89             r"call_release_gil|call_pure|call|"90             r"new_with_vtable|new_array|newstr|newunicode|new|"91             r"arraylen_gc|"92             r"getarrayitem_gc_pure|getarrayitem_gc|setarrayitem_gc|"93             r"getarrayitem_raw|setarrayitem_raw|getfield_gc_pure|"94             r"getfield_gc|getinteriorfield_gc|setinteriorfield_gc|"95             r"getfield_raw|setfield_gc|setfield_raw|"96             r"strgetitem|strsetitem|strlen|copystrcontent|"97             r"unicodegetitem|unicodesetitem|unicodelen|"98             r"guard_true|guard_false|guard_value|guard_isnull|"99             r"guard_nonnull_class|guard_nonnull|guard_class|guard_no_overflow|"100             r"guard_not_forced|guard_no_exception|guard_not_invalidated)",101             Name.Builtin),102            include("extra-stuff"),103        ],104        "jit-backend-counts": [105            (r"\[\w+\] jit-backend-counts}$", Keyword, "#pop"),106            (r":", Punctuation),107            (r"\d+", Number),108            include("extra-stuff"),109        ],110        "extra-stuff": [111            (r"\s+", Whitespace),112            (r"#.*?$", Comment),113        ],114    }115 
codekingpro/portable-devtools · Team Ai