rust.jsf (6682B)
1 # JOE syntax highlight file for Rust 2 3 =Idle 4 =Ident 5 =Comment 6 =Constant 7 =Number +Constant 8 =Boolean +Constant 9 =String +Constant 10 =StringEscape +Escape 11 =Character +Constant 12 =CharacterEscape +Escape 13 14 =Keyword 15 =Operator +Keyword 16 =Statement +Keyword 17 =Conditional +Statement 18 =Loop +Statement 19 =StorageClass +Type +Keyword 20 =Structure +Statement 21 22 =Bad 23 =Brace 24 25 :pre_idle Idle 26 * NULL noeat call=.rust() 27 28 .subr rust 29 30 # #! allowed on first line 31 32 :idle Idle 33 * idle 34 "{}" brace recolor=-1 35 "0" zero recolor=-1 36 "1-9" decimal recolor=-1 37 "." decimal_point recolor=-1 38 "\"" string recolor=-1 39 "'" char recolor=-1 40 "/" slash recolor=-1 41 "\i" ident buffer 42 43 :slash Idle 44 * idle noeat 45 "*" comment recolor=-2 46 "/" line_comment recolor=-2 47 48 :brace Brace 49 * idle noeat 50 51 :comment Comment comment 52 * comment 53 "BFHNTX" comment noeat call=comment_todo.comment_todo() 54 "*" maybe_end_comment 55 56 :maybe_end_comment Comment comment 57 * comment noeat 58 "/" idle 59 60 :line_comment Comment comment 61 * line_comment 62 "BFHNTX" line_comment noeat call=comment_todo.comment_todo() 63 "\n" idle 64 65 # Numbers 66 67 :bad_number Bad 68 * idle noeat 69 "0-9" bad_number 70 71 :zero Number 72 * idle noeat 73 "b" binary 74 "o" octal 75 "x" hex 76 "." float 77 "eE" epart 78 "0-9" decimal recolor=-1 79 "ui" int_suffix 80 "f" float_suffix 81 82 :decimal_point Number 83 * idle noeat recolor=-2 84 "0-9" float 85 86 :octal Number 87 * idle noeat 88 "0-7_" octal 89 "89" bad_number recolor=-1 90 "ui" int_suffix 91 92 :binary Number 93 * idle noeat 94 "01_" binary 95 "2-9" bad_number recolor=-1 96 "ui" int_suffix 97 98 :hex Number 99 * idle noeat 100 "0-9A-Fa-f_" hex 101 "ui" int_suffix 102 103 :decimal Number 104 * idle noeat 105 "0-9_" decimal 106 "eE" epart 107 "." float 108 "ui" int_suffix 109 "f" float_suffix 110 111 :float Number 112 * idle noeat 113 "eE" epart 114 "0-9_" float 115 "ui" int_suffix 116 "f" float_suffix 117 118 :epart Number 119 * idle noeat 120 "0-9+\-" enum 121 122 :enum Number 123 * idle noeat 124 "0-9_" enum 125 "ui" int_suffix 126 "f" float_suffix 127 128 :float_suffix Number 129 * bad_number noeat recolor=-1 130 "3" float_suffix_1 131 "6" float_suffix_2 132 133 :float_suffix_1 Number 134 * bad_number noeat recolor=-1 135 "2" idle 136 137 :float_suffix_2 Number 138 * bad_number noeat recolor=-1 139 "4" idle 140 141 :int_suffix Number 142 * bad_number noeat recolor=-1 143 "3" int_suffix_1 144 "6" int_suffix_2 145 "s" int_suffix_3 146 147 :int_suffix_1 Number 148 * bad_number noeat recolor=-1 149 "2" idle 150 151 :int_suffix_2 Number 152 * bad_number noeat recolor=-1 153 "4" idle 154 155 :int_suffix_3 Number 156 * bad_number noeat recolor=-2 157 "i" int_suffix_4 158 159 :int_suffix_4 Number 160 * bad_number noeat recolor=-3 161 "z" int_suffix_5 162 163 :int_suffix_5 Number 164 * bad_number noeat recolor=-4 165 "e" idle 166 167 # strings like "hello" 168 169 :string String string 170 * string 171 "\"" idle 172 "\\" string_escape recolor=-1 173 174 :string_escape StringEscape string 175 * string 176 "x" string_hex2 177 "u" string_maybe_uni 178 179 :string_maybe_uni StringEscape string 180 * string noeat 181 "{" string_uni 182 183 :string_uni StringEscape string 184 * string_uni 185 "}" string 186 187 :string_hex2 StringEscape string 188 * string noeat 189 "0-9a-fA-F" string_hex1 190 191 :string_hex1 StringEscape string 192 * string noeat 193 "0-9a-fA-F" string 194 195 # character constants like 'h' 196 197 :char Character string 198 * char_done 199 "\\" char_escape recolor=-1 200 201 :char_done Character string 202 * idle noeat recolor=-3 203 "\'" idle 204 205 :char_escape CharacterEscape string 206 * char_done noeat 207 "x" char_hex2 208 "u" char_maybe_uni 209 210 :char_maybe_uni CharacterEscape string 211 * char_done noeat 212 "{" char_uni 213 214 :char_uni CharacterEscape string 215 * char_uni 216 "}" char_done 217 218 :char_hex2 CharacterEscape string 219 * char_done noeat 220 "0-9a-fA-F" char_hex1 221 222 :char_hex1 CharacterEscape string 223 * char_done noeat 224 "0-9a-fA-F" char 225 226 # Raw strings like r"hello" or r##"hello, "world""## 227 # The number of #'s is technically unbounded, but we'll limit to 4. 228 229 :raw_string_pre Ident 230 * ident noeat 231 "\"" raw_string_0 recolor=-2 232 "#" raw_string_pre_1 recolor=-2 233 234 :raw_string_pre_1 String string 235 * raw_string_bad recolor=-3 236 "\"" raw_string_1 237 "#" raw_string_pre_2 238 239 :raw_string_pre_2 String string 240 * raw_string_bad recolor=-4 241 "\"" raw_string_2 242 "#" raw_string_pre_3 243 244 :raw_string_pre_3 String string 245 * raw_string_bad recolor=-5 246 "\"" raw_string_3 247 "#" raw_string_pre_4 248 249 :raw_string_pre_4 String string 250 * raw_string_bad recolor=-6 251 "#\"" raw_string_4 # More than 4? too bad. 252 253 :raw_string_0 String string 254 * raw_string_0 255 "\"" idle 256 257 :raw_string_1 String string 258 * raw_string_1 259 "\"" raw_string_end_1 260 261 :raw_string_2 String string 262 * raw_string_2 263 "\"" raw_string_end_2 buffer 264 265 :raw_string_3 String string 266 * raw_string_3 267 "\"" raw_string_end_3 buffer 268 269 :raw_string_4 String string 270 * raw_string_4 271 "\"" raw_string_end_4 buffer 272 273 :raw_string_end_1 String string 274 * raw_string_1 noeat 275 "#" idle 276 277 :raw_string_end_2 String string 278 * raw_string_2 noeat strings 279 "\"##" raw_string_end 280 done 281 "#" raw_string_end_2 282 283 :raw_string_end_3 String string 284 * raw_string_3 noeat strings 285 "\"###" raw_string_end 286 done 287 "#" raw_string_end_3 288 289 :raw_string_end_4 String string 290 * raw_string_4 noeat strings 291 "\"####" raw_string_end 292 done 293 "#" raw_string_end_4 294 295 :raw_string_end String string 296 * idle noeat 297 298 :raw_string_bad Bad 299 * idle noeat 300 301 # Byte string literals b"foo bar" 302 303 :byte_string_pre Ident 304 * ident noeat recolor=-1 305 "\"" string recolor=-2 306 307 # Raw byte string literals br"hello world" and br###"Hello, "world""### 308 309 :raw_byte_string_pre Ident 310 * ident noeat 311 "\"" raw_string_0 recolor=-3 312 "#" raw_string_pre_1 recolor=-3 313 314 # Identifiers 315 316 :ident Ident 317 * idle noeat strings 318 "abstract" storage 319 "alignof" kw 320 "as" operator 321 "become" kw 322 "box" kw 323 "break" loop 324 "const" storage 325 "continue" loop 326 "crate" kw 327 "do" loop 328 "else" cond 329 "enum" struct 330 "extern" storage 331 "false" bool 332 "final" storage 333 "fn" struct 334 "for" loop 335 "if" cond 336 "impl" kw 337 "in" operator 338 "let" kw 339 "loop" loop 340 "macro" kw 341 "match" kw 342 "mod" kw # operator? 343 "move" kw 344 "mut" kw 345 "offsetof" kw 346 "override" storage 347 "priv" storage 348 "proc" kw 349 "pub" storage 350 "pure" storage 351 "ref" kw 352 "return" stmt 353 "Self" kw 354 "self" kw 355 "sizeof" kw # operator? 356 "static" storage 357 "struct" struct 358 "super" kw 359 "trait" kw 360 "true" bool 361 "type" kw 362 "typeof" kw # operator? 363 "unsafe" storage 364 "unsized" kw # storage? 365 "use" kw 366 "virtual" storage 367 "where" kw 368 "while" loop 369 "yield" stmt 370 371 # String/byte prefixes 372 "r" raw_string_pre 373 "b" byte_string_pre 374 "br" raw_byte_string_pre 375 done 376 "\c" ident 377 378 :kw Keyword 379 * idle noeat 380 381 :lit Constant 382 * idle noeat 383 384 :bool Boolean 385 * idle noeat 386 387 :operator Operator 388 * idle noeat 389 390 :storage StorageClass 391 * idle noeat 392 393 :cond Conditional 394 * idle noeat 395 396 :loop Loop 397 * idle noeat 398 399 :struct Structure 400 * idle noeat 401 402 .end