dotfiles

My dotfiles.
Log | Files | Refs | LICENSE

css.jsf (2855B)


      1 # JOE syntax highlight file for CSS
      2 # by Eric Lin
      3 
      4 # Define colors
      5 
      6 =Idle
      7 =Comment
      8 =Constant
      9 =Number		+Constant
     10 =Escape
     11 =Keyword
     12 =Bad
     13 
     14 =Class		+Type
     15 =Id		+String +DefinedIdent
     16 =Tag
     17 =HTML		# TODO: Get back to this when going over html, xml, php, ant, etc
     18 
     19 # from html.jsf to support <?php?>
     20 =TagEdge
     21 
     22 :begin Idle
     23 	*		begin		noeat call=.css()
     24 
     25 #
     26 # For <style> in html
     27 #
     28 
     29 .subr css
     30 
     31 :reset HTML
     32 	*		reset
     33 	"<"		maybe_done	recolor=-1
     34 	"/"		slash
     35 	# prevent duplicate code
     36 	"#.a-zA-Z"	selector	noeat
     37 	"@"		command		recolor=-1
     38 
     39 :maybe_done TagEdge
     40 	*		reset_html	noeat
     41 	"/"		reset		noeat return recolor=-2
     42 .ifdef php
     43 	"?%"		rtn_php		call=php.php()
     44 .endif
     45 
     46 # fix needed to produce similar output without php
     47 :reset_html HTML
     48 	*		reset		noeat recolor=-2
     49 
     50 # this state allows php and perl to recolor the ?> %> or &> properly.
     51 :rtn_php TagEdge
     52 	*		reset		noeat
     53 
     54 :slash Idle
     55 	*		reset		noeat
     56 	"*"		comment		recolor=-2
     57 
     58 :comment Comment comment
     59 	*		comment
     60 	"*"		maybe_end_comment
     61 
     62 :maybe_end_comment Comment comment
     63 	*		comment
     64 	"/"		reset
     65 	"*"		maybe_end_comment
     66 
     67 :command Idle
     68 	*		command
     69 	";"		reset
     70 	"{"		command_block
     71 
     72 :command_block Idle
     73 	*		command_block
     74 	"}"		reset
     75 
     76 # CSS selectors
     77 :selector Idle
     78 	*		selector
     79 	"#"		id_sel		recolor=-1
     80 	"."		class_sel	recolor=-1
     81 	"a-zA-Z"	tag_sel		recolor=-1
     82 	":"		pseudo_class_sel	recolor=-1
     83 	"{"		style_block	recolor=-1
     84 
     85 :id_sel Id
     86 	*		selector	noeat
     87 	"a-zA-Z0-9_-"	id_sel
     88 
     89 :class_sel Class
     90 	*		selector	noeat
     91 	"a-zA-Z0-9_-"	class_sel
     92 
     93 :tag_sel Tag
     94 	*		selector	noeat
     95 	"a-zA-Z0-9_-"	tag_sel
     96 	"["		tag_sel_attr	recolor=-1
     97 
     98 :tag_sel_attr Idle
     99 	*		tag_sel_attr
    100 	"]"		selector
    101 
    102 :pseudo_class_sel Idle
    103 	*		selector	noeat
    104 	"a-zA-Z0-9_-"	pseudo_class_sel
    105 
    106 # everything inside "{ ... }", containing many "key: value;" pairs
    107 :style_block Idle
    108 	*		style_block
    109 	"}"		reset
    110 	"/"		maybe_style_comment
    111 	"a-zA-Z-"	style_word	recolor=-1
    112 
    113 :maybe_style_comment Idle
    114 	*		style_block	recolor=-1
    115 	"*"		style_comment	recolor=-2
    116 
    117 :style_comment Comment comment
    118 	*		style_comment
    119 	"*"		maybe_end_style_comment
    120   
    121 :maybe_end_style_comment Comment comment
    122 	*		comment
    123 	"/"		style_block
    124 	"*"		maybe_end_style_comment
    125 
    126 # property-key
    127 :style_word Keyword
    128 	*		style_word
    129 	":"		style_value	recolor=-1
    130 
    131 # property-value
    132 :style_value Idle
    133 	*		style_value
    134 	";"		style_block
    135 	# treat } without previous ; like ;}
    136 	"}"		style_block	noeat
    137 	"#"		color		recolor=-1
    138 	"0-9"		decimal		recolor=-1
    139 	"."		maybe_float
    140 	"a-zA-Z_"	ident
    141 
    142 :color Constant
    143 	*		style_value	noeat
    144 	"0-9a-fA-F"	color
    145 
    146 :decimal Number
    147 	*		style_value	noeat
    148 	"0-9"		decimal
    149 	"."		float
    150 	"a-zA-Z%"	decimal_unit
    151 
    152 :maybe_float Number
    153 	*		style_value	noeat recolor=-2
    154 	"0-9"		float		recolor=-2
    155 
    156 :float Number
    157 	*		style_value	noeat
    158 	"0-9"		float
    159 	"a-zA-Z%"	decimal_unit
    160 
    161 :decimal_unit Number
    162 	*		style_value	noeat
    163 	"a-zA-Z"	decimal_unit
    164 
    165 :ident Idle
    166 	*		style_value	noeat
    167 	"a-ZA-Z0-9_-"	ident
    168 
    169 .end