dotfiles

My dotfiles.
git clone git://git.ryanmj.xyz/dotfiles.git
Log | Files | Refs | LICENSE

ocaml.jsf.in (9258B)


      1 # JOE syntax highlight file for OCaml
      2 
      3 # A (deterministic) state machine which performs lexical analysis of OCaml.
      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		bold red
     80 =Comment 	green
     81 =Literal 	cyan
     82 =Escape 	bold cyan
     83 =Type 		bold
     84 =Keyword 	bold
     85 =Operator	blue
     86 =Control	magenta
     87 =CapId		blue
     88 =LowId
     89 =Stdlib		bold blue
     90 
     91 # Bugs:
     92 # = in some contexts is a control, not an operator (let, etc)
     93 # "type" keyword introduces a type = type
     94 
     95 :expr Expr
     96 	*		expr
     97 	"#.,)];"	control		recolor=-1
     98 	"!?"		prefixop	recolor=-1
     99 	"=<>@^&+*/$%"	infixop		recolor=-1
    100 	"\-"		minus		recolor=-1
    101 	"~"		tilde		recolor=-1
    102 	"["		brace		recolor=-1
    103 	"|"		pipe		recolor=-1
    104 	":"		colon		recolor=-1
    105 	"("		bracket		recolor=-1
    106 	"0"		zero		recolor=-1
    107 	"1-9"		decimal		recolor=-1
    108 	"\""		string		recolor=-1
    109 	"\'"		char		recolor=-1
    110 	"a-z_"		lowid		buffer recolor=-1
    111 	"A-Z`"		capid		buffer recolor=-1
    112 
    113 :bad Bad
    114 	*		expr
    115 
    116 :control Control
    117 	*		expr		noeat
    118 
    119 :prefixop Operator
    120 	*		operator	noeat
    121 
    122 :infixop Operator
    123 	*		operator	noeat
    124 
    125 :operator Operator
    126 	*		expr 		noeat
    127 	"!?~=<>@^|&+*/$%.:\-"	operator
    128 
    129 :minus Operator
    130 	*		operator	noeat
    131 	"0"		zero		recolor=-2
    132 	"1-9"		decimal		recolor=-2
    133 
    134 :tilde Operator
    135 	*		prefixop	noeat
    136 	"a-z"		opparam		noeat
    137 
    138 :opparam LowId
    139 	*		expr		noeat
    140 	"a-zA-Z0-9_'"	opparam
    141 	":"		control
    142 
    143 :brace Control
    144 	*		expr		noeat
    145 	"|"		expr
    146 
    147 :pipe Operator
    148 	*		infixop		noeat
    149 	"]"		pipeclose	recolor=-2
    150 
    151 :pipeclose Control
    152 	*		expr		noeat	
    153 
    154 :colon Operator
    155 	*		type1		noeat
    156 	"="		assign		recolor=-2
    157 
    158 :assign Operator
    159 	*		expr		noeat
    160 
    161 :bracket Control
    162 	*		expr		noeat
    163 	"*"		comment1	recolor=-2
    164 
    165 :zero Literal
    166 	*		expr		noeat
    167 	"0-9_"		decimal
    168 	"b"		binaryl		buffer
    169 	"B"		binaryh		buffer
    170 	"o"		octall		buffer
    171 	"O"		octalh		buffer
    172 	"x"		hexl		buffer
    173 	"X"		hexh		buffer
    174 	"e"		epartl		buffer
    175 	"E"		eparth		buffer
    176 	"."		float
    177 
    178 :decimal Literal
    179 	*		expr		noeat
    180 	"0-9_"		decimal
    181 	"."		float
    182 	"e"		epartl		buffer
    183 	"E"		eparth		buffer
    184 
    185 :binaryl Literal
    186 	*		lowid		noeat recolor=-2
    187 	"01"		binary
    188 :binaryh Literal
    189 	*		capid		noeat recolor=-2
    190 	"01"		binary
    191 :binary Literal
    192 	*		expr		noeat
    193 	"01_"		binary
    194 
    195 :octall Literal
    196 	*		lowid		noeat recolor=-2
    197 	"0-7"		octal
    198 :octalh Literal
    199 	*		capid		noeat recolor=-2
    200 	"0-7"		octal
    201 :octal Literal
    202 	*		expr		noeat
    203 	"0-7_"		octal
    204 
    205 :hexl Literal
    206 	*		lowid		noeat recolor=-2
    207 	"0-9a-fA-F"	hex
    208 :hexh Literal
    209 	*		capid		noeat recolor=-2
    210 	"0-9a-fA-F"	hex
    211 :hex Literal
    212 	*		expr		noeat
    213 	"0-9a-fA-F_"	hex
    214 
    215 :float Literal
    216 	*		expr		noeat
    217 	"0-9_"		float
    218 	"e"		epartl		buffer
    219 	"E"		eparth		buffer
    220 
    221 :epartl Literal
    222 	*		lowid		noeat recolor=-2
    223 	"0-9"		enum
    224 	"+\-"		enum1
    225 :eparth Literal
    226 	*		capid		noeat recolor=-2
    227 	"0-9"		enum
    228 	"+\-"		enum1
    229 
    230 :enum1 Literal
    231 	*		bad		noeat
    232 	"0-9_"		enum
    233 :enum Literal
    234 	*		expr		noeat
    235 	"0-9_"		enum
    236 
    237 :string	Literal
    238 	*		string
    239 	"\""		expr
    240 	"\\"		string_escape	recolor=-1
    241 	"%"		string_control	recolor=-1
    242 
    243 :string_escape Escape
    244 	*		string
    245 	"x"		string_hex1
    246 	"0-7"		string_octal2
    247 
    248 :string_hex1 Escape
    249 	*		string		noeat
    250 	"0-9a-fA-F"	string_hex2
    251 
    252 :string_hex2 Escape
    253 	*		string		noeat
    254 	"0-9a-fA-F"	string
    255 
    256 :string_octal2 Escape
    257 	*		string		noeat
    258 	"0-7"		string_octal3
    259 
    260 :string_octal3 Escape
    261 	*		string		noeat
    262 	"0-7"		string
    263 
    264 :string_control Escape
    265 	*		string_control
    266 	"\""		string		noeat
    267 	"diouxXeEfFgGaAcspn%SC"	string
    268 
    269 :char Literal
    270 	*		charend
    271 	"\\"		char_escape	recolor=-1
    272 
    273 :charend Literal
    274 	*		bad		noeat
    275 	"\'"		expr
    276 
    277 :char_escape Escape
    278 	*		charend
    279 	"x"		char_hex1
    280 	"0-7"		char_octal2
    281 
    282 :char_hex1 Escape
    283 	*		bad		noeat
    284 	"0-9a-fA-F"	char_hex2
    285 
    286 :char_hex2 Escape
    287 	*		charend		noeat
    288 	"0-9a-fA-F"	charend
    289 
    290 :char_octal2 Escape
    291 	*		charend		noeat
    292 	"0-7"		char_octal3
    293 
    294 :char_octal3 Escape
    295 	*		charend		noeat
    296 	"0-7"		charend
    297 
    298 :lowid LowId
    299 	*		expr		noeat strings
    300 	"_"		kw
    301 	"and"		kw
    302 	"as"		kw
    303 	"assert"	kw
    304 	"begin"		kw
    305 	"class"		kw
    306 	"constraint"	kw
    307 	"do"		kw
    308 	"done"		kw
    309 	"downto"	kw
    310 	"else"		kw
    311 	"end"		kw
    312 	"exception"	kw
    313 	"external"	kw
    314 	"false"		kw
    315 	"for"		kw
    316 	"fun"		kw
    317 	"function"	kw
    318 	"functor"	kw
    319 	"if"		kw
    320 	"in"		kw
    321 	"include"	kw
    322 	"inherit"	kw
    323 	"initializer"	kw
    324 	"lazy"		kw
    325 	"let"		kw
    326 	"match"		kw
    327 	"method"	kw
    328 	"module"	kw
    329 	"mutable"	kw
    330 	"new"		kw
    331 	"object"	kw
    332 	"of"		kw
    333 	"open"		kw
    334 	"private"	kw
    335 	"raise"		kw # technically not, but ...
    336 	"rec"		kw
    337 	"sig"		kw
    338 	"struct"	kw
    339 	"then"		kw
    340 	"to"		kw
    341 	"true"		kw
    342 	"try"		kw
    343 	"type"		kw
    344 	"val"		kw
    345 	"virtual"	kw
    346 	"when"		kw
    347 	"while"		kw
    348 	"with"		kw
    349 	"asr"		operatorkw
    350 	"land"		operatorkw
    351 	"lor"		operatorkw
    352 	"lsl"		operatorkw
    353 	"lsr"		operatorkw
    354 	"lxor"		operatorkw
    355 	"mod"		operatorkw
    356 	"or"		operatorkw
    357 done
    358 	"a-zA-Z0-9_'"	lowid
    359 
    360 :kw Keyword
    361 	*		expr		noeat
    362 
    363 :operatorkw Operator
    364 	*		expr		noeat
    365 
    366 :capid CapId
    367 	*		expr		noeat strings
    368 	"Arg"		stdlib
    369 	"Array"		stdlib
    370 	"ArrayLabels"	stdlib
    371 	"Buffer"	stdlib
    372 	"Callback"	stdlib
    373 	"Char"		stdlib
    374 	"Complex"	stdlib
    375 	"Digest"	stdlib
    376 	"Filename"	stdlib
    377 	"Format"	stdlib
    378 	"Gc"		stdlib
    379 	"Genlex"	stdlib
    380 	"Hashtbl"	stdlib
    381 	"Int32"		stdlib
    382 	"Int64"		stdlib
    383 	"Lazy"		stdlib
    384 	"Lexing"	stdlib
    385 	"List"		stdlib
    386 	"ListLabels"	stdlib
    387 	"Map"		stdlib
    388 	"Marshal"	stdlib
    389 	"MoreLabels"	stdlib
    390 	"Nativeint"	stdlib
    391 	"Oo"		stdlib
    392 	"Parsing"	stdlib
    393 	"Printexc"	stdlib
    394 	"Printf"	stdlib
    395 	"Queue"		stdlib
    396 	"Random"	stdlib
    397 	"Scanf"		stdlib
    398 	"Set"		stdlib
    399 	"Sort"		stdlib
    400 	"Stack"		stdlib
    401 	"StdLabels"	stdlib
    402 	"Stream"	stdlib
    403 	"String"	stdlib
    404 	"StringLabels"	stdlib
    405 	"Sys"		stdlib
    406 	"Weak"		stdlib
    407 done
    408 	"a-zA-Z0-9_'"	capid
    409 
    410 :stdlib Stdlib
    411 	*		expr		noeat
    412 
    413 :type1	Type
    414 	*		expr		noeat
    415 	"a-z *>'\t\-"	type1
    416 	"("		type2
    417 
    418 :type2	Type
    419 	*		expr		noeat
    420 	"a-z *>'\t\-"	type2
    421 	"("		type3
    422 	")"		type1
    423 
    424 :type3	Type
    425 	*		expr		noeat
    426 	"a-z *>'\t\-"	type3
    427 	"("		type4
    428 	")"		type2
    429 
    430 :type4	Type
    431 	*		expr		noeat
    432 	"a-z *>'\t\-"	type4
    433 	"("		expr 				# too deep nesting
    434 	")"		type2
    435 
    436 :comment1 Comment
    437 	*		comment1
    438 	"("		nestcomment1
    439 	"*"		endcomment1
    440 
    441 :nestcomment1 Comment
    442 	*		comment1
    443 	"*"		comment2
    444 
    445 :endcomment1 Comment
    446 	*		comment1
    447 	")"		expr
    448 	"*"		endcomment1
    449 
    450 :comment2 Comment
    451 	*		comment2
    452 	"("		nestcomment2
    453 	"*"		endcomment2
    454 
    455 :nestcomment2 Comment
    456 	*		comment2
    457 	"*"		comment3
    458 
    459 :endcomment2 Comment
    460 	*		comment2
    461 	")"		comment1
    462 	"*"		endcomment2
    463 
    464 :comment3 Comment
    465 	*		comment3
    466 	"("		nestcomment3
    467 	"*"		endcomment3
    468 
    469 :nestcomment3 Comment
    470 	*		comment3
    471 	"*"		expr				# too deep nesting
    472 
    473 :endcomment3 Comment
    474 	*		comment3
    475 	")"		comment2
    476 	"*"		endcomment3