dotfiles

My dotfiles.
Log | Files | Refs | LICENSE

swift.jsf (5395B)


      1 # JOE syntax highlight file for Swift
      2 
      3 =Idle
      4 =Comment
      5 =Preproc
      6 =Precond	+Preproc
      7 =Constant
      8 =String		+Constant
      9 =Number		+Constant
     10 =Boolean	+Constant
     11 =StringEscape	+Escape +String
     12 =Operator
     13 =Keyword
     14 =Statement	+Keyword
     15 =Loop		+Statement
     16 =Conditional	+Statement
     17 =Type
     18 =StorageClass	+Type +Keyword
     19 =Modifier	+StorageClass
     20 =Label		+DefinedIdent
     21 =Builtin	+DefinedFunction
     22 =Bad
     23 
     24 :pre_idle Idle
     25 	*		NULL		noeat call=.swift()
     26 
     27 .subr swift
     28 
     29 :idle Idle
     30 	*		idle
     31 	"("		idle		call=.swift(paren)
     32 	"["		idle		call=.swift(brack)
     33 	"{"		idle		call=.swift(squiggly)
     34 .ifdef paren
     35 	")"		idle		return
     36 .else
     37 	")"		stray		recolor=-1
     38 .endif
     39 .ifdef brack
     40 	"]"		idle		return
     41 .else
     42 	"]"		stray		recolor=-1
     43 .endif
     44 .ifdef squiggly
     45 	"}"		idle		return
     46 .else
     47 	"}"		stray		recolor=-1
     48 .endif
     49 	"0"		zero		recolor=-1
     50 	"1-9"		decimal		recolor=-1
     51 	"."		decimal_point	recolor=-1
     52 	"\""		string		recolor=-1
     53 	"/"		slash		recolor=-1
     54 	"@$\i"		ident		buffer
     55 	"#"		pre		mark
     56 
     57 :stray Bad
     58 	*		idle
     59 
     60 :pre Preproc
     61 	*		idle		noeat
     62 	" \t"		pre
     63 	"a-z"		preident	recolor=-1 buffer
     64 
     65 :preident Preproc
     66 	*		idle		markend recolormark noeat strings
     67 	"if"		precond		markend recolormark
     68 	"elseif"	precond		markend recolormark
     69 	"else"		precond		markend recolormark
     70 	"endif"		precond		markend recolormark
     71 done
     72 	"a-z"		preident
     73 
     74 :precond Precond
     75 	*		idle		noeat
     76 
     77 # Comments
     78 
     79 :slash Comment comment
     80 	*		idle		noeat recolor=-2
     81 	"/"		line_comment
     82 	"*"		idle		call=.block_comment()
     83 
     84 :line_comment Comment comment
     85 	*		line_comment
     86 	"\n"		idle
     87 	"BFHNTX"	line_comment	noeat call=comment_todo.comment_todo()
     88 
     89 # Numbers
     90 
     91 :bad_number Bad
     92 	*		idle	noeat
     93 	"0-9"		bad_number
     94 
     95 :zero Constant
     96 	*		idle	noeat
     97 	"b"		binary
     98 	"o"		octal
     99 	"x"		hex
    100 	"."		maybe_float
    101 	"eE"		epart
    102 	"0-9_"		decimal	recolor=-1
    103 
    104 :decimal_point Constant
    105 	*		idle	noeat	recolor=-2
    106 	"."		decimal_point_1	recolor=-2
    107 	"\i"		not_ident	recolor=-2
    108 	"0-9_"		float
    109 
    110 :not_ident Idle
    111 	*		idle	noeat
    112 	"\c"		not_ident
    113 
    114 :decimal_point_1 Idle
    115 	*		idle		noeat
    116 	"."		idle
    117 
    118 :octal Constant
    119 	*		idle	noeat
    120 	"0-7_"		octal
    121 	"89"		bad_number	recolor=-1
    122 
    123 :binary Constant
    124 	*		idle	noeat
    125 	"01_"		binary
    126 	"2-9"		bad_number	recolor=-1
    127 
    128 :hex Constant
    129 	*		idle	noeat
    130 	"0-9A-Fa-f_"	hex
    131 	"."		hexfloat
    132 	"pP"		ppart
    133 
    134 :hexfloat Constant
    135 	*		idle	noeat
    136 	"0-9A-Fa-f_"	hexfloat
    137 	"pP"		ppart
    138 
    139 :ppart Constant
    140 	*		idle	noeat
    141 	"0-9+\-"	pnum
    142 
    143 :pnum Constant
    144 	*		idle	noeat
    145 	"0-9_"		pnum
    146 
    147 :decimal Constant
    148 	*		idle	noeat
    149 	"0-9_"		decimal
    150 	"eE"		epart
    151 	"."		maybe_float
    152 
    153 :maybe_float Constant
    154 	*		idle	noeat recolor=-2
    155 	"."		decimal_point_1	recolor=-2
    156 	"eE"		epart
    157 	"0-9_"		float
    158 
    159 :float Constant
    160 	*		idle	noeat
    161 	"eE"		epart
    162 	"0-9_"		float
    163 
    164 :epart Constant
    165 	*		idle	noeat
    166 	"0-9+\-"	enum
    167 
    168 :enum Constant
    169 	*		idle	noeat
    170 	"0-9_"		enum
    171 
    172 # Strings
    173 
    174 :string	String string
    175 	*		string
    176 	"\""		idle
    177 	"\\"		string_escape	recolor=-1
    178 
    179 :string_escape StringEscape string
    180 	*		string
    181 	"("		string	call=.swift(paren)	recolor=-2
    182 	"u"		string_maybe_uni
    183 
    184 :string_maybe_uni StringEscape string
    185 	*		string
    186 	"{"		string_uni
    187 
    188 :string_uni StringEscape string
    189 	*		string_uni
    190 	"}"		string
    191 
    192 # Identifiers
    193 
    194 :ident Idle
    195 	*			idle	noeat strings
    196 	"class"			storage
    197 	"deinit"		kw
    198 	"enum"			storage
    199 	"extension"		storage
    200 	"func"			storage
    201 	"import"		stmt
    202 	"init"			kw
    203 	"inout"			storage
    204 	"internal"		modifier
    205 	"let"			kw
    206 	"operator"		kw
    207 	"private"		modifier
    208 	"protocol"		storage
    209 	"public"		modifier
    210 	"static"		modifier
    211 	"struct"		storage
    212 	"subscript"		kw
    213 	"typealias"		storage
    214 	"var"			kw
    215 	"break"			stmt
    216 	"case"			label
    217 	"continue"		loop
    218 	"default"		label
    219 	"defer"			stmt
    220 	"do"			stmt
    221 	"else"			cond
    222 	"fallthrough"		stmt
    223 	"for"			loop
    224 	"guard"			kw
    225 	"if"			cond
    226 	"in"			kw
    227 	"repeat"		loop
    228 	"return"		stmt
    229 	"switch"		cond
    230 	"where"			kw
    231 	"while"			loop
    232 	"as"			kw
    233 	"catch"			stmt
    234 	"dynamicType"		kw
    235 	"false"			bool
    236 	"is"			kw
    237 	"nil"			lit
    238 	"rethrows"		modifier
    239 	"super"			kw
    240 	"self"			kw
    241 	"Self"			type
    242 	"throw"			stmt
    243 	"throws"		modifier
    244 	"true"			bool
    245 	"try"			kw
    246 	"__COLUMN__"		kw
    247 	"__FILE__"		kw
    248 	"__FUNCTION__"		kw
    249 	"__LINE__"		kw
    250 	"_"			kw
    251 	"associativity"		kw
    252 	"convenience"		kw
    253 	"dynamic"		kw
    254 	"didSet"		kw
    255 	"final"			storage
    256 	"get"			kw
    257 	"infix"			kw
    258 	"indirect"		kw
    259 	"lazy"			storage
    260 	"left"			kw
    261 	"mutating"		storage
    262 	"none"			kw
    263 	"nonmutating"		storage
    264 	"open"			storage
    265 	"optional"		kw
    266 	"override"		storage
    267 	"postfix"		kw
    268 	"precedence"		kw
    269 	"prefix"		kw
    270 	"Protocol"		builtin
    271 	"required"		kw
    272 	"right"			kw
    273 	"set"			kw
    274 	"Type"			builtin
    275 	"unowned"		kw
    276 	"weak"			kw
    277 	"willSet"		kw
    278 	
    279 	"String"		type
    280 	"Int"			type
    281 	"Int8"			type
    282 	"Int16"			type
    283 	"Int32"			type
    284 	"Int64"			type
    285 	"UInt"			type
    286 	"UInt8"			type
    287 	"UInt16"		type
    288 	"UInt32"		type
    289 	"UInt64"		type
    290 	"Float"			type
    291 	"Double"		type
    292 	"Bool"			type
    293 	"Character"		type
    294 	"Optional"		type
    295 done
    296 	"$\c"			ident
    297 
    298 :kw Keyword
    299 	*		idle		noeat
    300 
    301 :bool Boolean
    302 	*		idle		noeat
    303 
    304 :lit Constant
    305 	*		idle		noeat
    306 
    307 :oper Operator
    308 	*		idle		noeat
    309 
    310 :storage StorageClass
    311 	*		idle		noeat
    312 
    313 :modifier Modifier
    314 	*		idle		noeat
    315 
    316 :label Label
    317 	*		idle		noeat
    318 
    319 :loop Loop
    320 	*		idle		noeat
    321 
    322 :cond Conditional
    323 	*		idle		noeat
    324 
    325 :stmt Statement
    326 	*		idle		noeat
    327 
    328 :builtin Builtin
    329 	*		idle		noeat
    330 
    331 :type Type
    332 	*		idle		noeat
    333 
    334 .end
    335 
    336 # Recursive block comments
    337 
    338 .subr block_comment
    339 
    340 :idle Comment comment
    341 	*		idle
    342 	"*"		maybe_done
    343 	"/"		maybe_recur
    344 	"BFHNTX"	idle	noeat call=comment_todo.comment_todo()
    345 
    346 :maybe_done Comment comment
    347 	*		idle	noeat
    348 	"/"		idle	return
    349 
    350 :maybe_recur Comment comment
    351 	*		idle	noeat
    352 	"*"		idle	call=.block_comment()
    353 
    354 .end