# tracWiki defn

family css

state IN_CSL_DEFAULT
/^/ : => in_tw_default_start_of_line
/\z/ : paint(upto, CSS_DEFAULT)

state in_tw_default_start_of_line:
'{{{' : paint(upto, CSS_DEFAULT), => in_tw_triple_brace_start
'= ': paint(upto, CSS_DEFAULT), => in_tw_h1
'== ': paint(upto, CSS_DEFAULT), => in_tw_h2
'=== ': paint(upto, CSS_DEFAULT), => in_tw_h3
'==== ': paint(upto, CSS_DEFAULT), => in_tw_h4
'===== ': paint(upto, CSS_DEFAULT), => in_tw_h5
/./: redo, => in_tw_default_on_line

state in_tw_default_on_line:
/$/: => in_tw_default_start_of_line
"'''''" : paint(upto, CSS_DEFAULT), => in_tw_q5
"'''" : paint(upto, CSS_DEFAULT), => in_tw_q3
"''" : paint(upto, CSS_DEFAULT), => in_tw_q2
"__" : paint(upto, CSS_DEFAULT), => in_tw_ul2
"~~" : paint(upto, CSS_DEFAULT), => in_tw_tilde2
"^" : paint(upto, CSS_DEFAULT), => in_tw_caret
",," : paint(upto, CSS_DEFAULT), => in_tw_comma2
'{{{' : paint(upto, CSS_DEFAULT), => in_tw_brace_3
/!'+/: #stay
/![~^{,]+/: #stay
/$/: => in_tw_default_start_of_line

#{{{ braces
state in_tw_triple_brace_start:
/\s*\r?$/: => in_tw_triple_brace_next_line
/./: redo, => in_tw_brace_3

# First line after a lone "{{{" will change state.
state in_tw_triple_brace_next_line
/#!python\b/: paint(include, CSS_OPERATOR), => IN_SSL_DEFAULT
/#!html\b/: paint(include, CSS_OPERATOR), => IN_M_DEFAULT
/./ : redo, => in_tw_brace_3

state in_tw_brace_3:
/!./: #stay
'}}}': paint(include, CSL_REGEX), => in_tw_default_on_line
#}}}
#{{{ headers
# bangs don't escape in headings
state in_tw_h1:
/ =(?=[\s\r#]|$)/: paint(include, CSL_STRING), => in_tw_finish_header
/$/ => in_tw_default_start_of_line # XXX Better to have an EOL_HEADER line
state in_tw_h2:
/ ==(?=[\s\r#]|$)/: paint(include, CSL_STRING), => in_tw_finish_header
/$/ => in_tw_default_start_of_line
state in_tw_h3:
/ ===(?=[\s\r#]|$)/: paint(include, CSL_STRING), => in_tw_finish_header
/$/ => in_tw_default_start_of_line
state in_tw_h4:
/ ====(?=[\s\r#]|$)/: paint(include, CSL_STRING), => in_tw_finish_header
/$/ => in_tw_default_start_of_line
state in_tw_h5:
/ =====(?=[\s\r#]|$)/: paint(include, CSL_STRING), => in_tw_finish_header
/$/ => in_tw_default_start_of_line

state in_tw_finish_header:
/$/ : => in_tw_default_start_of_line
/\s+/ : #stay
'#': paint(upto, CSL_DEFAULT), => in_tw_have_comment
/./: redo, => in_tw_default_on_line

state in_tw_have_comment:
# These things are actually IDs that would be part of the element.
/[^\w\d_\-.]|$/: paint(include, CSL_COMMENT),  => in_tw_default_start_of_line

#}}}


#{{{ in-line things
state in_tw_q5:
/!'+/: #stay
"'''''" : paint(include, CSL_IDENTIFIER), => in_tw_default_on_line
state in_tw_q3:
/!'+/: #stay
"'''" : paint(include, CSL_IDENTIFIER), => in_tw_default_on_line
state in_tw_q2:
/!'+/: #stay
"''" : paint(include, CSL_IDENTIFIER), => in_tw_default_on_line
state in_tw_ul2:
/!_+/: #stay
"__" : paint(include, CSL_WORD), => in_tw_default_on_line
state in_tw_tilde2:
/!~+/: #stay
"~~" : paint(include, CSL_WORD), => in_tw_default_on_line
state in_tw_caret:
/!^/: #stay
"^" : paint(include, CSL_WORD), => in_tw_default_on_line
state in_tw_comma2:
/!,+/: #stay
",," : paint(include, CSL_WORD), => in_tw_default_on_line
#}}}
