1# Fancy "sed" highlighter
2
3# Bugs: delimiter should be ignored in [...]
4#
5#       it would be nice if this did more correct
6#       error checking for the sed programmer
7
8-
9
10=Idle
11=Comment
12=String		+Constant
13=StringEscape	+Escape
14=Regex		+String
15=RegexEscape	+StringEscape
16=Bad
17=Keyword
18=Delimiter	#+Operator +Type
19=Label		+DefinedIdent
20
21# Zero address commands: # : }
22# Zero or one address: = a i q r
23# Range address: { b t c d D h H g G x l n N p P s w y
24
25:idle Idle
26	*		cmd		noeat
27	" \t"		idle
28	"\n"		idle
29	"0-9"		first_addr	recolor=-1
30	"$"		first_eof	recolor=-1
31	"/"		first_regex_c	recolor=-1
32
33:first_eof String string
34	*		first_addr_done	noeat
35
36:first_regex_c Delimiter
37	*		first_regex	noeat
38
39:first_regex Regex string
40	*		first_regex
41	"\\"		first_regex_quote	recolor=-1
42	"/"		first_regex_e		recolor=-1
43
44:first_regex_e Delimiter
45	*		first_addr_done		noeat
46
47:first_regex_quote RegexEscape string
48	*		first_regex
49
50:first_addr String string
51	*		first_addr_done	noeat
52	"0-9"		first_addr
53
54:first_addr_done Idle
55	*		cmd		noeat
56	","		second_addr_start
57
58:second_addr_start Idle
59	*		bad		noeat
60	"0-9"		second_addr	recolor=-1
61	"$"		second_eof	recolor=-1
62	"/"		second_regex	recolor=-1
63
64:second_eof String string
65	*		cmd		noeat
66
67:second_regex Regex string
68	*		second_regex
69	"/"		cmd
70
71:second_addr String string
72	*		cmd		noeat
73	"0-9"		second_addr
74
75:bad Bad
76	*		bad
77	"\n"		idle
78
79:cmd Delimiter
80	*		the_cmd		noeat
81	" \t"		cmd
82	"!"		the_cmd
83
84:the_cmd Idle
85	*		bad		noeat
86	" \t"		the_cmd
87	";"		next		noeat
88	"#"		comment		recolor=-1
89	"sy"		accepts		recolor=-1
90	"{"		accepto		recolor=-1
91	"aic"		accept		recolor=-1
92	"=}rqbtdDhHgGxlnNpPw"	acceptc	recolor=-1
93	":"		label		recolor=-1
94
95:accepto Keyword
96	*		idle		noeat
97
98:accept Keyword
99	*		next		noeat
100
101:acceptc Keyword
102	*		nextallow	noeat
103
104:accepts Keyword
105	*		subst		noeat
106
107:label Label
108	*		idle		noeat
109	"a-zA-Z0-9"	label
110
111:subst Delimiter
112	*		subst_rest	save_c
113
114:subst_rest String string
115	*		subst_rest
116	&		subst_rest_2_c		recolor=-1
117	"\\"		subst_rest_quote	recolor=-1
118
119:subst_rest_quote StringEscape string
120	*		subst_rest
121
122:subst_rest_2_c Delimiter
123	*		subst_rest_2		noeat
124
125:subst_rest_2 String string
126	*		subst_rest_2
127	&		next_c			recolor=-1
128	"\\"		subst_rest_2_quote	recolor=-1
129
130:next_c Delimiter
131	*		nextallow	noeat
132
133:subst_rest_2_quote StringEscape string
134	*		subst_rest_2
135
136:nextallow Idle
137	*		nextallow
138	"\n"		idle
139	";"		idle
140	"#"		comment	recolor=-1
141
142:next Idle
143	*		next
144	"\n"		idle
145	"\\"		continue
146
147:continue Idle
148	*		next
149
150:comment Comment comment
151	*		comment
152	"\n"		idle
153