Changes between Version 5 and Version 6 of ETextEditorSupport
- Timestamp:
- 06/19/09 07:31:00 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ETextEditorSupport
v5 v6 1 = Draft for `TextMate`-like editor syntax file = 2 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`. 1 = !E-!TextEditor, !InType, etc. !TextMate-based language syntax = 2 3 1. Open the bundle editor: "Bundles" -> "Edit Bundles" -> "Show Bundle Editor" 4 2. Add a bundle named "Cobra" (if you do not already have one) 5 3. Add a language file name "Cobra" 6 4. Paste the code below 7 5. Save the language file 8 9 All files with the Cobra extension will now be highlighted per the grammars found in the file. 10 At the moment enough grammars to get by is presented. Please discuss improvements or make them 11 yourself using the guidelines at [http://manual.macromates.com/en/language_grammars TextMate Manual Language Grammars]. 3 12 4 13 {{{ 14 #!python 5 15 { 6 16 "patterns" : [ … … 10 20 }, 11 21 { 12 "name" : "constant.numeric.integer.long.hexadecimal.cobra", 13 "match" : "\\b(?i:(0x\\h*)L)" 14 }, 15 { 16 "name" : "constant.numeric.integer.hexadecimal.cobra", 17 "match" : "\\b(?i:(0x\\h*))" 18 }, 19 { 20 "name" : "constant.numeric.integer.long.octal.cobra", 21 "match" : "\\b(?i:(0[0-7]+)L)" 22 }, 23 { 24 "name" : "constant.numeric.integer.octal.cobra", 25 "match" : "\\b(0[0-7]+)" 26 }, 27 { 28 "name" : "constant.numeric.complex.cobra", 29 "match" : "\\b(?i:(((\\d+(\\.(?=[^a-zA-Z_])\\d*)?|(?<=[^0-9a-zA-Z_])\\.\\d+)(e[\\-\\+]?\\d+)?))J)" 22 "name" : "constant.numeric.hexadecimal.cobra", 23 "match" : "\\b(?i:(0x\\h*)L?)" 24 }, 25 { 26 "name" : "constant.numeric.octal.cobra", 27 "match" : "\\b(?i:(0[0-7]+)L?)" 30 28 }, 31 29 { … … 50 48 }, 51 49 { 52 "name" : " constant.keyword.control.cobra",53 "match" : "\\b( branch|on|else|except|finally|for|if|try|while|break|continue|pass|raise|return|using|yield)\\b"50 "name" : "keyword.control.cobra", 51 "match" : "\\b(inherits|branch|on|else|catch|finally|for|if|try|while|break|continue|pass|raise|return|using|yield)\\b" 54 52 }, 55 53 { … … 74 72 }, 75 73 { 76 "match" : "\\s*(use )\\s+([a-zA-Z0-9_.]+)$",74 "match" : "\\s*(use|namespace)\\s+([a-zA-Z0-9_.]+)$", 77 75 "captures" : { 78 76 "1" : { 79 "name" : "keyword.other. use.cobra"77 "name" : "keyword.other.namespacing.cobra" 80 78 }, 81 79 "2" : { 82 "name" : " support.class.cobra"80 "name" : "constant.class.cobra" 83 81 } 84 82 } … … 92 90 { 93 91 "name" : "storage.type.function.cobra", 94 "match" : "\\b(def|cue )\\b"92 "match" : "\\b(def|cue|get|set|test|ensure|body|require)\\b" 95 93 }, 96 94 { 97 95 "name" : "support.function.cobra", 98 "match" : "\\b(base| test|require|ensure|var|get|(?<!is\\s)shared)\\b",96 "match" : "\\b(base|(?<!is\\s)shared)\\b", 99 97 "comment" : "language variables that are builtin" 100 98 }, … … 103 101 "patterns" : [ 104 102 { 105 "include" : "#escaped _characters"103 "include" : "#escaped-characters" 106 104 } 107 105 ], … … 113 111 "patterns" : [ 114 112 { 115 "include" : "#escaped _characters"113 "include" : "#escaped-characters" 116 114 } 117 115 ], … … 129 127 }, 130 128 { 129 "include" : "#type" 130 }, 131 { 131 132 "begin" : "\\b(?:class)\\s*([a-zA-Z0-9_]+)", 132 133 "patterns" : [ 133 134 { 134 135 "name" : "keyword.operator.cobra", 135 "match" : "(inherits|implements )"136 "match" : "(inherits|implements|is|partial)" 136 137 }, 137 138 { … … 140 141 }, 141 142 { 142 "name" : "support.name.generic.cobra", 143 "match" : "<\\s*of\\s+[a-zA-Z0-9]+>" 143 "include" : "#type" 144 144 } 145 145 ], … … 153 153 }, 154 154 { 155 "begin" : "^\\s*( ?:def)\\s*([a-zA-Z0-9_]+)",155 "begin" : "^\\s*(def|cue|get|pro)\\s+([a-zA-Z0-9_]+)", 156 156 "patterns" : [ 157 157 { 158 158 "include" : "#argument-list" 159 }, 160 { 161 "name" : "keyword.operator.from.cobra", 162 "match" : "\\bfrom|as\\b" 163 }, 164 { 165 "name" : "support.variable.cobra", 166 "match" : "\\bvar\\b" 159 167 } 160 168 ], … … 163 171 "beginCaptures" : { 164 172 "1" : { 173 "name" : "keyword.operator.method.cobra" 174 }, 175 "2" : { 165 176 "name" : "entity.name.type.cobra" 166 177 } … … 178 189 "argument-list" : { 179 190 "begin" : "\\(", 191 "patterns" : [ 192 { 193 "include" : "#type" 194 }, 195 { 196 "name" : "keyword.operator.cast.cobra", 197 "match" : "\\bas\\b" 198 } 199 ], 180 200 "endCaptures" : { 181 201 "0" : "support" … … 186 206 } 187 207 }, 188 "constant_placeholder" : { 189 "name" : "constant.other.placeholder.cobra", 190 "match" : "(?i:%(\\([a-z_]+\\))?#?0?\\-?[ ]?\\+?([0-9]*|\\*)(\\.([0-9]*|\\*))?[hL]?[a-z%])" 191 }, 192 "generic_names" : { 193 "match" : "[A-Za-z_][A-Za-z0-9_]*" 194 }, 195 "escaped_characters" : { 208 "escaped-characters" : { 196 209 "name" : "constant.character.escape.cobra", 197 210 "match" : "(\\\\x[0-9A-F]{2})|(\\\\[0-7]{3})|(\\\\\\n)|(\\\\\\\\)|(\\\\\\\")|(\\\\')|(\\\\a)|(\\\\b)|(\\\\f)|(\\\\n)|(\\\\r)|(\\\\t)|(\\\\v)" 211 }, 212 "type" : { 213 "match" : "(?<=as|\\=)\\s+([A-Z][a-zA-Z0-9_]+)\\s*(\\??|<\\s*of\\s+[a-zA-Z0-9]+>)?", 214 "captures" : { 215 "1" : { 216 "name" : "entity.name.class.cobra" 217 }, 218 "2" : { 219 "name" : "entity.name.generic.cobra" 220 } 221 } 198 222 } 199 223 }, 200 224 "firstLineMatch" : "^#!/.*\\bcobra\\b" 201 225 } 202 203 226 }}}