Browse Source

CSS: rewrite selector parser frm scratch for more modularity

pull/3/head
cn 9 years ago
parent
commit
0109cc7c7d
1 changed files with 39 additions and 26 deletions
  1. +39
    -26
      css.jsf

+ 39
- 26
css.jsf View File

@@ -10,7 +10,7 @@
=Keyword bold
=Bad bold red

=Class cyan
=Class yellow
=Id red
=Tag magenta
=HTML
@@ -31,9 +31,9 @@
* reset
"<" maybe_done recolor=-1
"/" slash
"#" id_block recolor=-1
"." class_block recolor=-1
"a-zA-Z" tag_block recolor=-1
# prevent duplicate code
"#.a-zA-Z" selector noeat
"@" command recolor=-1

:maybe_done TagEdge
* reset_html noeat
@@ -63,31 +63,44 @@
"/" reset
"*" maybe_end_comment

:command Idle
* command
";" reset
"{" command_block

:command_block Idle
* command_block
"}" reset

# CSS selectors
:id_block Id
* id_block
" " id_block_reset
:selector Idle
* selector
"#" id_sel recolor=-1
"." class_sel recolor=-1
"a-zA-Z" tag_sel recolor=-1
":" pseudo_class_sel recolor=-1
"{" style_block recolor=-1

:id_block_reset Idle
* id_block
"a-zA-Z" tag_block recolor=-1
"." class_block recolor=-1
"#" id_block recolor=-1
"{" style_block recolor=-1
:class_block Class
* class_block
" " tag_block
"{" style_block recolor=-1
:tag_block Tag
* tag_block
"{" style_block recolor=-1
"," tag_sep recolor=-1
:tag_sep Idle
* tag_block recolor=-1
:id_sel Id
* selector noeat
"a-zA-Z0-9_-" id_sel

:class_sel Class
* selector noeat
"a-zA-Z0-9_-" class_sel

:tag_sel Tag
* selector noeat
"a-zA-Z0-9_-" tag_sel
"[" tag_sel_attr recolor=-1

:tag_sel_attr Idle
* tag_sel_attr
"]" selector

:pseudo_class_sel Idle
* selector noeat
"a-zA-Z0-9_-" pseudo_class_sel

# everything inside "{ ... }", containing many "key: value;" pairs
:style_block Idle


Loading…
Cancel
Save