CSS: rewrite selector parser frm scratch for more modularity

This commit is contained in:
cn 2011-11-07 23:39:10 +01:00
parent 78dda67321
commit 0109cc7c7d
1 changed files with 39 additions and 26 deletions

65
css.jsf
View File

@ -10,7 +10,7 @@
=Keyword bold =Keyword bold
=Bad bold red =Bad bold red
=Class cyan =Class yellow
=Id red =Id red
=Tag magenta =Tag magenta
=HTML =HTML
@ -31,9 +31,9 @@
* reset * reset
"<" maybe_done recolor=-1 "<" maybe_done recolor=-1
"/" slash "/" slash
"#" id_block recolor=-1 # prevent duplicate code
"." class_block recolor=-1 "#.a-zA-Z" selector noeat
"a-zA-Z" tag_block recolor=-1 "@" command recolor=-1
:maybe_done TagEdge :maybe_done TagEdge
* reset_html noeat * reset_html noeat
@ -63,31 +63,44 @@
"/" reset "/" reset
"*" maybe_end_comment "*" maybe_end_comment
:command Idle
* command
";" reset
"{" command_block
:command_block Idle
* command_block
"}" reset
# CSS selectors # CSS selectors
:id_block Id :selector Idle
* id_block * selector
" " id_block_reset "#" id_sel recolor=-1
"." class_sel recolor=-1
"a-zA-Z" tag_sel recolor=-1
":" pseudo_class_sel recolor=-1
"{" style_block recolor=-1 "{" style_block recolor=-1
:id_block_reset Idle :id_sel Id
* id_block * selector noeat
"a-zA-Z" tag_block recolor=-1 "a-zA-Z0-9_-" id_sel
"." class_block recolor=-1
"#" id_block recolor=-1 :class_sel Class
"{" style_block recolor=-1 * selector noeat
"a-zA-Z0-9_-" class_sel
:class_block Class
* class_block :tag_sel Tag
" " tag_block * selector noeat
"{" style_block recolor=-1 "a-zA-Z0-9_-" tag_sel
"[" tag_sel_attr recolor=-1
:tag_block Tag
* tag_block :tag_sel_attr Idle
"{" style_block recolor=-1 * tag_sel_attr
"," tag_sep recolor=-1 "]" selector
:tag_sep Idle :pseudo_class_sel Idle
* tag_block recolor=-1 * selector noeat
"a-zA-Z0-9_-" pseudo_class_sel
# everything inside "{ ... }", containing many "key: value;" pairs # everything inside "{ ... }", containing many "key: value;" pairs
:style_block Idle :style_block Idle