## INFO ######################################################################## ## ## ## Coconut Syntax Highlighter ## ## ===================================== ## ## ## ## Version: 2.0.00.015 (20141006) ## ## File: sublime_coconut/specification.coco ## ## ## ## For more information about the project, please visit ## ## ## ## Copyright (C) 2013 - 2014 Peter Varo ## ## ## ## Copyright (C) 2016 Evan Hubinger ## ## ## ## This program is free software: you can redistribute it and/or modify it ## ## under the terms of the GNU General Public License as published by the ## ## Free Software Foundation, either version 3 of the License, or ## ## (at your option) any later version. ## ## ## ## This program is distributed in the hope that it will be useful, but ## ## WITHOUT ANY WARRANTY; without even the implied warranty of ## ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ## ## See the GNU General Public License for more details. ## ## ## ## You should have received a copy of the GNU General Public License ## ## along with this program, most likely a file in the root directory, ## ## called 'LICENSE'. If not, see . ## ## ## ######################################################################## INFO ## #-- CHEATSHEET ----------------------------------------------------------------# # HOWTO: http://sublimetext.info/docs/en/reference/syntaxdefs.html # REGEX: http://manual.macromates.com/en/regular_expressions # Import python modules from copy import deepcopy # Import user modules from .common import syntax as original # Syntax Definition syntax = deepcopy(original) # Auto-recognition syntax['fileTypes'] = ['coc', 'coco', 'coconut', 'py_template'] syntax['keyEquivalent'] = '^~O' # Shebang syntax['firstLineMatch'] = r'^#!/.*\bcoconut[\d.-]*\b' # Folding marks for the TextEditor syntax['foldingStartMarker'] = (r'^\s*((async|match|addpattern|yield|copyclosure|case)\s+)*(def|class|(?]+)\s*(\((.*)\))?\s*:' r'|\{\s*$|\(\s*$|\[\s*$|^\s*"""(?=.)(?!.*""")') syntax['foldingStopMarker'] = r'^\s*$|^\s*\}|^\s*\]|^\s*\)|^\s*"""\s*$' # Language ID syntax['uuid'] = '7da2bcb1-621d-43b0-a187-c42d158b22ed' # Patterns syntax['patterns'].update({ #-- COMMENT -------------------------------------------------------------------# # ALL ARE COMMON #-- KEYWORDS ------------------------------------------------------------------# 0x0080: { 'name' : 'storage.modifier.declaration.{SCOPE}', 'match': r'\b(global|nonlocal)\b' }, 0x0090: { 'name' : 'keyword.control.import_and_import_from.{SCOPE}', 'match': r'\b(lazy|import|from)\b' }, 0x00A0: { 'name' : 'keyword.control.flow_block_delimiters.{SCOPE}', 'match': ( r'\b(elif|else|except|finally|for|if|try|while|' r'with|break|continue|pass|raise|return|yield|' r'(? what is builtin function and what is builtin type? 'builtin_functions': { 'name' : 'support.function.builtin.{SCOPE}', 'match': ( r'(? what is magic function and what is magic variable? 'magic_function_names': { 'name' : 'support.function.magic.{SCOPE}', 'match': ( r'\b__(' r'abs|add|and|await|bool|bytes|call|ceil|complex|contains|copy|' r'deepcopy|del|delattr|delete|delitem|dir|div|divmod|a?enter|eq|' r'a?exit|float|floor|floordiv|format|ge|get|getattr|getattribute|' r'getinitargs|getitem|getnewargs|getstate|gt|hash|hex|iadd|' r'iand|idiv|ifloordiv|ilshift|imul|index|init|instancecheck|' r'int|invert|ior|ipow|irshift|isub|a?iter|itruediv|ixor|le|len|' r'lshift|lt|metaclass|missing|mod|mul|ne|neg|new|a?next|oct|or|' r'pos|pow|prepare|radd|rand|rdiv|rdivmod|reduce|reduce_ex|' r'repr|reversed|rfloordiv|rlshift|rmod|rmul|ror|round|rpow|' r'rrshift|rshift|rsub|rtruediv|rxor|set|setattr|setitem|' r'setstate|sizeof|str|sub|subclasscheck|subclasshook|truediv|' r'trunc|unicode|weakref|xor|matmul|fmap|set_name|iter_getitem' r')__\b' ) }, #-- STRING --------------------------------------------------------------------# # ALL ARE COMMON #-- REGEX ---------------------------------------------------------------------# # ALL ARE COMMON })