sml.jsf.in (8043B)
1 # JOE syntax highlight file for SML 2 3 # A (deterministic) state machine which performs lexical analysis of SML. 4 # (This is the "assembly language" of syntax highlighting. A separate 5 # program could be used to convert a regular expression NFA syntax into this 6 # format). 7 8 # Each state begins with ':<name> <color-name>' 9 # <color-name> is the color used for characters eaten by the state 10 # (really a symbol for a user definable color). 11 12 # The first state defined is the initial state. 13 14 # Within a state, define transitions (jumps) to other states. Each 15 # jump has the form: <character-list> <target-state> [<option>s] 16 17 # There are two ways to specify <character-list>s, either * for any 18 # character not otherwise specified, or a literal list of characters within 19 # quotes (ranges and escape sequences allows). When the next character 20 # matches any in the list, a jump to the target-state is taken and the 21 # character is eaten (we advance to the next character of the file to be 22 # colored). 23 # 24 # The * transition should be the first transition specified in the state. 25 # 26 # There are several options: 27 # noeat do not eat the character, instead feed it to the next state 28 # (this tends to make the states smaller, but be careful: you 29 # can make infinite loops). 'noeat' implies 'recolor=-1'. 30 # 31 # recolor=-N Recolor the past N characters with the color of the 32 # target-state. For example once /* is recognized as the 33 # start of C comment, you want to color the /* with the C 34 # comment color. 35 # 36 # buffer start copying characters to a buffer, beginning with this 37 # one (it's ok to not terminate buffering with a matching 38 # 'strings' option- the buffer is limited to leading 19 39 # characters). 40 # 41 # strings A list of strings follows. If the buffer matches any of the 42 # given strings, a jump to the target-state in the string list 43 # is taken instead of the normal jump. 44 # 45 # istrings Same as strings, but case is ignored. 46 # 47 # hold Stop buffering string- a future 'strings' or 'istrings' will 48 # look at contents of buffer at this point. Useful for distinguishing 49 # commands and function calls in some languages 'write 7' is a command 50 # 'write (' is a function call- hold lets us stop at the space and delay 51 # the string lookup until the ( or 7. 52 # 53 # The format of the string list is: 54 # 55 # "string" <target-state> [<options>s] 56 # "string" <target-state> [<options>s] 57 # done 58 # 59 # (all of the options above are allowed except "strings", "istrings" and "noeat". noeat is 60 # always implied after a matched string). 61 # 62 # Weirdness: only states have colors, not transitions. This means that you 63 # sometimes have to make dummy states with '* next-state noeat' just to get 64 # a color specification. 65 66 # Define no. sync lines 67 # You can say: 68 # -200 means 200 lines 69 # - means always start parsing from beginning of file when we lose sync 70 # if nothing is specified, the default is -50 71 72 # Define colors 73 # 74 # bold inverse blink dim underline italic 75 # white cyan magenta blue yellow green red black 76 # bg_white bg_cyan bg_magenta bg_blue bg_yellow bg_green bg_red bg_black 77 78 =Expr 79 =Bad bg_red 80 =Comment green 81 =Literal cyan 82 =Escape bold cyan 83 =Type blue 84 =Keyword bold 85 =Operator bold black 86 =Control green 87 =Id 88 89 :expr Expr 90 * expr 91 ".,[{})];" control recolor=-1 # . or ... both control 92 "(" bracket recolor=-1 93 "_" underline recolor=-1 94 "!%&$+/:<=>?@`^|*\-" operator buffer recolor=-1 95 "#" hash recolor=-1 96 "~" tilde recolor=-1 97 "0" zero recolor=-1 98 "1-9" decimal recolor=-1 99 "\"" string recolor=-1 100 "a-zA-Z" id buffer recolor=-1 101 102 :bad Bad 103 * expr 104 105 :control Control 106 * expr noeat 107 108 :bracket Control 109 * expr noeat 110 "*" comment1 recolor=-2 111 112 :underline Keyword 113 * expr noeat 114 "a-zA-Z" kw 115 116 :operator Operator 117 * expr noeat strings 118 ":>" colon 119 ":" colon 120 "::" control # can be overloaded, but you would burn in hell 121 ":=" control # ditto 122 "=" control # only in some contexts is it _really_ control 123 "->" control 124 "=>" control 125 "|" control 126 done 127 "!%&$+/:<=>?@~`^|#*\-" operator 128 129 :colon Control 130 * type1 noeat 131 132 :hash Control 133 * expr noeat 134 "!%&$+/:<=>?@~`^|#*\-" operator recolor=-2 135 "\"" string recolor=-2 136 137 :tilde Operator 138 * expr noeat 139 "!%&$+/:<=>?@~`^|#*\-" operator 140 "0" zero recolor=-2 141 "1-9" decimal recolor=-2 142 143 :zero Literal 144 * expr noeat 145 "0-9" decimal 146 "w" word buffer 147 "x" hex1 buffer 148 "e" epart buffer 149 "E" epart buffer 150 "." float1 151 152 :word Literal 153 * id noeat recolor=-2 154 "0-9" decimal 155 "x" hexword 156 157 :hexword Literal 158 * id noeat recolor=-3 159 "0-9a-fA-F" hex 160 161 :hex1 Literal 162 * id noeat recolor=-2 163 "0-9a-fA-F" hex 164 165 :hex Literal 166 * expr noeat 167 "0-9a-fA-F" hex 168 169 :decimal Literal 170 * expr noeat 171 "0-9" decimal 172 "." float1 173 "e" epart buffer 174 "E" epart buffer 175 176 # trailing digits required in SML (unlike OCaml) 177 :float1 Literal 178 * bad noeat 179 "0-9" float 180 181 :float Literal 182 * expr noeat 183 "0-9" float 184 "e" epart buffer 185 "E" epart buffer 186 187 :epart Literal 188 * id noeat recolor=-2 189 "0-9" enum 190 "~" epart # bug: 3e~~3 191 192 :enum Literal 193 * expr noeat 194 "0-9" enum 195 196 :string Literal 197 * string 198 "\"" expr 199 "\n" bad 200 "\\" string_escape recolor=-1 201 202 :string_escape Escape 203 * bad noeat 204 "abfnrtv\"\\" string 205 "^" string_carret 206 "u" string_hex1 207 "0-9" string_decimal2 208 "\n\r\f\t " string_eatws 209 210 :string_carret Escape 211 * bad noeat 212 "ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^_" string 213 214 :string_eatws Escape 215 * bad noeat 216 "\n\r\f\t " string_eatws 217 "\\" string 218 219 :string_hex1 Escape 220 * bad noeat 221 "0-9a-fA-F" string_hex2 222 223 :string_hex2 Escape 224 * bad noeat 225 "0-9a-fA-F" string_hex3 226 227 :string_hex3 Escape 228 * bad noeat 229 "0-9a-fA-F" string_hex4 230 231 :string_hex4 Escape 232 * bad noeat 233 "0-9a-fA-F" string 234 235 :string_decimal2 Escape 236 * bad noeat 237 "0-9" string_decimal3 238 239 :string_decimal3 Escape 240 * bad noeat 241 "0-9" string 242 243 :id Id 244 * expr noeat strings 245 "_" kw 246 "ann" kw 247 "and" kw 248 "as" kw 249 "case" kw 250 "do" kw 251 "else" kw 252 "end" kw 253 "exception" kw 254 "fn" kw 255 "fun" kw 256 "functor" kw 257 "handle" kw 258 "if" kw 259 "in" kw 260 "include" kw 261 "infix" kw 262 "infixr" kw 263 "let" kw 264 "local" kw 265 "nil" kw 266 "nonfix" kw 267 "of" kw 268 "op" kw 269 "open" kw 270 "raise" kw 271 "rec" kw 272 "sharing" kw 273 "sig" kw 274 "signature" kw 275 "struct" kw 276 "structure" kw 277 "then" kw 278 "val" kw 279 "where" kw 280 "while" kw 281 "with" kw 282 "abstype" kwtype 283 "datatype" kwtype 284 "eqtype" kwtype 285 "type" kwtype 286 "withtype" kwtype 287 "before" operatorkw 288 "o" operatorkw 289 "orelse" operatorkw 290 "andalso" operatorkw 291 "div" operatorkw 292 "mod" operatorkw 293 done 294 "a-zA-Z0-9_'" id 295 296 :kw Keyword 297 * expr noeat 298 "a-zA-Z0-9_'" kw 299 300 :operatorkw Operator 301 * expr noeat 302 303 :kwtype Keyword 304 * kwtype1 noeat 305 306 :kwtype1 Type 307 * expr noeat 308 "=" typeval recolor=-1 309 "a-zA-Z0-9_'., :|*>\t\-" kwtype1 310 "({" kwtype2 311 312 :kwtype2 Type 313 * expr noeat 314 ")}" kwtype1 315 "a-zA-Z0-9_'., :|*>\t\n\-" kwtype2 316 "({" kwtype3 317 318 :kwtype3 Type 319 * expr noeat 320 ")}" kwtype2 321 "a-zA-Z0-9_'., :|*>\t\n\-" kwtype3 322 "({" expr # too deep nesting 323 324 :typeval Control 325 * type1 noeat 326 " \t\n" typeval 327 328 :type1 Type 329 * expr noeat 330 "a-zA-Z0-9_'., :|*>\t\-" type1 331 "({" type2 332 333 :type2 Type 334 * expr noeat 335 ")}" type1 336 "a-zA-Z0-9_'., :|*>\t\n\-" type2 337 "({" type3 338 339 :type3 Type 340 * expr noeat 341 ")}" type2 342 "a-zA-Z0-9_'., :|*>\t\n\-" type3 343 "({" type4 344 345 :type4 Type 346 * expr noeat 347 ")}" type3 348 "a-zA-Z0-9_'., :|*>\t\n\-" type4 349 "({" expr # too deep nesting 350 351 :comment1 Comment 352 * comment1 353 "(" nestcomment1 354 "*" endcomment1 355 356 :nestcomment1 Comment 357 * comment1 358 "*" comment2 359 360 :endcomment1 Comment 361 * comment1 362 ")" expr 363 "*" endcomment1 364 365 :comment2 Comment 366 * comment2 367 "(" nestcomment2 368 "*" endcomment2 369 370 :nestcomment2 Comment 371 * comment2 372 "*" comment3 373 374 :endcomment2 Comment 375 * comment2 376 ")" comment1 377 "*" endcomment2 378 379 :comment3 Comment 380 * comment3 381 "(" nestcomment3 382 "*" endcomment3 383 384 :nestcomment3 Comment 385 * comment3 386 "*" expr # too deep nesting 387 388 :endcomment3 Comment 389 * comment3 390 ")" comment2 391 "*" endcomment3