File: go.jsf

package info (click to toggle)
joe 4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,800 kB
  • ctags: 3,201
  • sloc: ansic: 49,924; sh: 4,279; makefile: 171; csh: 26
file content (368 lines) | stat: -rw-r--r-- 9,248 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# Google Go (golang) syntax
# (c) 2012 Matthias S. Benkmann
# License: http://creativecommons.org/licenses/by/3.0/deed.en_US

# Small modifications by jjjordan to better suit white backgrounds and 16-color
# consoles.  (Original colors commented out below)

# Standard colors:
#
# Foreground:
#   white cyan magenta blue yellow green red black
#
# Background:
#   bg_white bg_cyan bg_magenta bg_blue bg_yellow bg_green bg_red bg_black
#
#
# For 16 color and 256 color xterms: "export TERM=xterm-16color", the following
# brighter than normal colors are available ( Note that you need an xterm which 
# was compiled to support 16 or 256 colors and a matching termcap/terminfo entry 
# for it.)
#
# Foreground:
#   WHITE CYAN MAGENTA BLUE YELLOW GREEN RED BLACK
#
# Background:
#   bg_WHITE bg_CYAN bg_MAGENTA bg_BLUE bg_YELLOW bg_GREEN bg_RED bg_BLACK
#
#
# For 256 color xterm: "export TERM=xterm-256color", the following become available
# ( Note that you need an xterm which was compiled to support 256 colors and a
# matching termcap/terminfo entry for it. )
#
# fg_RGB and bg_RGB, where R, G, and B range from 0 - 5.  So: fg_500 is bright red.
#
# fg_NN and bg_NN give shades of grey, where the intensity, NN, ranges from 0 - 23.


=Idle
=Error          red bold
=Comment        green #bold green
=SingleQuoted   cyan
=DoubleQuoted   cyan
=BackQuoted     cyan
=Escape         bold cyan
=Operator       bold cyan
=Parentheses    #bold yellow
=Brackets       yellow
=Brace          magenta #bold magenta
=Semicolon      #bold yellow
=Period         bold
=PeriodDecimal  red
=Number         red
=Constant       red
=Comma          #bold yellow
=Identifier     #fg_333
=ExportedIdentifier #fg_444
=Keyword        bold
=Type           bold
=BuiltinFunction bold

##################### main #########################
:main Idle
  *             keyword_or_identifier   noeat buffer
  " \t"         main
  "\n"          main
  "/"           maybe_comment recolor=-1
  "'"           single_quoted recolor=-1
  "\""          double_quoted recolor=-1
  "`"           back_quoted   recolor=-1
  "+&=!|*^<>:%-" operator    noeat
  "()"          parentheses   noeat
  "[]"          brackets      noeat
  "{}"          curlies       noeat
  ";"           semicolon     noeat
  ","           comma         noeat  
  "."           period
  "0"           number0       recolor=-1
  "1-9"         float         recolor=-1
  "#$@~"        error         noeat

#################### error ##########################
:error Error
  *             error
  "\n"          main
  "/"           maybe_comment_err  recolor=-1

:maybe_comment_err Operator
  *             error noeat recolor=-2
  "/"           line_comment  recolor=-2
  "*"           block_comment recolor=-2

################## comments #########################
:maybe_comment Operator
  *             main noeat
  "/"           line_comment  recolor=-2
  "*"           block_comment recolor=-2

:line_comment Comment
  *             line_comment
  "\n"          main

:block_comment Comment  
  *            block_comment
  "*"          maybe_end_block_comment
  
:maybe_end_block_comment Comment
  *            block_comment noeat
  "/"          main

################ strings ############################
:single_quoted SingleQuoted
  *            single_quoted
  "'"          main
  "\\"         single_quoted call=.escape() recolor=-1
  "\n"         error

:double_quoted DoubleQuoted
  *            double_quoted
  "\""         main
  "\\"         double_quoted call=.escape() recolor=-1
  "\n"         error

:back_quoted BackQuoted
  *            back_quoted
  "`"          main

################### operators #######################
:operator Operator
  *            main

:parentheses Parentheses
  *            main

:brackets Brackets
  *            main

:curlies  Brace
  *            main

:semicolon Semicolon
  *            main

:comma Comma
  *            main

##################### period #######################

:period Period
  *            period_other    noeat recolor=-2
  "0-9"        period_decimal  noeat recolor=-2

:period_other Period  
  *            main noeat

:period_decimal PeriodDecimal
  *            float_no_period noeat


################### numbers ####################
:float_no_period Number
  *            end_of_number   noeat
  "0-9"        float_no_period
  "eE"         integer

:integer Number
  *            error     noeat
  "+-"         unsigned
  "0-9"        unsigned_or_end

:unsigned Number
  *            error     noeat
  "0-9"        unsigned_or_end

:unsigned_or_end Number
  *            end_of_number noeat
  "0-9"        unsigned_or_end

:end_of_number Number
  *            main  noeat
  "i"          main   # imaginary number suffix

:number0 Number
  *            end_of_number  noeat
  "xX"         hex
  "."          period_decimal recolor=-1
    # 099i is a valid imaginary number, 099.0 is a valid float,
    # but 099 is an invalid octal. 
    #We don't check for this and simply lump both cases together.
  "0-9"        float

:hex Number
  *            main  noeat
  "0-9a-fA-F"  hex

:float Number
  *            end_of_number  noeat
  "0-9"        float
  "."          period_decimal recolor=-1
  "eE"         integer
  
################# keywords and identifiers ##########################
:keyword_or_identifier Identifier
  *            identifier
  "\p{Lu}\p{Lt}"        exported_identifier recolor=-1
  "\p{Ll}\p{Lo}\p{Pc}\p{Nl}"       keyword_or_identifier2

:exported_identifier  ExportedIdentifier
  *                         exported_identifier
  "\x01-/:-@[-^`{-\x7f"      main noeat

:identifier Identifier
  *                         identifier
  "\x01-/:-@[-^`{-\x7f"     main noeat

:keyword_or_identifier2 Identifier
  *                 identifier
  "\c"	            keyword_or_identifier2
  "\x01-/:-@[-^`{-\x7f"      main noeat hold strings
      "_"           keyword
      "break"       keyword
      "default"     keyword
      "func"        keyword
      "interface"   keyword
      "select"      keyword
      "case"        keyword
      "defer"       keyword
      "go"          keyword
      "map"         keyword
      "struct"      keyword
      "chan"        keyword
      "else"        keyword
      "goto"        keyword
      "package"     keyword
      "switch"      keyword
      "const"       keyword
      "fallthrough" keyword
      "if"          keyword
      "range"       keyword
      "type"        keyword
      "continue"    keyword
      "for"         keyword
      "import"      keyword
      "return"      keyword
      "var"         keyword
      
      "true"        constant
      "false"       constant
      "nil"         constant
      "iota"        constant
      
      "byte"        type
      "rune"        type
      "int"         type
      "uint"        type
      "uintptr"     type
      "uint8"       type
      "uint16"      type
      "uint32"      type
      "uint64"      type
      "int8"        type
      "int16"       type
      "int32"       type
      "int64"       type
      "float32"     type
      "float64"     type
      "complex64"   type
      "complex128"  type
      "bool"        type
      "string"      type
      "error"       type
      
      "delete"      builtin
      "make"        builtin
      "len"         builtin
      "cap"         builtin
      "new"         builtin
      "copy"        builtin
      "append"      builtin
      "close"       builtin
      "complex"     builtin
      "imag"        builtin
      "panic"       builtin
      "print"       builtin
      "println"     builtin
      "real"        builtin
      "recover"     builtin
  done

:keyword Keyword
  *            main  noeat

:constant Constant
  *            main  noeat

:type Type
  *            main  noeat
  
:builtin BuiltinFunction
  *            main  noeat
  
  


########################## .subr escape START ######################################
.subr escape
:esc Escape
  *              esc_err    noeat
  "abfnrtv'\"" whatever return
    # For some reason joe doesn't interpret \\ properly if merged with the
    # previous case. So create a separate case for it.
  "\\"         whatever return
  "x"            hex2
  "u"            hex4
  "U"            hex8
  "0-3"          oct2

:hex8 Escape
  *              esc_err noeat
  "a-fA-F0-9"    hex7

:hex7 Escape
  *              esc_err    noeat
  "a-fA-F0-9"    hex6

:hex6 Escape
  *              esc_err noeat
  "a-fA-F0-9"    hex5

:hex5 Escape
  *              esc_err    noeat
  "a-fA-F0-9"    hex4

:hex4 Escape
  *              esc_err noeat
  "a-fA-F0-9"    hex3

:hex3 Escape
  *              esc_err    noeat
  "a-fA-F0-9"    hex2

:hex2 Escape
  *              esc_err noeat
  "a-fA-F0-9"    hex1

:hex1 Escape
  *              esc_err    noeat
  "a-fA-F0-9"    whatever return

:oct2 Escape
  *              esc_err noeat
  "0-7"          oct1

:oct1 Escape
  *              esc_err noeat
  "0-7"          whatever return

:esc_err Error
  *              esc_err return
  "\n"           esc_err_newline noeat recolor=-2

:esc_err_newline Error
  *              esc_err return noeat
  

.end
########################## .subr escape END ######################################