go.jsf (9248B)
1 # Google Go (golang) syntax 2 # (c) 2012 Matthias S. Benkmann 3 # License: http://creativecommons.org/licenses/by/3.0/deed.en_US 4 5 # Small modifications by jjjordan to better suit white backgrounds and 16-color 6 # consoles. (Original colors commented out below) 7 8 # Standard colors: 9 # 10 # Foreground: 11 # white cyan magenta blue yellow green red black 12 # 13 # Background: 14 # bg_white bg_cyan bg_magenta bg_blue bg_yellow bg_green bg_red bg_black 15 # 16 # 17 # For 16 color and 256 color xterms: "export TERM=xterm-16color", the following 18 # brighter than normal colors are available ( Note that you need an xterm which 19 # was compiled to support 16 or 256 colors and a matching termcap/terminfo entry 20 # for it.) 21 # 22 # Foreground: 23 # WHITE CYAN MAGENTA BLUE YELLOW GREEN RED BLACK 24 # 25 # Background: 26 # bg_WHITE bg_CYAN bg_MAGENTA bg_BLUE bg_YELLOW bg_GREEN bg_RED bg_BLACK 27 # 28 # 29 # For 256 color xterm: "export TERM=xterm-256color", the following become available 30 # ( Note that you need an xterm which was compiled to support 256 colors and a 31 # matching termcap/terminfo entry for it. ) 32 # 33 # fg_RGB and bg_RGB, where R, G, and B range from 0 - 5. So: fg_500 is bright red. 34 # 35 # fg_NN and bg_NN give shades of grey, where the intensity, NN, ranges from 0 - 23. 36 37 38 =Idle 39 =Error red bold 40 =Comment green #bold green 41 =SingleQuoted cyan 42 =DoubleQuoted cyan 43 =BackQuoted cyan 44 =Escape bold cyan 45 =Operator bold cyan 46 =Parentheses #bold yellow 47 =Brackets yellow 48 =Brace magenta #bold magenta 49 =Semicolon #bold yellow 50 =Period bold 51 =PeriodDecimal red 52 =Number red 53 =Constant red 54 =Comma #bold yellow 55 =Identifier #fg_333 56 =ExportedIdentifier #fg_444 57 =Keyword bold 58 =Type bold 59 =BuiltinFunction bold 60 61 ##################### main ######################### 62 :main Idle 63 * keyword_or_identifier noeat buffer 64 " \t" main 65 "\n" main 66 "/" maybe_comment recolor=-1 67 "'" single_quoted recolor=-1 68 "\"" double_quoted recolor=-1 69 "`" back_quoted recolor=-1 70 "+&=!|*^<>:%-" operator noeat 71 "()" parentheses noeat 72 "[]" brackets noeat 73 "{}" curlies noeat 74 ";" semicolon noeat 75 "," comma noeat 76 "." period 77 "0" number0 recolor=-1 78 "1-9" float recolor=-1 79 "#$@~" error noeat 80 81 #################### error ########################## 82 :error Error 83 * error 84 "\n" main 85 "/" maybe_comment_err recolor=-1 86 87 :maybe_comment_err Operator 88 * error noeat recolor=-2 89 "/" line_comment recolor=-2 90 "*" block_comment recolor=-2 91 92 ################## comments ######################### 93 :maybe_comment Operator 94 * main noeat 95 "/" line_comment recolor=-2 96 "*" block_comment recolor=-2 97 98 :line_comment Comment 99 * line_comment 100 "\n" main 101 102 :block_comment Comment 103 * block_comment 104 "*" maybe_end_block_comment 105 106 :maybe_end_block_comment Comment 107 * block_comment noeat 108 "/" main 109 110 ################ strings ############################ 111 :single_quoted SingleQuoted 112 * single_quoted 113 "'" main 114 "\\" single_quoted call=.escape() recolor=-1 115 "\n" error 116 117 :double_quoted DoubleQuoted 118 * double_quoted 119 "\"" main 120 "\\" double_quoted call=.escape() recolor=-1 121 "\n" error 122 123 :back_quoted BackQuoted 124 * back_quoted 125 "`" main 126 127 ################### operators ####################### 128 :operator Operator 129 * main 130 131 :parentheses Parentheses 132 * main 133 134 :brackets Brackets 135 * main 136 137 :curlies Brace 138 * main 139 140 :semicolon Semicolon 141 * main 142 143 :comma Comma 144 * main 145 146 ##################### period ####################### 147 148 :period Period 149 * period_other noeat recolor=-2 150 "0-9" period_decimal noeat recolor=-2 151 152 :period_other Period 153 * main noeat 154 155 :period_decimal PeriodDecimal 156 * float_no_period noeat 157 158 159 ################### numbers #################### 160 :float_no_period Number 161 * end_of_number noeat 162 "0-9" float_no_period 163 "eE" integer 164 165 :integer Number 166 * error noeat 167 "+-" unsigned 168 "0-9" unsigned_or_end 169 170 :unsigned Number 171 * error noeat 172 "0-9" unsigned_or_end 173 174 :unsigned_or_end Number 175 * end_of_number noeat 176 "0-9" unsigned_or_end 177 178 :end_of_number Number 179 * main noeat 180 "i" main # imaginary number suffix 181 182 :number0 Number 183 * end_of_number noeat 184 "xX" hex 185 "." period_decimal recolor=-1 186 # 099i is a valid imaginary number, 099.0 is a valid float, 187 # but 099 is an invalid octal. 188 #We don't check for this and simply lump both cases together. 189 "0-9" float 190 191 :hex Number 192 * main noeat 193 "0-9a-fA-F" hex 194 195 :float Number 196 * end_of_number noeat 197 "0-9" float 198 "." period_decimal recolor=-1 199 "eE" integer 200 201 ################# keywords and identifiers ########################## 202 :keyword_or_identifier Identifier 203 * identifier 204 "\p{Lu}\p{Lt}" exported_identifier recolor=-1 205 "\p{Ll}\p{Lo}\p{Pc}\p{Nl}" keyword_or_identifier2 206 207 :exported_identifier ExportedIdentifier 208 * exported_identifier 209 "\x01-/:-@[-^`{-\x7f" main noeat 210 211 :identifier Identifier 212 * identifier 213 "\x01-/:-@[-^`{-\x7f" main noeat 214 215 :keyword_or_identifier2 Identifier 216 * identifier 217 "\c" keyword_or_identifier2 218 "\x01-/:-@[-^`{-\x7f" main noeat hold strings 219 "_" keyword 220 "break" keyword 221 "default" keyword 222 "func" keyword 223 "interface" keyword 224 "select" keyword 225 "case" keyword 226 "defer" keyword 227 "go" keyword 228 "map" keyword 229 "struct" keyword 230 "chan" keyword 231 "else" keyword 232 "goto" keyword 233 "package" keyword 234 "switch" keyword 235 "const" keyword 236 "fallthrough" keyword 237 "if" keyword 238 "range" keyword 239 "type" keyword 240 "continue" keyword 241 "for" keyword 242 "import" keyword 243 "return" keyword 244 "var" keyword 245 246 "true" constant 247 "false" constant 248 "nil" constant 249 "iota" constant 250 251 "byte" type 252 "rune" type 253 "int" type 254 "uint" type 255 "uintptr" type 256 "uint8" type 257 "uint16" type 258 "uint32" type 259 "uint64" type 260 "int8" type 261 "int16" type 262 "int32" type 263 "int64" type 264 "float32" type 265 "float64" type 266 "complex64" type 267 "complex128" type 268 "bool" type 269 "string" type 270 "error" type 271 272 "delete" builtin 273 "make" builtin 274 "len" builtin 275 "cap" builtin 276 "new" builtin 277 "copy" builtin 278 "append" builtin 279 "close" builtin 280 "complex" builtin 281 "imag" builtin 282 "panic" builtin 283 "print" builtin 284 "println" builtin 285 "real" builtin 286 "recover" builtin 287 done 288 289 :keyword Keyword 290 * main noeat 291 292 :constant Constant 293 * main noeat 294 295 :type Type 296 * main noeat 297 298 :builtin BuiltinFunction 299 * main noeat 300 301 302 303 304 ########################## .subr escape START ###################################### 305 .subr escape 306 :esc Escape 307 * esc_err noeat 308 "abfnrtv'\"" whatever return 309 # For some reason joe doesn't interpret \\ properly if merged with the 310 # previous case. So create a separate case for it. 311 "\\" whatever return 312 "x" hex2 313 "u" hex4 314 "U" hex8 315 "0-3" oct2 316 317 :hex8 Escape 318 * esc_err noeat 319 "a-fA-F0-9" hex7 320 321 :hex7 Escape 322 * esc_err noeat 323 "a-fA-F0-9" hex6 324 325 :hex6 Escape 326 * esc_err noeat 327 "a-fA-F0-9" hex5 328 329 :hex5 Escape 330 * esc_err noeat 331 "a-fA-F0-9" hex4 332 333 :hex4 Escape 334 * esc_err noeat 335 "a-fA-F0-9" hex3 336 337 :hex3 Escape 338 * esc_err noeat 339 "a-fA-F0-9" hex2 340 341 :hex2 Escape 342 * esc_err noeat 343 "a-fA-F0-9" hex1 344 345 :hex1 Escape 346 * esc_err noeat 347 "a-fA-F0-9" whatever return 348 349 :oct2 Escape 350 * esc_err noeat 351 "0-7" oct1 352 353 :oct1 Escape 354 * esc_err noeat 355 "0-7" whatever return 356 357 :esc_err Error 358 * esc_err return 359 "\n" esc_err_newline noeat recolor=-2 360 361 :esc_err_newline Error 362 * esc_err return noeat 363 364 365 .end 366 ########################## .subr escape END ###################################### 367 368