python.nanorc 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ## Here is an example for Python.
  2. ##
  3. syntax "python" "\.py$"
  4. header "^#!.*/(env +)?python( |$)"
  5. ## built-in objects
  6. color cyan "\<(None|self|True|False)\>"
  7. ## built-in attributes
  8. color cyan "\<(__builtin__|__dict__|__methods__|__members__|__class__|__bases__|__import__|__name__|__doc__|__self__|__debug__)\>"
  9. ## built-in functions
  10. color cyan "\<(abs|append|apply|buffer|callable|chr|clear|close|closed|cmp|coerce|compile|complex|conjugate|copy|count|delattr|dir|divmod|eval|execfile|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|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)\>"
  11. ## special method names
  12. 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__)\>"
  13. ## exception classes
  14. # 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)\>"
  15. ## types
  16. 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)\>"
  17. ## definitions
  18. color brightcyan "def [a-zA-Z_0-9]+"
  19. ## keywords
  20. color brightblue "\<(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|with|while|yield)\>"
  21. ## decorators
  22. color brightgreen "@.*[(]"
  23. ## operators
  24. color magenta "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&"
  25. ## parentheses
  26. color magenta "[(){}]" "\[" "\]"
  27. ## numbers
  28. color brightyellow "\b[0-9]+\b"
  29. ## strings
  30. color yellow "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
  31. color yellow "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
  32. ## comments
  33. color green "#.*$"
  34. ## block comments
  35. color green start=""""([^"]|$)" end=""""" start="'''([^']|$)" end="'''"
  36. #color cyan start=""""[^"]" end=""""" start="'''[^']" end="'''"
  37. #color cyan start="([[:space:]]"""|^""")" end=""""" start="'''[^']" end="'''"
  38. #color cyan start=""""" end=""""" start="'''" end="'''"
  39. #color cyan start="("""[^"]|[^"]""")" end="("""[^"]|[^"]""")" start="'''[^']" end="'''"
  40. #color cyan start="\"\"\"" end="\"\"\""