Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pygments/lexers/console.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:16 +0000

1""" 

2 pygments.lexers.console 

3 ~~~~~~~~~~~~~~~~~~~~~~~ 

4 

5 Lexers for misc console output. 

6 

7 :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. 

8 :license: BSD, see LICENSE for details. 

9""" 

10 

11from pygments.lexer import RegexLexer, include, bygroups 

12from pygments.token import Generic, Comment, String, Text, Keyword, Name, \ 

13 Punctuation, Number, Whitespace 

14 

15__all__ = ['VCTreeStatusLexer', 'PyPyLogLexer'] 

16 

17 

18class VCTreeStatusLexer(RegexLexer): 

19 """ 

20 For colorizing output of version control status commands, like "hg 

21 status" or "svn status". 

22 

23 .. versionadded:: 2.0 

24 """ 

25 name = 'VCTreeStatus' 

26 aliases = ['vctreestatus'] 

27 filenames = [] 

28 mimetypes = [] 

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 .. versionadded:: 1.5 

50 """ 

51 name = "PyPy Log" 

52 aliases = ["pypylog", "pypy"] 

53 filenames = ["*.pypylog"] 

54 mimetypes = ['application/x-pypylog'] 

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 }