mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-05 22:50:21 +09:00
fixes in python (2.7) syntax file, and rename to python2.micro
constants: sort by name, and __file__, remove __import__ functions: add next, help, __import__ separate types (like int and str) from builtin functions separate and comment out methods/attrs of standard library (why hightlight?) comment out NonSenseTypes like IntType, they are never used in code magic methods: add __dict__ exec and map are functions, not keyword remove trailing spaces
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,43 +0,0 @@
|
||||
## Here is an example for Python.
|
||||
##
|
||||
syntax "python" "\.py$"
|
||||
header "^#!.*/(env +)?python( |$)"
|
||||
|
||||
## built-in objects
|
||||
color constant "\b(None|self|True|False)\b"
|
||||
## built-in attributes
|
||||
color constant "\b(__builtin__|__dict__|__methods__|__members__|__class__|__bases__|__import__|__name__|__doc__|__self__|__debug__)\b"
|
||||
## built-in functions
|
||||
color identifier "\b(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)\b"
|
||||
## special method names
|
||||
color identifier "\b(__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__)\b"
|
||||
## exception classes
|
||||
# color cyan "\b(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)\b"
|
||||
## types
|
||||
color type "\b(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)\b"
|
||||
## definitions
|
||||
color identifier "def [a-zA-Z_0-9]+"
|
||||
## keywords
|
||||
color statement "\b(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)\b"
|
||||
|
||||
## decorators
|
||||
color brightgreen "@.*[(]"
|
||||
|
||||
## operators
|
||||
color statement "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&"
|
||||
|
||||
## parentheses
|
||||
color statement "[(){}]" "\[" "\]"
|
||||
|
||||
## numbers
|
||||
color constant.number "\b[0-9]+\b"
|
||||
|
||||
## strings
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
|
||||
## brightblacks
|
||||
color comment "#.*$"
|
||||
|
||||
## block brightblacks
|
||||
color comment start=""""([^"]|$)" end="""""
|
||||
color comment start="'''([^']|$)" end="'''"
|
||||
46
runtime/syntax/python2.micro
Normal file
46
runtime/syntax/python2.micro
Normal file
@@ -0,0 +1,46 @@
|
||||
## Here is an example for Python.
|
||||
##
|
||||
syntax "python" "\.py$"
|
||||
header "^#!.*/(env +)?python( |$)"
|
||||
|
||||
## built-in objects
|
||||
color constant "\b(None|self|True|False)\b"
|
||||
## built-in attributes
|
||||
color constant "\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\b"
|
||||
## built-in functions
|
||||
color identifier "\b(abs|apply|callable|chr|cmp|compile|delattr|dir|divmod|eval|exec|execfile|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|len|locals|max|min|next|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|unichr|vars|zip|__import__)\b"
|
||||
## some standard library methods / attributes
|
||||
#color identifier "\b(append|clear|close|closed|coerce|conjugate|copy|count|extend|fileno|flush|get|has_key|index|insert|items|read|readline|readlines|isatty|keys|mode|name|pop|remove|reverse|seek|softspace|sort|tell|truncate|write|writelines|update|values)\b"
|
||||
## special method names
|
||||
color identifier "\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__dict__|__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__)\b"
|
||||
## exception classes
|
||||
# color cyan "\b(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)\b"
|
||||
## types
|
||||
color type "\b(basestring|bool|buffer|bytearray|bytes|classmethod|complex|dict|enumerate|file|float|frozenset|int|list|long|map|memoryview|object|property|reversed|set|slice|staticmethod|str|super|tuple|type|unicode|xrange)"
|
||||
#color type "\b(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)\b"
|
||||
## definitions
|
||||
color identifier "def [a-zA-Z_0-9]+"
|
||||
## keywords
|
||||
color statement "\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\b"
|
||||
|
||||
## decorators
|
||||
color brightgreen "@.*[(]"
|
||||
|
||||
## operators
|
||||
color statement "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&"
|
||||
|
||||
## parentheses
|
||||
color statement "[(){}]" "\[" "\]"
|
||||
|
||||
## numbers
|
||||
color constant.number "\b[0-9]+\b"
|
||||
|
||||
## strings
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
|
||||
## brightblacks
|
||||
color comment "#.*$"
|
||||
|
||||
## block brightblacks
|
||||
color comment start=""""([^"]|$)" end="""""
|
||||
color comment start="'''([^']|$)" end="'''"
|
||||
Reference in New Issue
Block a user