]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/python3.micro
adding hexidecimal numbers to the existing C syntax rules
[micro.git] / runtime / syntax / python3.micro
1 ## Here is an example for Python.
2 ##
3 syntax "python3" "\.py$"
4 header "^#!.*/(env +)?python3$"
5
6 ## built-in objects
7 color constant "\b(None|self|True|False)\b"
8 ## built-in attributes
9 color constant "\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\b"
10 ## built-in functions
11 color identifier "\b(abs|all|any|ascii|bin|callable|chr|compile|delattr|dir|divmod|eval|exec|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|max|min|next|oct|open|ord|pow|print|repr|round|setattr|sorted|sum|vars|__import__)\b"
12 ## some standard library methods / attributes
13 #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"
14 ## special method names
15 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__|__dict__|__long__|__lshift__|__mod__|__mul__|__neg__|__next__|__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"
16 ## exception classes
17 # 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"
18 ## types
19 color type "\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)"
20 #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|TracebackType|FrameType|SliceType|EllipsisType)\b"
21 ## definitions
22 color identifier "def [a-zA-Z_0-9]+" 
23 ## keywords
24 color statement "\b(and|as|assert|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)\b" 
25
26 ## decorators
27 color brightgreen "@.*[(]"
28
29 ## operators
30 color statement "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&"
31
32 ## parentheses
33 color statement "[(){}]" "\[" "\]"
34
35 ## numbers
36 color constant.number "\b[0-9]+\b"
37
38 ## strings
39 color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
40
41 ## brightblacks
42 color comment "#.*$"
43
44 ## block brightblacks
45 color comment start=""""([^"]|$)" end="""""
46 color comment start="'''([^']|$)" end="'''"