-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython.nanorc
51 lines (36 loc) · 2.76 KB
/
python.nanorc
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
# Syntax highlighting for Python.
syntax python "\.py$"
header "^#!.*/(env +)?python3?( |$)"
comment "# "
tabgives " "
# Keywords.
color blue "\<(and|as|assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\>"
color blue "\<(match|case|type|_)\>"
# Built-in Constants.
color yellow "\<(False|True|None|NotImplemented|Ellipsis|__debug__)\>"
# Built-in Types.
color yellow "\<(bool|int|float|complex|list|tuple|range|str|bytes|bytearray|memoryview|set|frozenset|dict)\>"
# Built-in Exception.
color yellow "\<(BaseException|BaseExceptionGroup|GeneratorExit|KeyboardInterrupt|SystemExit|Exception)\>"
color yellow "\<(ArithmeticError|FloatingPointError|OverflowError|ZeroDivisionError|AssertionError|AttributeError|BufferError|EOFError|ExceptionGroup|ImportError|ModuleNotFoundError|LookupError|IndexError|KeyError|MemoryError|NameError|UnboundLocalError|OSError|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|ReferenceError|RuntimeError|NotImplementedError|RecursionError|StopAsyncIteration|StopIteration|SyntaxError|IndentationError|TabError|SystemError|TypeError|ValueError|UnicodeError|UnicodeDecodeError|UnicodeEncodeError|UnicodeTranslateError)\>"
color yellow "\<(Warning|BytesWarning|DeprecationWarning|EncodingWarning|FutureWarning|ImportWarning|PendingDeprecationWarning|ResourceWarning|RuntimeWarning|SyntaxWarning|UnicodeWarning|UserWarning)\>"
# Built-in Functions.
color magenta "\<(abs|aiter|all|anext|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)\("
color normal "(\.[a-z_]+)?\("
# Functions and Classes.
color magenta "\<(def|class) [A-Za-z_][0-9A-Za-z_]*"
color blue "\<(def|class) "
icolor magenta "^ *@[a-z_][0-9a-z_]*(\.[a-z_][0-9a-z_]*)*"
# Numbers.
icolor yellow "\<[0-9]+(_[0-9])*(\.[0-9]*(_[0-9])*)?(e[+-]?[0-9]+)?j?\>"
# Strings.
icolor green "r?[bf]?"([^"\]|\\.)*""
icolor green "r?[bf]?'([^'\]|\\.)*'"
# Comments
color red "^ *#.*$"
color red "#("([^"\]|\\.)*"|'([^'\]|\\.)*'|[^"'])*$"
# Multiline strings.
icolor green start="r?[bf]?"""" end="(^|[^"\]|\\.)""""
icolor green start="r?[bf]?'''" end="(^|[^'\]|\\.)'''"
# Trailing whitespaces.
color ,green " +$"