= Draft for TextMate-like editor syntax file = Initial attempt at creating a syntax for use in editors such as E-TextEditor, and InType. These are windows editors that mimic TextMate hence it should be similar for TextMate. {{{ { "patterns" : [ { "name" : "comment.line.cobra", "match" : "(#).*$" }, { "name" : "constant.numeric.integer.long.hexadecimal.cobra", "match" : "\\b(?i:(0x\\h*)L)" }, { "name" : "constant.numeric.integer.hexadecimal.cobra", "match" : "\\b(?i:(0x\\h*))" }, { "name" : "constant.numeric.integer.long.octal.cobra", "match" : "\\b(?i:(0[0-7]+)L)" }, { "name" : "constant.numeric.integer.octal.cobra", "match" : "\\b(0[0-7]+)" }, { "name" : "constant.numeric.complex.cobra", "match" : "\\b(?i:(((\\d+(\\.(?=[^a-zA-Z_])\\d*)?|(?<=[^0-9a-zA-Z_])\\.\\d+)(e[\\-\\+]?\\d+)?))J)" }, { "name" : "constant.numeric.float.cobra", "match" : "\\b(?i:(\\d+\\.\\d*(e[\\-\\+]?\\d+)?))(?=[^a-zA-Z_])" }, { "name" : "constant.numeric.float.cobra", "match" : "(?<=[^0-9a-zA-Z_])(?i:(\\.\\d+(e[\\-\\+]?\\d+)?))" }, { "name" : "constant.numeric.float.cobra", "match" : "\\b(?i:(\\d+e[\\-\\+]?\\d+))" }, { "name" : "constant.numeric.integer.long.decimal.cobra", "match" : "\\b(?i:([1-9]+[0-9]*|0)L)" }, { "name" : "constant.numeric.integer.decimal.cobra", "match" : "\\b([1-9]+[0-9]*|0)" }, { "name" : "keyword.control.cobra", "match" : "\\b(branch|on|else|except|finally|for|if|try|while|break|continue|pass|raise|return|yield)\\b" }, { "name" : "keyword.operator.logical.cobra", "match" : "\\b(and|in|not|or)\\b" }, { "name" : "keyword.other.cobra", "match" : "\\b(as|assert|print|var|use|inherits|is|shared)\\b" }, { "name" : "keyword.operator.comparison.cobra", "match" : "<\\=|>\\=|\\=\\=|<|>|<>" }, { "name" : "keyword.operator.assignment.cobra", "match" : "\\=|\\+\\=|-\\=|\\*\\=|/\\=|//\\=|%\\=|&\\=|\\|\\=|\\^\\=|>>\\=|<<\\=|\\*\\*\\=" }, { "name" : "keyword.operator.arithmetic.cobra", "match" : "\\+|\\-|\\*|\\*\\*|/|//|%|<<|>>|&|\\||\\^|~" }, { "begin" : "^\\s*\"\"\"\\s+", "name" : "comment.block.cobra", "comment" : "comment blocks including docstrings", "end" : "^\\s*\"\"\"$" }, { "begin" : "(?<=\\)|\\])\\s*(\\[)", "patterns" : [ { "include" : "$self" } ], "name" : "meta.item-access.cobra", "contentName" : "meta.item-access.arguments.cobra", "endCaptures" : { "1" : { "name" : "punctuation.definition.arguments.end.cobra" } }, "end" : "(\\])", "beginCaptures" : { "1" : { "name" : "punctuation.definition.arguments.begin.cobra" } } }, { "name" : "storage.type.class.cobra", "match" : "\\b(class)\\b" }, { "name" : "storage.type.function.cobra", "match" : "\\b(def|cue|get)\\b" }, { "name" : "support.function.cobra", "match" : "\\b(base)\\b", "comment" : "language variables that are builtin" }, { "begin" : "(\\()", "patterns" : [ { "include" : "$self" } ], "end" : "(\\))" }, { "match" : "(\\[)(\\s*(\\]))\\b", "captures" : { "3" : { "name" : "punctuation.definition.list.end.cobra" }, "1" : { "name" : "punctuation.definition.list.begin.cobra" }, "2" : { "name" : "meta.empty-list.cobra" } } }, { "begin" : "(\\[)", "patterns" : [ { "begin" : "(?<=\\[|\\,)\\s*(?![\\],])", "patterns" : [ { "include" : "$self" } ], "contentName" : "meta.structure.list.item.cobra", "endCaptures" : { "1" : { "name" : "punctuation.separator.list.cobra" } }, "end" : "\\s*(?:(,)|(?=\\]))" } ], "name" : "meta.structure.list.cobra", "endCaptures" : { "1" : { "name" : "punctuation.definition.list.end.cobra" } }, "end" : "(\\])", "beginCaptures" : { "1" : { "name" : "punctuation.definition.list.begin.cobra" } } }, { "name" : "meta.structure.tuple.cobra", "match" : "(\\()(\\s*(\\)))", "captures" : { "3" : { "name" : "punctuation.definition.tuple.end.cobra" }, "1" : { "name" : "punctuation.definition.tuple.begin.cobra" }, "2" : { "name" : "meta.empty-tuple.cobra" } } }, { "name" : "meta.structure.dictionary.cobra", "match" : "(\\{)(\\s*(\\}))", "captures" : { "3" : { "name" : "punctuation.definition.dictionary.end.cobra" }, "1" : { "name" : "punctuation.definition.dictionary.begin.cobra" }, "2" : { "name" : "meta.empty-dictionary.cobra" } } }, { "begin" : "(\\{)", "patterns" : [ { "begin" : "(?<=\\{|\\,|^)\\s*(?![\\},])", "patterns" : [ { "include" : "$self" } ], "contentName" : "meta.structure.dictionary.key.cobra", "endCaptures" : { "1" : { "name" : "punctuation.separator.valuepair.dictionary.cobra" } }, "end" : "\\s*(?:(?=\\})|(\\:))" }, { "begin" : "(?<=\\:|^)\\s*", "patterns" : [ { "include" : "$self" } ], "contentName" : "meta.structure.dictionary.value.cobra", "endCaptures" : { "1" : { "name" : "punctuation.separator.dictionary.cobra" } }, "end" : "\\s*(?:(?=\\})|(,))" } ], "name" : "meta.structure.dictionary.cobra", "endCaptures" : { "1" : { "name" : "punctuation.definition.dictionary.end.cobra" } }, "end" : "(\\})", "beginCaptures" : { "1" : { "name" : "punctuation.definition.dictionary.begin.cobra" } } }, { "begin" : "'", "name" : "string.quoted.single.cobra", "comment" : "single quoted strings", "end" : "'" }, { "name" : "support.type.cobra", "match" : "\\b(bool|char|int|uint|float|decimal|number|dynamic|int8|int16|int32|int64|uint8|uint16|uint32|uint64)\\b", "comment" : "list of native primitive types" }, { "name" : "support.class.cobra", "match" : "\\b(String|List|Dictionary|Set|Stack|Queue|TextWriter|TextReader|StringBuilder)(?:\\?)?\\s*()\\b", } ], "name" : "Cobra", "scopeName" : "source.cobra", "fileTypes" : [ "cobra" ], "foldingStopMarker" : "^\\s*$", "foldingStartMarker" : "^\\s*(def|class|cue)(.*)", "repository" : { "constant_placeholder" : { "name" : "constant.other.placeholder.cobra", "match" : "(?i:%(\\([a-z_]+\\))?#?0?\\-?[ ]?\\+?([0-9]*|\\*)(\\.([0-9]*|\\*))?[hL]?[a-z%])" }, "keyword_arguments" : { "begin" : "\\b([a-zA-Z_][a-zA-Z_0-9]*)\\s*(=)(?!=)", "patterns" : [ { "include" : "$self" } ], "endCaptures" : { "1" : { "name" : "punctuation.separator.parameters.cobra" } }, "end" : "\\s*(?:(,)|(?=$\\n?|[\\)]))", "beginCaptures" : { "1" : { "name" : "variable.parameter.function.cobra" }, "2" : { "name" : "keyword.operator.assignment.cobra" } } }, "generic_names" : { "match" : "[A-Za-z_][A-Za-z0-9_]*" } }, "firstLineMatch" : "^#!/.*\\bcobra\\b" } }}}