github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/misc/xcode/3/go.xclangspec (about) 1 /* 2 Copyright 2009 The Go Authors. All rights reserved. 3 Use of this source code is governed by a BSD-style 4 license that can be found in the LICENSE file. 5 6 Go.xclangspec 7 Go language specification for Xcode 3 8 9 This is a preliminary version that supports basic syntax high-lighting 10 (such as keywords, literals, and comments) and an attempt to provide 11 some structure information (incomplete). 12 13 There is not much documentation available regarding the format 14 of .xclangspec files. As a starting point, see for instance the 15 outdated documentation at: 16 http://maxao.free.fr/xcode-plugin-interface/specifications.html 17 and the files in: 18 /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/ 19 20 Place this file in directory: 21 ~/Library/Application Support/Developer/Shared/Xcode/Specifications/ 22 */ 23 24 ( 25 26 // ---------------------------------------------------------------------------- 27 // Keywords 28 29 // TODO How do we get general Unicode identifiers? 30 31 { 32 Identifier = "xcode.lang.go.identifier"; 33 Syntax = { 34 StartChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"; 35 Chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; 36 Words = ( 37 "break", 38 "case", 39 "chan", 40 "const", 41 "continue", 42 43 "default", 44 "defer", 45 "else", 46 "fallthrough", 47 "for", 48 49 "func", 50 "go", 51 "goto", 52 "if", 53 "import", 54 55 "interface", 56 "map", 57 "package", 58 "range", 59 "return", 60 61 "select", 62 "struct", 63 "switch", 64 "type", 65 "var", 66 ); 67 Type = "xcode.syntax.keyword"; 68 AltType = "xcode.syntax.identifier"; // non-keywords are identifiers 69 }; 70 }, 71 72 // TODO decide what should go here, if anything 73 { 74 Identifier = "xcode.lang.go.interestingOperators"; 75 Syntax = { 76 Words = ( 77 "...", 78 ".", 79 "*", 80 ",", 81 ":", 82 ); 83 Type = "xcode.syntax.plain"; 84 }; 85 }, 86 87 { 88 Identifier = "xcode.lang.go.rawstring"; 89 Syntax = { 90 Start = "`"; 91 End = "`"; 92 Type = "xcode.syntax.string"; 93 }; 94 }, 95 96 // ---------------------------------------------------------------------------- 97 // Syntax Coloring 98 99 { 100 Identifier = "xcode.lang.go"; 101 Description = "Go Coloring"; 102 BasedOn = "xcode.lang.simpleColoring"; 103 IncludeInMenu = YES; 104 Name = "Go"; 105 Syntax = { 106 Tokenizer = "xcode.lang.go.lexer.toplevel"; 107 IncludeRules = ( 108 "xcode.lang.go.block", 109 "xcode.lang.go.bracketexpr", 110 "xcode.lang.go.parenexpr", 111 ); 112 Type = "xcode.syntax.plain"; 113 }; 114 }, 115 116 // The following rule returns tokens to the other rules 117 { 118 Identifier = "xcode.lang.go.lexer"; 119 Syntax = { 120 IncludeRules = ( 121 "xcode.lang.go.comment", 122 "xcode.lang.go.comment.singleline", 123 "xcode.lang.string", 124 "xcode.lang.character", 125 "xcode.lang.go.rawstring", 126 "xcode.lang.go.identifier", 127 "xcode.lang.number", 128 "xcode.lang.go.interestingOperators", 129 ); 130 }; 131 }, 132 133 { 134 Identifier = "xcode.lang.go.lexer.toplevel"; 135 Syntax = { 136 IncludeRules = ( 137 "xcode.lang.go.comment", 138 "xcode.lang.go.comment.singleline", 139 "xcode.lang.string", 140 "xcode.lang.character", 141 "xcode.lang.go.rawstring", 142 "xcode.lang.go.type.declaration", 143 "xcode.lang.go.method.declaration", 144 "xcode.lang.go.function.declaration", 145 "xcode.lang.go.identifier", 146 "xcode.lang.number", 147 ); 148 }; 149 }, 150 151 { 152 Identifier = "xcode.lang.go.method.declaration"; 153 Syntax = { 154 Tokenizer = "xcode.lang.go.lexer"; 155 Rules = ( 156 "func", 157 "xcode.lang.go.parenexpr", 158 "xcode.lang.go.identifier", 159 "xcode.lang.go.parenexpr", 160 ); 161 Type = "xcode.syntax.declaration.method"; 162 }; 163 }, 164 165 { 166 Identifier = "xcode.lang.go.type.declaration"; 167 Syntax = { 168 Tokenizer = "xcode.lang.go.lexer"; 169 Rules = ( 170 "type", 171 "xcode.lang.go.identifier", 172 ); 173 Type = "xcode.syntax.typedef"; 174 }; 175 }, 176 177 { 178 Identifier = "xcode.lang.go.function.declaration"; 179 Syntax = { 180 Tokenizer = "xcode.lang.go.lexer"; 181 Rules = ( 182 "func", 183 "xcode.lang.go.identifier", 184 "xcode.lang.go.parenexpr", 185 ); 186 Type = "xcode.syntax.declaration.function"; 187 }; 188 }, 189 190 // ---------------------------------------------------------------------------- 191 // Blocks 192 193 { 194 Identifier = "xcode.lang.go.block"; 195 Syntax = { 196 Tokenizer = "xcode.lang.go.lexer"; 197 Start = "{"; 198 End = "}"; 199 Foldable = YES; 200 Recursive = YES; 201 IncludeRules = ( 202 "xcode.lang.go.bracketexpr", 203 "xcode.lang.go.parenexpr", 204 ); 205 }; 206 }, 207 208 { 209 Identifier = "xcode.lang.go.parenexpr"; 210 Syntax = { 211 Tokenizer = "xcode.lang.go.lexer"; 212 Start = "("; 213 End = ")"; 214 Recursive = YES; 215 IncludeRules = ( 216 "xcode.lang.go.bracketexpr", 217 "xcode.lang.go.block", 218 ); 219 }; 220 }, 221 222 { 223 Identifier = "xcode.lang.go.bracketexpr"; 224 Syntax = { 225 Tokenizer = "xcode.lang.go.lexer"; 226 Start = "["; 227 End = "]"; 228 Recursive = YES; 229 IncludeRules = ( 230 "xcode.lang.go.parenexpr", 231 ); 232 }; 233 }, 234 235 { 236 Identifier = "xcode.lang.go.comment"; 237 Syntax = { 238 Start = "/*"; 239 End = "*/"; 240 Foldable = YES; 241 IncludeRules = ( 242 "xcode.lang.url", 243 "xcode.lang.url.mail", 244 "xcode.lang.comment.mark", 245 ); 246 Type = "xcode.syntax.comment"; 247 }; 248 }, 249 250 { 251 Identifier = "xcode.lang.go.comment.singleline"; 252 Syntax = { 253 Start = "//"; 254 End = "\n"; 255 IncludeRules = ( 256 "xcode.lang.url", 257 "xcode.lang.url.mail", 258 "xcode.lang.comment.mark", 259 ); 260 Type = "xcode.syntax.comment"; 261 }; 262 }, 263 264 // This rule recognizes special comments markers and adds them 265 // to the list of file markers at the top of the editor window. 266 // This overrides the markers specified in 267 // /Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/BaseSupport.xclangspec 268 // and appears to apply them to all languages. Thus, for now 269 // "inherit" the existing markers here for backward-compatibility. 270 { 271 Identifier = "xcode.lang.comment.mark"; 272 Syntax = { 273 StartChars = "BMTF!?"; 274 Match = ( 275 // Go-specific markers 276 "^\(BUG.*$\)$", // include "BUG" in the markers list 277 "^\(TODO.*$\)$", // include "TODO" in the markers list 278 // inherited markers 279 "^MARK:[ \t]+\(.*\)$", 280 "^\(TODO:[ \t]+.*\)$", // include "TODO: " in the markers list 281 "^\(FIXME:[ \t]+.*\)$", // include "FIXME: " in the markers list 282 "^\(!!!:.*\)$", // include "!!!:" in the markers list 283 "^\(\\?\\?\\?:.*\)$" // include "???:" in the markers list 284 ); 285 // This is the order of captures. All of the match strings above need the same order. 286 CaptureTypes = ( 287 "xcode.syntax.mark" 288 ); 289 Type = "xcode.syntax.comment"; 290 }; 291 }, 292 293 )