dotfiles

My dotfiles.
Log | Files | Refs | LICENSE

csharp.jsf (8514B)


      1 # JOE syntax highlight file for C#
      2 # Based on Java highlighter
      3 
      4 =Idle
      5 =Ident
      6 =Preproc
      7 =Precondit	+Preproc
      8 =Define		+Preproc
      9 =DefinedIdent	+Ident
     10 =Comment
     11 =DocComment	+Comment
     12 =Constant
     13 =String		+Constant
     14 =Character	+Constant +String
     15 =Number		+Constant
     16 =Boolean	+Constant
     17 =Escape
     18 =StringEscape	+Escape
     19 =CharacterEscape +Escape
     20 =Type
     21 =Structure	+Keyword
     22 =StorageClass	+Type +Keyword
     23 =Modifier	+StorageClass
     24 =Keyword
     25 =Operator	+Keyword
     26 =Statement	+Keyword
     27 =Loop		+Statement
     28 =Conditional	+Statement
     29 =Label		+DefinedIdent
     30 =Bad
     31 =Brace
     32 =Control
     33 
     34 :begin Idle
     35 	*	begin	noeat call=.csharp()
     36 
     37 .subr csharp
     38 
     39 :reset Idle
     40 	*		first		noeat
     41 	" \t"		reset
     42 
     43 :first Idle
     44 	*		idle		noeat
     45 	"#"		pre		mark
     46 
     47 :pre Preproc
     48 	*		pre		noeat
     49 	"a-zA-Z"	preident	recolor=-1 buffer
     50 	" \t"		pre
     51 	"\n"		reset
     52 
     53 :preident Preproc
     54 	*		preunknown	markend recolormark strings
     55 	"if"		precondit	markend recolormark
     56 	"else"		precondit	markend recolormark
     57 	"elif"		precondit	markend recolormark
     58 	"endif"		precondit	markend recolormark
     59 	"region"	preregion	markend recolormark
     60 	"endregion"	preregion	markend recolormark
     61 	"define"	predefine	markend recolormark
     62 	"undef"		predefine	markend recolormark
     63 	"warning"	preregion	markend recolormark
     64 	"error"		preregion	markend recolormark
     65 	"line"		prebody		markend recolormark
     66 done
     67 	"a-z"		preident
     68 
     69 :prebody Preproc
     70 	*		prebody
     71 	"\n"		reset
     72 
     73 :precondit Precondit
     74 	*		precondit
     75 	"\n"		reset
     76 
     77 :preregion Preproc
     78 	*		preregion_text
     79 	"\n"		reset
     80 
     81 :preregion_text Comment
     82 	*		preregion_text
     83 	"\n"		reset
     84 
     85 :predefine Define
     86 	*		predefine_text	noeat
     87 	" \t"		predefine
     88 	"\n"		reset
     89 
     90 :predefine_text DefinedIdent
     91 	*		predefine_text
     92 	" \t"		predefine_value
     93 	"\n"		reset
     94 
     95 :predefine_value Idle
     96 	*		predefine_value
     97 	"\n"		reset
     98 
     99 :preunknown Preproc
    100 	*		preunknown
    101 	"\n"		reset
    102 
    103 :idle Idle
    104 	*		idle
    105 	"\n"		reset
    106 	"/"		slash
    107 	"0"		first_digit	recolor=-1
    108 	"1-9"		decimal		recolor=-1
    109 	"."		maybe_float
    110 	"\""		string		recolor=-1
    111 	"@"		forcedliteral	recolor=-1
    112 	"'"		char		recolor=-1
    113 	"\i"		ident		buffer
    114 	"{}"		brace		recolor=-1
    115 	",:;=()><[]*&|!~+\-%^"	control	recolor=-1
    116 
    117 :maybe_done Control
    118 	*	idle	noeat
    119 	"/"	idle	noeat return recolor=-2
    120 
    121 :brace Brace
    122 	*	idle	noeat
    123 
    124 :control Control
    125 	*	idle	noeat
    126 
    127 :forcedliteral Ident
    128 	*		idle		noeat
    129 	"\i"		ident		recolor=-2
    130 	"\""		forcedstring	recolor=-2
    131 
    132 :forcedstring String string
    133 	*		forcedstring
    134 	"\""		forcedstringquot
    135 
    136 :forcedstringquot String string
    137 	*		idle			noeat
    138 	"\""		forcedstring			# @"This -> "" <- is a literal quote"
    139 
    140 :slash Idle
    141 	*		idle			noeat
    142 	"*"		comment			recolor=-2
    143 	"/"		maybe_line_comment	recolor=-2
    144 
    145 :comment Comment
    146 	*		comment
    147 	"BFHNTX"	comment			noeat call=comment_todo.comment_todo()
    148 	"*"		maybe_end_comment
    149 
    150 :maybe_end_comment Comment
    151 	*		comment
    152 	"/"		idle
    153 	"*"		maybe_end_comment
    154 
    155 :maybe_line_comment Comment
    156 	*		line_comment		noeat recolor=-1
    157 	"/"		doc_comment		recolor=-3
    158 
    159 :line_comment Comment
    160 	*		line_comment
    161 	"BFHNTX"	line_comment		noeat call=comment_todo.comment_todo()
    162 	"\n"		reset
    163 
    164 :doc_comment DocComment
    165 	*		doc_comment
    166 	"BFHNTX"	doc_comment		noeat call=comment_todo.comment_todo()
    167 	"\n"		reset
    168 
    169 :first_digit Number
    170 	*		idle	noeat
    171 	"xX"		hex
    172 	"."		float
    173 	"eE"		epart
    174 	"0-7"		octal
    175 	"89"		bad_number	recolor=-1
    176 
    177 :bad_number Bad
    178 	*		idle	noeat
    179 	"0-9"		bad_number
    180 
    181 :octal Number
    182 	*		idle	noeat
    183 	"0-7"		octal
    184 	"89"		bad_number	recolor=-1
    185 
    186 :hex Number
    187 	*		idle	noeat
    188 	"0-9A-Fa-f"	hex
    189 
    190 :decimal Number
    191 	*		idle	noeat
    192 	"0-9"		decimal
    193 	"eE"		epart
    194 	"."		float
    195 
    196 :maybe_float Number
    197 	*		idle	recolor=-2	noeat
    198 	"0-9"		float		recolor=-2
    199 
    200 :float Number
    201 	*		idle	noeat
    202 	"eE"		epart
    203 	"0-9"		float
    204 
    205 :epart Number
    206 	*		idle	noeat
    207 	"0-9+\-"	enum
    208 
    209 :enum Number
    210 	*		idle	noeat
    211 	"0-9"		enum
    212 
    213 :string	String string
    214 	*		string
    215 	"\""		idle
    216 	"\\"		string_escape		recolor=-1
    217 	"{"		maybe_string_control	recolor=-1
    218 	"}"		maybe_control_end	recolor=-1
    219 
    220 :string_escape StringEscape string
    221 	*		string
    222 	"xu"		string_hex_4  # Yes, \x has up to 4 numbers in C#
    223 	"U"		string_hex_8
    224 	"0-7"		string_octal2
    225 	"\n"		string		recolor=-2
    226 
    227 # Eight all-purpose (hex/unicode short/unicode long) states for hexadecimal
    228 # escape sequences
    229 
    230 :string_hex_8 StringEscape string
    231 	*		string		noeat
    232 	"0-9a-fA-F"	string_hex_7
    233 
    234 :string_hex_7 StringEscape string
    235 	*		string		noeat
    236 	"0-9a-fA-F"	string_hex_6
    237 
    238 :string_hex_6 StringEscape string
    239 	*		string		noeat
    240 	"0-9a-fA-F"	string_hex_5
    241 
    242 :string_hex_5 StringEscape string
    243 	*		string		noeat
    244 	"0-9a-fA-F"	string_hex_4
    245 
    246 :string_hex_4 StringEscape string
    247 	*		string		noeat
    248 	"0-9a-fA-F"	string_hex_3
    249 
    250 :string_hex_3 StringEscape string
    251 	*		string		noeat
    252 	"0-9a-fA-F"	string_hex_2
    253 
    254 :string_hex_2 StringEscape string
    255 	*		string		noeat
    256 	"0-9a-fA-F"	string_hex_1
    257 
    258 :string_hex_1 StringEscape string
    259 	*		string		noeat
    260 	"0-9a-fA-F"	string
    261 
    262 :string_octal2 StringEscape string
    263 	*		string		noeat
    264 	"0-7"		string_octal3
    265 
    266 :string_octal3 StringEscape string
    267 	*		string		noeat
    268 	"0-7"		string
    269 
    270 :maybe_string_control StringEscape string
    271 	*		string 		noeat recolor=-2
    272 	"0-9"		string_control
    273 	"{"		string
    274 
    275 :string_control StringEscape string
    276 	*		string_control
    277 	"\""		string		noeat
    278 	"}"		string
    279 
    280 :maybe_control_end StringEscape string
    281 	*		string		noeat recolor=-2
    282 	"}"		string
    283 
    284 :char Character string
    285 	*		char
    286 	"\n"		reset
    287 	"'"		idle
    288 	"\\"		char_escape	recolor=-1
    289 
    290 :char_escape CharacterEscape string
    291 	*		char
    292 	"xu"		char_hex4
    293 	"U"		char_hex8
    294 	"0-7"		char_octal2
    295 	"\n"		char		recolor=-2
    296 
    297 :char_hex8 CharacterEscape string
    298 	*		char		noeat
    299 	"0-9a-fA-F"	char_hex7
    300 
    301 :char_hex7 CharacterEscape string
    302 	*		char		noeat
    303 	"0-9a-fA-F"	char_hex6
    304 
    305 :char_hex6 CharacterEscape string
    306 	*		char		noeat
    307 	"0-9a-fA-F"	char_hex5
    308 
    309 :char_hex5 CharacterEscape string
    310 	*		char		noeat
    311 	"0-9a-fA-F"	char_hex4
    312 
    313 :char_hex4 CharacterEscape string
    314 	*		char		noeat
    315 	"0-9a-fA-F"	char_hex3
    316 
    317 :char_hex3 CharacterEscape string
    318 	*		char		noeat
    319 	"0-9a-fA-F"	char_hex2
    320 
    321 :char_hex2 CharacterEscape string
    322 	*		char		noeat
    323 	"0-9a-fA-F"	char_hex1
    324 
    325 :char_hex1 CharacterEscape string
    326 	*		char		noeat
    327 	"0-9a-fA-F"	char
    328 
    329 :char_octal2 CharacterEscape string
    330 	*		char		noeat
    331 	"0-7"		char_octal3
    332 
    333 :char_octal3 CharacterEscape string
    334 	*		char		noeat
    335 	"0-7"		char
    336 
    337 :ident Ident		# http://msdn.microsoft.com/en-us/library/x53a06bb.aspx
    338 	*		idle		noeat strings
    339 	"abstract"	modifier
    340 	"as"		operator
    341 	"base"		kw
    342 	"break"		loop
    343 	"case"		label
    344 	"catch"		stmt
    345 	"checked"	operator
    346 	"class"		struct
    347 	"const"		storage
    348 	"continue"	loop
    349 	"default"	label
    350 	"delegate"	kw
    351 	"do"		loop
    352 	"else"		cond
    353 	"enum"		struct
    354 	"event"		kw
    355 	"explicit"	kw
    356 	"extern"	modifier
    357 	"finally"	stmt
    358 	"fixed"		kw
    359 	"for"		loop
    360 	"foreach"	loop
    361 	"goto"		loop
    362 	"if"		cond
    363 	"implicit"	kw
    364 	"in"		operator
    365 	"interface"	struct
    366 	"internal"	modifier
    367 	"is"		operator
    368 	"lock"		stmt
    369 	"nameof"	kw
    370 	"namespace"	struct
    371 	"new"		operator
    372 	"operator"	kw
    373 	"out"		storage
    374 	"override"	storage
    375 	"params"	kw
    376 	"private"	modifier
    377 	"protected"	modifier
    378 	"public"	modifier
    379 	"readonly"	modifier
    380 	"ref"		storage
    381 	"return"	stmt
    382 	"sealed"	modifier
    383 	"sizeof"	operator
    384 	"stackalloc"	storage
    385 	"static"	modifier
    386 	"struct"	struct
    387 	"switch"	cond
    388 	"this"		kw
    389 	"throw"		stmt
    390 	"try"		stmt
    391 	"typeof"	operator
    392 	"unchecked"	operator
    393 	"unsafe"	kw
    394 	"using"		stmt
    395 	"virtual"	modifier
    396 	"volatile"	modifier
    397 	"while"		loop
    398 	
    399 	# Types
    400 	
    401 	"bool"		type
    402 	"Boolean"	type
    403 	"byte"		type
    404 	"Byte"		type
    405 	"char"		type
    406 	"Character"	type
    407 	"decimal"	type
    408 	"double"	type
    409 	"Double"	type
    410 	"float"		type
    411 	"Float"		type
    412 	"int"		type
    413 	"Integer"	type
    414 	"int16"		type
    415 	"Int16"		type
    416 	"int32"		type
    417 	"Int32"		type
    418 	"int64"		type
    419 	"Int64"		type
    420 	"IntPtr"	type
    421 	"long"		type
    422 	"object"	type
    423 	"Object"	type
    424 	"sbyte"		type
    425 	"short"		type
    426 	"string"	type
    427 	"String"	type
    428 	"uint"		type
    429 	"uint16"	type
    430 	"uint32"	type
    431 	"uint64"	type
    432 	"ulong"		type
    433 	"ushort"	type
    434 	"void"		type
    435 	
    436 	
    437 	# These are "contextual" keywords.  Should try to do a better and
    438 	# and find the context (most are LINQ), but it may not be possible
    439 	# in all cases:
    440 	
    441 	"add"		kw
    442 	"alias"		kw
    443 	"ascending"	kw
    444 	"async"		kw
    445 	"await"		kw
    446 	"descending"	kw
    447 	"dynamic"	type
    448 	"from"		kw
    449 	"get"		kw
    450 	"global"	kw
    451 	"group"		kw
    452 	"into"		kw
    453 	"join"		kw
    454 	"let"		kw
    455 	"orderby"	kw
    456 	"partial"	kw
    457 	"remove"	kw
    458 	"select"	kw
    459 	"set"		kw
    460 	"value"		kw
    461 	"var"		type
    462 	"where"		kw
    463 	"yield"		kw
    464 	
    465 	# Literals
    466 	
    467 	"true"		bool
    468 	"false"		bool
    469 	"null"		lit
    470 done
    471 	"\c"		ident
    472 
    473 :type Type
    474 	*	idle	noeat
    475 
    476 :kw Keyword
    477 	*	idle	noeat
    478 
    479 :stmt Statement
    480 	*	idle	noeat
    481 
    482 :cond Conditional
    483 	*	idle	noeat
    484 
    485 :loop Loop
    486 	*	idle	noeat
    487 
    488 :struct Structure
    489 	*	idle	noeat
    490 
    491 :storage StorageClass
    492 	*	idle	noeat
    493 
    494 :modifier Modifier
    495 	*	idle	noeat
    496 
    497 :bool Boolean
    498 	*	idle	noeat
    499 
    500 :lit Constant
    501 	*	idle	noeat
    502 
    503 :operator Operator
    504 	*	idle	noeat
    505 
    506 .end