Skip to content

Commit 7062015

Browse files
authored
Merge pull request #11 from davidhcefx/py-enh
enh(py): Improve colorings and bug fix
2 parents 843be17 + eeae80d commit 7062015

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

python.nanorc

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ color cyan "\<(__builtin__|__dict__|__methods__|__members__|__class__|__bases__|
1414
## built-in functions
1515
color cyan "\<(abs|append|apply|buffer|callable|chr|clear|close|closed|cmp|coerce|compile|complex|conjugate|copy|count|delattr|dir|divmod|eval|execfile|exec|extend|fileno|filter|float|flush|get|getattr|globals|has_key|hasattr|hash|hex|id|index|input|insert|int|intern|isatty|isinstance|issubclass|items|keys|len|list|locals|long|map|max|min|mode|name|oct|open|ord|pop|pow|print|range|raw_input|read|readline|readlines|reduce|reload|remove|repr|reverse|round|seek|setattr|slice|softspace|sort|str|tell|truncate|tuple|type|unichr|unicode|update|values|vars|write|writelines|xrange|zip|bool)\>"
1616
## built-in functions that were previously keywords
17-
color brightblue "\<(print|exec)\>([[:space:]]|$)"
17+
color brightcyan "\<(print|exec)\>([[:space:]]|$)"
1818
## special method names
1919
color cyan "\<(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__|__bool__)\>"
2020
## exception classes
21-
color cyan "\<(Exception|StandardError|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|EOFError|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RuntimeError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)\>"
21+
color green "\<(Exception|StandardError|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|EOFError|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RuntimeError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)\>"
2222
## types
23-
color brightcyan "\<(NoneType|TypeType|IntType|LongType|FloatType|ComplexType|StringType|UnicodeType|BufferType|TupleType|ListType|DictType|FunctionType|LambdaType|CodeType|ClassType|UnboundMethodType|InstanceType|MethodType|BuiltinFunctionType|BuiltinMethodType|ModuleType|FileType|XRangeType|TracebackType|FrameType|SliceType|EllipsisType)\>"
23+
color green "\<(NoneType|TypeType|IntType|LongType|FloatType|ComplexType|StringType|UnicodeType|BufferType|TupleType|ListType|DictType|FunctionType|LambdaType|CodeType|ClassType|UnboundMethodType|InstanceType|MethodType|BuiltinFunctionType|BuiltinMethodType|ModuleType|FileType|XRangeType|TracebackType|FrameType|SliceType|EllipsisType)\>"
2424
## definitions
25-
color brightcyan "def [a-zA-Z_0-9]+"
25+
color green "def [a-zA-Z_0-9]+"
2626
## keywords
27-
color brightblue "\<(and|as|assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|raise|return|try|with|while|yield)\>"
27+
color brightred "\<(and|as|from|import|not|or)\>"
28+
color brightcyan "\<(assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|global|if|in|is|lambda|map|pass|raise|return|try|with|while|yield)\>"
2829

2930
## decorators
30-
color brightgreen "@.*[(]"
31+
color brightgreen "@[a-zA-Z_0-9]+"
3132

3233
## operators
3334
color magenta "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&"
@@ -40,17 +41,18 @@ icolor brightyellow "\b(([1-9][0-9]+)|0+)\.[0-9]+j?\b" "\b([1-9][0-9]*[Lj]?)\b"
4041

4142

4243
## strings
43-
color yellow "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
44-
color yellow "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
44+
color yellow "['](\\.|[^'])*[']" "[']{3}(\\.|.)*[']{3}"
45+
color yellow "["](\\.|[^"])*["]" "["]{3}(\\.|.)*["]{3}"
4546

4647
## comments
47-
color green "^#.*|[[:space:]]#.*$"
48+
color brightblue "^#.*|[[:space:]]#.*$"
4849

4950
## block comments
50-
color yellow start=""""[^"]" end=""""" start="'''[^']" end="'''"
51+
color yellow start=""""([^"),]|$)" end="(^|[^(\])""""
52+
color yellow start="'''([^'),]|$)" end="(^|[^(\])'''"
5153
5254
## trailing spaces
5355
color ,green "[[:space:]]+$"
5456
5557
## reminders
56-
color brightwhite,yellow "(FIXME|TODO|XXX)"
58+
color brightwhite,yellow "\<(FIXME|TODO|XXX)\>"

0 commit comments

Comments
 (0)