dotfiles

My dotfiles.
Log | Files | Refs | LICENSE

python.jsf (6997B)


      1 # JOE syntax highlight file for Python
      2 
      3 =Idle
      4 =Ident
      5 =Comment
      6 =Docstring	+Comment
      7 =DocstringLabel	+Docstring
      8 =DocEscape	+Escape +Docstring
      9 =Constant
     10 =String		+Constant
     11 =Number		+Constant
     12 =Boolean	+Constant
     13 =StringEscape	+Escape
     14 =Keyword
     15 =Statement	+Keyword
     16 =Loop		+Statement
     17 =Conditional	+Statement
     18 =StorageClass	+Type +Keyword
     19 =Operator	+Keyword
     20 =Bad
     21 =Brace
     22 
     23 =DefinedIdent	+Ident
     24 =DefinedFunction +DefinedIdent
     25 =DefinedType	+DefinedIdent
     26 =SpecialIdent	+Ident
     27 =Decorator	+Define +Preproc
     28 =Builtin	+DefinedFunction
     29 
     30 :idle Idle
     31 	*		idle
     32 	"#"		comment		recolor=-1
     33 	"0-9"		first_digit	recolor=-1
     34 	"'\""		string_quot_1	recolor=-1 save_c
     35 	"\i"		ident		noeat
     36 	"{}"		brace		recolor=-1
     37 	"@"		decorator	recolor=-1
     38 
     39 :brace Brace
     40 	*		idle		noeat
     41 
     42 # annotations
     43 :decorator Decorator
     44 	*		decorator
     45 	" (\t\r\n"	idle		noeat
     46 
     47 :comment Comment comment
     48 	*		comment
     49 	# might be TODO label
     50 	"BFHNTX"	comment		noeat call=comment_todo.comment_todo()
     51 	"\n"		idle
     52 
     53 :first_digit Number
     54 	*		idle		noeat
     55 	"xX"		hex
     56 	"."		float
     57 	"eE"		epart
     58 	"0-9"		first_number
     59 
     60 :hex Number
     61 	*		idle		noeat
     62 	"0-9A-Fa-f"	hex
     63 
     64 :first_number Number
     65 	*		idle		noeat
     66 	"0-9"		first_number
     67 	"."		float
     68 
     69 :maybe_float Number
     70 	*		idle		recolor=-2	noeat
     71 	"0-9"		float		recolor=-2
     72 
     73 :float Number
     74 	*		idle		noeat
     75 	"eE"		epart
     76 	"0-9"		float
     77 
     78 :epart Number
     79 	*		idle		noeat
     80 	"0-9+\-"	enum
     81 
     82 :enum Number
     83 	*		idle		noeat
     84 	"0-9"		enum
     85 
     86 :ident Ident
     87 	*		ident1		noeat buffer
     88 	"_"		priv_member	recolor=-1
     89 
     90 :ident1 Ident
     91 	*		idle		noeat strings
     92 	"and"		oper
     93 	"as"		stmt
     94 	"assert"	stmt
     95 	"break"		loop
     96 	"class"		classstmt
     97 	"continue"	loop
     98 	"def"		defstmt
     99 	"del"		stmt
    100 	"elif"		cond
    101 	"else"		cond
    102 	"except"	stmt
    103 	"finally"	stmt
    104 	"for"		loop
    105 	"from"		stmt
    106 	"global"	stmt
    107 	"if"		cond
    108 	"import"	stmt
    109 	"in"		oper
    110 	"is"		oper
    111 	"lambda"	kw
    112 	"not"		oper
    113 	"or"		oper
    114 	"pass"		stmt
    115 	"raise"		stmt
    116 	"return"	stmt
    117 	"try"		stmt
    118 	"while"		loop
    119 	"with"		stmt
    120 	"yield"		stmt
    121 	
    122 	# quasi-keywords
    123 	"False"		bool
    124 	"True"		bool
    125 	"None"		kw
    126 	
    127 	# builtins
    128 	"abs"		builtin
    129 	"all"		builtin
    130 	"any"		builtin
    131 	"ascii"		builtin
    132 	"bin"		builtin
    133 	"bool"		builtin
    134 	"bytearray"	builtin
    135 	"bytes"		builtin
    136 	"callable"	builtin
    137 	"chr"		builtin
    138 	"classmethod"	builtin
    139 	"compile"	builtin
    140 	"complex"	builtin
    141 	"copyright"	builtin
    142 	"credits"	builtin
    143 	"delattr"	builtin
    144 	"dict"		builtin
    145 	"dir"		builtin
    146 	"divmod"	builtin
    147 	"enumerate"	builtin
    148 	"eval"		builtin
    149 	"exec"		builtin
    150 	"exit"		builtin
    151 	"filter"	builtin
    152 	"float"		builtin
    153 	"format"	builtin
    154 	"frozenset"	builtin
    155 	"getattr"	builtin
    156 	"globals"	builtin
    157 	"hasattr"	builtin
    158 	"hash"		builtin
    159 	"help"		builtin
    160 	"hex"		builtin
    161 	"id"		builtin
    162 	"input"		builtin
    163 	"int"		builtin
    164 	"isinstance"	builtin
    165 	"issubclass"	builtin
    166 	"iter"		builtin
    167 	"len"		builtin
    168 	"license"	builtin
    169 	"list"		builtin
    170 	"locals"	builtin
    171 	"map"		builtin
    172 	"max"		builtin
    173 	"memoryview"	builtin
    174 	"min"		builtin
    175 	"next"		builtin
    176 	"object"	builtin
    177 	"oct"		builtin
    178 	"open"		builtin
    179 	"ord"		builtin
    180 	"pow"		builtin
    181 	"print"		builtin
    182 	"property"	builtin
    183 	"quit"		builtin
    184 	"range"		builtin
    185 	"repr"		builtin
    186 	"reversed"	builtin
    187 	"round"		builtin
    188 	"set"		builtin
    189 	"setattr"	builtin
    190 	"slice"		builtin
    191 	"sorted"	builtin
    192 	"staticmethod"	builtin
    193 	"str"		builtin
    194 	"sum"		builtin
    195 	"super"		builtin
    196 	"tuple"		builtin
    197 	"type"		builtin
    198 	"vars"		builtin
    199 	"zip"		builtin
    200 	
    201 done
    202 	"'\""		idle 		noeat istrings
    203 	"u"		string_pre
    204 	"b"		string_pre
    205 	"r"		string_raw_pre
    206 	"br"		string_raw_pre
    207 	"rb"		string_raw_pre
    208 done
    209 	"\c"		ident1
    210 
    211 :kw Keyword
    212 	*		idle		noeat
    213 
    214 :cond Conditional
    215 	*		idle		noeat
    216 
    217 :oper Operator
    218 	*		idle		noeat
    219 
    220 :bool Boolean
    221 	*		idle		noeat
    222 
    223 :loop Loop
    224 	*		idle		noeat
    225 
    226 :stmt Statement
    227 	*		idle		noeat
    228 
    229 :builtin Builtin
    230 	*		idle		noeat
    231 
    232 :classstmt Statement
    233 	*		idle 		noeat recolor=-1
    234 	"\i"		classstmt
    235 	" \t"		classname_1
    236 
    237 :classname_1 DefinedType
    238 	*		classname
    239 
    240 :classname DefinedType
    241 	*		idle		noeat recolor=-1
    242 	"\c"		classname
    243 
    244 :defstmt Statement
    245 	*		idle		noeat recolor=-1
    246 	"\i"		defstmt
    247 	" \t"		defname_1
    248 
    249 :defname_1 DefinedFunction
    250 	*		defname
    251 
    252 :defname DefinedFunction
    253 	*		idle		noeat recolor=-1
    254 	"\c"		defname
    255 
    256 :priv_member SpecialIdent
    257 	*		idle		noeat
    258 	"\c"		priv_member
    259 
    260 # Handle string prefixes up to the string itself.
    261 :string_pre String string
    262 	*		idle noeat
    263 	"'\""		string_quot_1 	save_c
    264 
    265 :string_raw_pre String string
    266 	*		idle noeat
    267 	"'\""		string_quot_raw_1 save_c
    268 
    269 # Differentiate between docstrings and regular strings, carrying with it raw state
    270 :string_quot_1 String string
    271 	*		idle call=.string() noeat
    272 	&		string_quot_2
    273 
    274 :string_quot_2 String string
    275 	*		idle noeat
    276 	&		idle call=.string(docstring) recolor=-3
    277 
    278 :string_quot_raw_1 String string
    279 	*		idle call=.string(raw)
    280 	&		string_quot_raw_2
    281 
    282 :string_quot_raw_2 String string
    283 	*		idle noeat
    284 	&		idle call=.string(docstring raw) recolor=-3
    285 
    286 .subr string
    287 
    288 .ifdef docstring	# Long strings
    289 :string Docstring string
    290 	*		string
    291 	"BFHNTX"	string		noeat call=.comment_todo_docstr()
    292 .ifdef raw
    293 .else
    294 	"\\"		string_esc	mark
    295 .endif
    296 	&		doc_end_1
    297 
    298 :doc_end_1 Docstring string
    299 	*		string noeat
    300 	&		doc_end_2
    301 
    302 :doc_end_2 Docstring string
    303 	*		string noeat
    304 	&		string return
    305 
    306 .else			# Short strings
    307 
    308 :string String string
    309 	*		string
    310 	"\n"		string return
    311 .ifdef raw
    312 .else
    313 	"\\"		string_esc mark
    314 .endif
    315 	&		string return
    316 
    317 .endif
    318 
    319 :string_esc String string
    320 	*		string_esc_done
    321 	"x"		string_hex2
    322 	"u"		string_hex4
    323 	"U"		string_hex8
    324 	"0-7"		string_octal2
    325 	"\n"		string_esc_done
    326 
    327 # Recolor whole escape sequence based on whether this is a docstring.
    328 :string_esc_done String string
    329 	*		string_esc_really_done noeat markend recolormark
    330 
    331 .ifdef docstring
    332 :string_esc_really_done DocEscape
    333 	*		string 		noeat
    334 .else
    335 :string_esc_really_done StringEscape string
    336 	*		string 		noeat
    337 .endif
    338 
    339 :string_hex1 StringEscape string
    340 	*		string_esc_done	noeat
    341 	"0-9a-fA-F"	string_esc_done
    342 
    343 :string_hex2 StringEscape string
    344 	*		string_esc_done	noeat
    345 	"0-9a-fA-F"	string_hex1
    346 
    347 :string_hex3 StringEscape string
    348 	*		string_esc_done	noeat
    349 	"0-9a-fA-F"	string_hex2
    350 
    351 :string_hex4 StringEscape string
    352 	*		string_esc_done	noeat
    353 	"0-9a-fA-F"	string_hex3
    354 
    355 :string_hex5 StringEscape string
    356 	*		string_esc_done	noeat
    357 	"0-9a-fA-F"	string_hex4
    358 
    359 :string_hex6 StringEscape string
    360 	*		string_esc_done	noeat
    361 	"0-9a-fA-F"	string_hex5
    362 
    363 :string_hex7 StringEscape string
    364 	*		string_esc_done	noeat
    365 	"0-9a-fA-F"	string_hex6
    366 
    367 :string_hex8 StringEscape string
    368 	*		string_esc_done	noeat
    369 	"0-9a-fA-F"	string_hex7
    370 
    371 :string_octal1 StringEscape string
    372 	*		string_esc_done	noeat
    373 	"0-7"		string_esc_done
    374 
    375 :string_octal2 StringEscape string
    376 	*		string_esc_done	noeat
    377 	"0-7"		string_octal1
    378 
    379 .end
    380 
    381 .subr comment_todo_docstr
    382 # initial state
    383 :comment_todo_init Docstring string
    384 	*		comment_todo_guess	buffer
    385 
    386 # highlight common TODO labels
    387 :comment_todo_guess Docstring string
    388 	*		comment_todo_unknown	noeat strings
    389 	"BUG"		comment_todo
    390 	"FIXME"		comment_todo
    391 	"HACK"		comment_todo
    392 	"NOTE"		comment_todo
    393 	"TODO"		comment_todo
    394 	"XXX"		comment_todo
    395 done
    396 	"A-Z"		comment_todo_guess
    397 
    398 :comment_todo_unknown Docstring string
    399 	*		NULL		noeat return
    400 
    401 :comment_todo DocstringLabel string
    402 	*		NULL		noeat return
    403 .end