comment Written by Peter Varo (c)2013-2014 http://github.com/petervaro/python fileTypes py firstLineMatch ^#!/.*\bpython[\d.-]*\b foldingStartMarker ^\s*(def|class)\s+([.\w>]+)\s*(\((.*)\))?\s*:|\{\s*$|\(\s*$|\[\s*$|^\s*"""(?=.)(?!.*""") foldingStopMarker ^\s*$|^\s*\}|^\s*\]|^\s*\)|^\s*"""\s*$ keyEquivalent ^~P name Python3 patterns match #.*$\n? name comment.line.hashmark.python3 match \b0b[01]+ name constant.numeric.integer.binary.python3 match \b0x\h+ name constant.numeric.integer.hexadecimal.python3 match \b0o[0-7]+ name constant.numeric.integer.octal.python3 match (?<=\W|^)\.\d+([eE][+-]?\d+)?[jJ]? name constant.numeric.float_and_complex.decimal.floatnumber.python3 match \d+\.(\d*([eE][+-]?\d+)?)?[jJ]?(?=\W) name constant.numeric.float_and_complex.decimal.pointfloat.python3 match (?<![\.\d])\d+[eE][+-]?\d+[jJ]? name constant.numeric.float_and_complex.decimal.exponent.python3 match \b(?<!\.)([1-9]\d*|0)[jJ]? name constant.numeric.integer_and_complex.decimal.python3 match \b(global|nonlocal)\b name storage.modifier.declaration.python3 match \b(import|from)\b name keyword.control.import_and_import_from.python3 match \b(elif|else|except|finally|for|if|try|while|with|break|continue|pass|raise|return|yield)\b name keyword.control.flow_block_delimiters.python3 match \b(and|in|is|not|or)\b name keyword.operator.bool.logical.python3 match \b(as|assert|del)\b name keyword.other.python3 match <=|>=|==|<|>|!= name keyword.operator.comparison.python3 match \+=|-=|\*=|/=|//=|%=|&=|\|=|\^=|<<=|>>=|\*\*= name keyword.operator.assignment.augmented.python3 match \+|-|\*|\*\*|/|//|%|<<|>>|&|\||\^|~ name keyword.operator.arithmetic.python3 match =|-> name keyword.operator.value_and_annotation_assignment.python3 begin ^\s*(class)\s+(?=[a-zA-Z_]\w*(\s*\()?) beginCaptures 1 name storage.type.class.python3 end (\)?\s*:|\s+([\w#\s:]+)) endCaptures 3 name invalid.illegal.missing_section_begin.python3 name meta.class.python3 patterns begin (?=[a-zA-Z_]\w*) contentName entity.name.type.class.python3 end (?!\w) patterns include #entity_name_class begin \( contentName meta.class.inheritance.python3 end \)|: patterns begin (?<=\(|,)\s* contentName entity.other.inherited-class.python3 end \s*(?:,|(?=\))) endCaptures 1 name punctuation.separator.inheritance.python3 patterns include $self begin ^\s*(def)\s+(?=[a-zA-Z_]\w*\s*\() beginCaptures 1 name storage.type.function.python3 end (\s*:) endCaptures 2 name invalid.illegal.missing_section_begin.python3 name meta.function.python3 patterns begin (?=[a-zA-Z_]\w*) contentName entity.name.function.python3 end (?!\w) patterns include #entity_name_function begin \( end (?=\)) patterns begin \b([a-zA-Z_]\w*)\s*(=) beginCaptures 1 name variable.parameter.function.python3 2 name keyword.operator.assignment.python3 end (?=,|[\n)]) patterns begin (?<=(=))\s* beginCaptures 1 name keyword.operator.assignment.python3 end (?=,|[\n)]) patterns include $self begin (?<=:)\s* end (?=,|(=)|[\n)]) endCaptures 1 name keyword.operator.assignment.python3 patterns include $self begin \b([a-zA-Z_]\w*)\s* beginCaptures 1 name variable.parameter.function.python3 end (?=,|[\n)]) patterns begin (?<=:)\s* end (?=,|[\n)]) patterns include $self begin (?<=\))\s*(->)\s* beginCaptures 1 name keyword.operator.annotation.assignment.python3 end (?=\s*:) patterns include $self begin \b(lambda) beginCaptures 1 name storage.type.function.anonymous.python3 end : name meta.function.anonymous.python3 patterns begin \s+ end (?=:) patterns begin \b([a-zA-Z_]\w*)\s*(=) beginCaptures 1 name variable.parameter.function.python3 2 name keyword.operator.assignment.python3 end (?=,|:) patterns include $self match \b[a-zA-Z_]\w* name variable.parameter.function.python3 begin ^\s*(@\s*[a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*)\s*\( beginCaptures 1 name support.function.decorator.python3 end \) name meta.function.decorator.with_arguments.python3 patterns include #keyword_arguments include $self begin ^\s*(@\s*[a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*) beginCaptures 1 name support.function.decorator.python3 end (?=\s|$\n?|#) name meta.function.decorator.without_arguments.python3 match \b(None|True|False|Ellipsis|NotImplemented)\b name constant.language.word_like.python3 match (?<=\W|^)\.\.\.(?=\W|$) name constant.language.symbol_like.python3 match \b(def|lambda)\b name storage.type.function.python3 match \b(class)\b name storage.type.class.python3 include #builtin_types include #builtin_functions include #builtin_exceptions include #magic_function_names include #magic_variable_names include #line_continuation include #language_variables begin \[ end \] name meta.structure.list.python3 patterns begin (?<=\[|,)\s*(?![\],]) end \s*(?:,|(?=\])) patterns include $self begin { end } name meta.structure.dictionary.python3 patterns begin (?<={|,|^)\s*(?![,}]) end \s*(?:(?=\})|(\:)) patterns include $self begin (?<=:|^)\s* end \s*(?:(?=\}|,)) patterns include $self begin (?<=,|;|=|\+|-|\*|/|\||:|<|>|~|%|\^|\\)\s*\( end \) name meta.structure.group.python3 patterns include $self begin (?<!:|,|;|\[|\{|\}|=|\+|-|\*|/|\||<|>|~|%|\^|\\|\n)\s*\( end \) name meta.function_call.python3 patterns include #keyword_arguments include $self include #string_quoted repository builtin_exceptions match (?<!\.)\b((Arithmetic|Buffer|Lookup|Assertion|Attribute|EOF|FloatingPoint|Import|Index|Key|Memory|Name|NotImplemented|OS|Overflow|Reference|Runtime|Syntax|Indentation|Tab|System|Type|UnboundLocal|Unicode|Unicode(Encode|Decode|Translate)?|Value|ZeroDivision|Environment|IO|VMS|Windows|BlockingIO|ChildProcess|BrokenPipe|Connection(Aborted|Refused|Reset)?|FileExists|FileNotFound|Interrupted|(Is|Not)ADirectory|Permission|ProcessLookup|Timeout)Error|(User|Deprecation|PendingDeprecation|Syntax|Runtime|Future|Import|Bytes|Resource)Warning|(Base)?Exception|(Generator|System)Exit|KeyboardInterrupt|StopIteration|Warning)\b name support.type.exception.python3 builtin_functions match (?<!\.)\b(__import__|abs|all|any|ascii|bin|callable|chr|compile|delattr|dir|divmod|eval|exec|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|min|next|oct|ord|pow|print|range|repr|round|setattr|sorted|sum|vars|zip)\b name support.function.builtin.python3 builtin_types match (?<!\.)\b(basestring|bool|bytearray|bytes|classmethod|complex|dict|enumerate|float|frozenset|int|list|memoryview|object|open|property|reversed|set|slice|staticmethod|str|super|tuple|type)\b name support.type.python3 constant_placeholder match %(\(\w+\))?#?0?-?[ ]?\+?(\d*|\*)(\.(\d*|\*))?[hlL]?[diouxXeEfFgGcrs%] name string.interpolated.placeholder.python3 entity_name_class patterns include #illegal_names include #generic_names entity_name_function patterns include #magic_function_names include #illegal_names include #generic_names escaped_characters match \\(x\h{2}|[0-7]{3}|\n|\"|\'|a|b|f|n|r|t|v|\\) name constant.character.escaped.special.python3 escaped_unicode_characters match \\(u\h{4}|U\h{8}|N\{[a-zA-Z\s]+\}) name constant.character.escaped.python3 format_mini_language patterns match \{\} name constant.other.placeholder.format.python3 generic_names match [a-zA-Z_]\w* illegal_names match \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 name invalid.illegal_names.name.python3 keyword_arguments begin \b([a-zA-Z_]\w*)\s*(=)(?!=) beginCaptures 1 name variable.parameter.function.python3 2 name keyword.operator.assignment.python3 end (?=,|[\n)]) patterns include $self language_variables match (?<!\.)\b(self|cls)\b name variable.language.python3 line_continuation captures 1 name punctuation.separator.continuation.line.python3 2 name invalid.illegal.unexpected_text.python3 match (\\)(.*)$\n? magic_function_names match \b__(abs|add|and|bool|bytes|call|ceil|complex|contains|copy|deepcopy|del|delattr|delete|delitem|dir|div|divmod|enter|eq|exit|float|floor|floordiv|format|ge|get|getattr|getattribute|getinitargs|getitem|getnewargs|getstate|gt|hash|hex|iadd|iand|idiv|ifloordiv|ilshift|imul|index|init|instancecheck|int|invert|ior|ipow|irshift|isub|iter|itruediv|ixor|le|len|lshift|lt|metaclass|missing|mod|mul|ne|neg|new|next|oct|or|pos|pow|prepare|radd|rand|rdiv|rdivmod|reduce|reduce_ex|repr|reversed|rfloordiv|rlshift|rmod|rmul|ror|round|rpow|rrshift|rshift|rsub|rtruediv|rxor|set|setattr|setitem|setstate|sizeof|str|sub|subclasscheck|subclasshook|truediv|trunc|unicode|weakref|xor)__\b name support.function.magic.python3 magic_variable_names match \b__(all|annotations|bases|builtins|class|debug|dict|doc|file|members|metaclass|mro|name|qualname|slots|weakref)__\b name support.variable.magic.python3 regular_expressions patterns match \\[bBAZzG]|\^|\$ name keyword.control.anchor.regex.python3 match \\[1-9]\d? name keyword.other.group_reference_order.regex.python3 match \(\?P=[a-zA-Z_]\w*\) name keyword.other.group_reference_name.regex.python3 match [?+*][?+]?|\{(\d+,\d+|\d+,|,\d+|\d+)\}\?? name keyword.operator.quantifier.regex.python3 match \| name keyword.operator.or.regex.python3 begin \(\?# end \) name comment.block.regex.python3 match \(\?[aiLmsux]+\) name keyword.other.option_toggle.regex.python3 begin \(\?(=|!|<=|<!|:|P<[a-z]\w*>|\(([1-9]\d?|[a-zA-Z_]\w*\)))? end \) name meta.group.assertion.regex.python3 patterns include #regular_expressions include #regular_expressions_escaped_characters include #regular_expressions_character_classes regular_expressions_character_classes patterns match \\[wWsSdD]|\. name constant.character.character_class.regex.python3 begin \[(\^)?(\](?=.*\]))? beginCaptures 1 name keyword.operator.negation.regex.python3 end (?<!\\)\] name constant.other.character_class.set.regex.python3 patterns match \[ name constant.character.escaped.special.open.regex.python3 include #regular_expressions_character_classes include #regular_expressions_escaped_characters regular_expressions_escaped_characters match \\(\\|\?|\.|\*|\+|\{|\}|\||\(|\)|\[|\]|\^|\$) name constant.character.escaped.special.regex.python3 string_patterns patterns include #constant_placeholder include #escaped_characters include #escaped_unicode_characters string_quoted patterns begin ([bBuU]?)''' beginCaptures 1 name storage.type.string.prefix.python3 end ''' name string.quoted.single.block.python3 patterns include #string_patterns begin ([rR][bB]|[bB][rR]|[rR])''' beginCaptures 1 name storage.type.string.prefix.python3 end ''' name string.quoted.single.block.python3 patterns include #string_patterns include #regular_expressions begin ([bBuU]?)' beginCaptures 1 name storage.type.string.prefix.python3 end '|(\n) endCaptures 1 name invalid.illegal.unclosed_string.python3 name string.quoted.single.line.python3 patterns include #string_patterns begin ([rR][bB]|[bB][rR]|[rR])' beginCaptures 1 name storage.type.string.prefix.python3 end '|(\n) endCaptures 1 name invalid.illegal.unclosed_string.python3 name string.quoted.single.line.python3 patterns include #string_patterns include #regular_expressions begin ([bBuU]?)""" beginCaptures 1 name storage.type.string.prefix.python3 end """ name string.quoted.double.block.python3 patterns include #string_patterns begin ([rR][bB]|[bB][rR]|[rR])""" beginCaptures 1 name storage.type.string.prefix.python3 end """ name string.quoted.double.block.python3 patterns include #string_patterns include #regular_expressions begin ([bBuU]?)" beginCaptures 1 name storage.type.string.prefix.python3 end "|(\n) endCaptures 1 name invalid.illegal.unclosed_string.python3 name string.quoted.double.line.python3 patterns include #string_patterns begin ([rR][bB]|[bB][rR]|[rR])" beginCaptures 1 name storage.type.string.prefix.python3 end "|(\n) endCaptures 1 name invalid.illegal.unclosed_string.python3 name string.quoted.double.line.python3 patterns include #string_patterns include #regular_expressions scopeName source.python3 uuid 851B1429-B8B4-4C1E-8030-399BDA994393