/usr/share/highlight/langDefs/python.lang is in highlight-common 3.41-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | Description="Python"
Digits=[[ (?:0x|0X|0o|0O|0b|0B)[0-9a-fA-F\_]+|\d*[\.\_]?[\d\_]+(?:[eE][\-\+]\d+)?[lLuU]* ]]
Keywords={
{ Id=1,
List={ "break", "continue", "del", "except", "exec", "finally", "pass",
"print", "raise", "return", "try", "global", "assert", "lambda", "yield", "def",
"class", "for", "while", "if", "elif", "else", "and", "in", "is", "not", "or",
"import", "from", "as", "async", "await", "None", "True", "False"}
},
{ Id=2,
List={ "bool", "enumerate", "set", "frozenset", "help", "reversed", "sorted",
"sum", "Ellipsis", "NotImplemented", "__import__", "abs", "apply", "buffer",
"callable", "chr", "classmethod", "cmp", "coerce", "compile", "complex",
"delattr", "dict", "dir", "divmod", "eval", "execfile", "file", "filter",
"float", "getattr", "globals", "hasattr", "hash", "hex", "id", "input", "int",
"intern", "isinstance", "issubclass", "iter", "len", "list", "locals", "long",
"map", "max", "min", "object", "oct", "open", "ord", "pow", "property", "range",
"raw_input", "reduce", "reload", "repr", "round", "setattr", "slice",
"staticmethod", "str", "super", "tuple", "type", "unichr", "unicode", "vars",
"xrange", "zip"}
},
-- decorators:
{ Id=2,
Regex=[[@\w+]],
},
{ Id=3,
List={ "ArithmeticError", "AssertionError", "AttributeError",
"DeprecationWarning", "EOFError", "EnvironmentError", "Exception",
"FloatingPointError", "IOError", "ImportError", "IndentationError",
"IndexError", "KeyError", "KeyboardInterrupt", "LookupError", "MemoryError",
"NameError", "NotImplementedError", "OSError", "OverflowError",
"OverflowWarning", "ReferenceError", "RuntimeError", "RuntimeWarning",
"StandardError", "StopIteration", "SyntaxError", "SyntaxWarning", "SystemError",
"SystemExit", "TabError", "TypeError", "UnboundLocalError", "UnicodeError",
"UnicodeEncodeError", "UnicodeDecodeError", "UnicodeTranslateError",
"UserWarning", "ValueError", "Warning", "WindowsError", "ZeroDivisionError"}
},
{ Id=4,
Regex=[[(\w+)\s*\(]],
},
}
Strings={
Delimiter=[["""|'''|"|']],
RawPrefix="r",
Escape=[=[\\[ntvbrfa\\\?'"]|\\\d{3}|\\x[[:xdigit:]]{2}]=],
Interpolation=[[ %[%#0\-\+diouxXeEfFgGcrs]+|%\(\w+\)[sd]?|\{\w+\} ]]
}
IgnoreCase=false
Comments={
{ Block=false,
Delimiter= { [[#]] },
},
}
Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\.|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\@]]
function OnStateChange(oldState, newState, token, groupID)
if oldState==HL_STANDARD and string.sub(token,1,1)=="%" then
return HL_OPERATOR
end
return newState
end
|