1# JOE syntax highlight file for PHP
2# modified by Eric Lin
3
4# TODO:
5#  * heredoc support (as good as possible)
6#  * highlight function and class names?
7
8# Define colors
9
10=Idle
11=Comment
12=Constant
13=Number		+Constant
14=String		+Constant
15=StringEscape	+Escape
16=Character	+Constant
17=CharacterEscape +Escape
18=Boolean	+Constant
19=Escape
20=Keyword
21=Variable	+DefinedIdent
22=Builtin	+DefinedFunc
23=Operator	+Keyword
24=Statement	+Keyword
25=Conditional	+Statement
26=Loop		+Statement
27=Structure	+Statement
28=Label		+DefinedIdent
29=StorageClass	+Type +Keyword
30
31# Call HTML highlighter.  It will call the PHP highlighter subroutine in this file.
32
33:begin Idle
34	*	call_failed	noeat call=html.html(php)
35
36:call_failed Variable
37	*	call_failed
38
39# PHP highlighter.
40
41.subr php
42
43:idle Idle
44	*		idle
45	"<"		idle_done
46	"?"		idle_qmark
47	"%"		idle_hash
48	"#"		sh_comment	recolor=-1
49	"/"		slash
50	"0-9"		first_digit	recolor=-1
51	"'"		string_sq	recolor=-1
52	"\""		string_dq	recolor=-1
53	"\`"		string_bq	recolor=-1
54	"\i"		ident		buffer
55	"$"   php_var recolor=-1
56	"-" maybe_method
57	"{}"  brace recolor=-1
58
59:idle_done Idle
60	*		idle noeat
61	"/"		idle noeat recolor=-2 return
62	"<"		idle_here
63
64:idle_here Idle
65	*		idle noeat
66	"<"		here_doc
67
68:here_doc Idle
69	*		idle noeat
70	" 	"	here_doc
71	"\i"		here_name buffer
72
73:here_name Idle
74	*		inhere_doc save_s
75	"\c"		here_name
76
77:inhere_doc Constant
78	*		inhere_not_eol
79	"\n"		inhere_doc
80	"\i"		inhere_name buffer
81
82:inhere_not_eol Constant
83	*		inhere_not_eol
84	"\n"		inhere_doc
85
86:inhere_name Constant
87	*		inhere_doc
88	";"		inhere_doc strings
89	"&"		idle
90done
91	"\c"		inhere_name
92
93:brace Builtin
94  * idle  noeat
95
96:php_var Variable
97  * idle noeat
98  "\c" php_var
99
100:var_indqstring Variable
101	*	string_dq	recolor=-1
102	"\i"	var_indqstringr
103	"\""	string_dq	noeat
104	"\\"	string_dq_esc	recolor=-1
105
106:var_indqstringr Variable
107	*	string_dq	recolor=-1
108	"\c"	var_indqstringr
109	"\""	string_dq	noeat
110	"\\"	string_dq_esc	recolor=-1
111
112:var_inbqstring Variable
113	*	string_bq	recolor=-1
114	"\i"	var_inbqstringr
115	"\`"	string_bq	noeat
116	"\\"	string_bq_esc	recolor=-1
117
118:var_inbqstringr Variable
119	*	string_bq	recolor=-1
120	"\c"	var_inbqstringr
121	"\`"	string_bq	noeat
122	"\\"	string_bq_esc	recolor=-1
123
124:maybe_method Builtin
125	*		idle  recolor=-1
126	"?"		idle_qmark
127	"%"		idle_hash
128	"#"		sh_comment	recolor=-1
129	"/"		slash
130	"0-9"		first_digit	recolor=-1
131	"'"		string_sq	recolor=-1
132	"\""		string_dq	recolor=-1
133	"\i"	ident		buffer
134	"$"   php_var recolor=-1
135	"{}"  brace recolor=-1
136  ">" method  recolor=-2
137
138:method Builtin
139	*	idle	recolor=-1
140	"\i\c"	method	recolor=-1
141
142:idle_qmark Idle
143	*		idle		noeat
144	">"		idle recolor=-2 return
145
146:idle_hash Idle
147	*		idle	noeat
148	">"		idle recolor=-2 return
149
150:sh_comment Comment comment
151	*		sh_comment
152	"BFHNTX"	sh_comment	noeat call=comment_todo.comment_todo()
153	"\n"		idle
154
155:slash Idle
156	*		idle		noeat
157	"*"		comment		recolor=-2
158	"/"		line_comment	recolor=-2
159
160:comment Comment comment
161	*		comment
162	"*"		maybe_end_comment
163	"BFHNTX"	comment		noeat call=comment_todo.comment_todo()
164
165:maybe_end_comment Comment comment
166	*		comment
167	"/"		idle
168	"*"		maybe_end_comment
169
170:line_comment Comment comment
171	*		line_comment
172	"\n"		idle
173	"BFHNTX"	line_comment	noeat call=comment_todo.comment_todo()
174
175:string_sq Character string
176	*		string_sq
177	"\'"		idle
178	"\\"		string_sq_esc	recolor=-1
179
180:string_sq_esc CharacterEscape string
181	*		string_sq
182	"\n"		string_sq	recolor=-2
183
184:string_dq String string
185	*		string_dq
186	"$"     var_indqstring recolor=-1
187	"\""		idle
188	"\\"		string_dq_esc	recolor=-1
189
190:string_dq_esc StringEscape string
191	*		string_dq
192	"\n"		string_dq	recolor=-2
193
194:string_bq String string
195	*		string_bq
196	"$"     var_inbqstring recolor=-1
197	"\`"		idle
198	"\\"		string_bq_esc	recolor=-1
199
200:string_bq_esc StringEscape string
201	*		string_bq
202	"\n"		string_bq	recolor=-2
203
204:first_digit Number
205	*		idle	noeat
206	"xX"		hex
207	"."		float
208	"0"		octal
209	"1-9"		first_number
210
211:octal Number
212	*		idle	noeat
213	"0-7"		octal
214
215:hex Number
216	*		idle	noeat
217	"0-9A-Fa-f"	hex
218
219:first_number Number
220	*		idle	noeat
221	"0-9"		first_number
222	"."		float
223
224:maybe_float Number
225	*		idle	recolor=-2	noeat
226	"0-9"		float		recolor=-2
227
228:float Number
229	*		idle	noeat
230	"eE"		epart
231	"0-9"		float
232
233:epart Number
234	*		idle	noeat
235	"0-9+\-"	enum
236
237:enum Number
238	*		idle	noeat
239	"0-9"		enum
240
241:ident Idle
242	*		idle		noeat strings
243	"addslashes" 	builtin
244	"array"		builtin
245	"array_keys"	builtin
246	"count"		builtin
247	"date"		builtin
248	"chr"		builtin
249	"empty"		builtin
250	"end"		builtin
251	"header"	builtin
252	"highlight_file"	builtin
253	"htmlspecialchars"	builtin
254	"isset"		builtin
255	"shuffle"	builtin
256	"strip_tags"	builtin
257	"strlen"	builtin
258	"strpos"	builtin
259	"strrpos"	builtin
260	"substr"	builtin
261	"trim"		builtin
262	"TRUE"		bool
263	"FALSE"		bool
264	"true"		bool
265	"false"		bool
266	"and"		oper
267	"as"		oper
268	"break"		loop
269	"case"		label
270	"class"		struct
271	"continue"	loop
272	"declare"	struct
273	"default"	kw
274	"die"		kw
275	"do"		loop
276	"echo"		stmt
277	"else"		cond
278	"elseif"	cond
279	"eval"		kw
280	"exception"	kw
281	"exit"		kw
282	"extends"	struct
283	"for"		loop
284	"foreach"	loop
285	"function"	struct
286	"global"	kw
287	"if"		cond
288	"include"	stmt
289	"include_once"	stmt
290	"list"		kw
291	"new"		kw
292	"or"		oper
293	"print"		stmt
294	"private"	storage
295	"public"	storage
296	"require"	stmt
297	"require_once"	stmt
298	"return"	stmt
299	"static"	storage
300	"switch"	cond
301	"unset"		stmt
302	"while"		loop
303done
304	"\c"	ident
305
306:kw Keyword
307	*	idle	noeat
308
309:builtin Builtin
310  * idle  noeat
311
312:bool Boolean
313  * idle  noeat
314
315:var Variable
316  * mark  noeat
317
318:oper Operator
319  * idle  noeat
320
321:loop Loop
322  * idle  noeat
323
324:cond Conditional
325  * idle  noeat
326
327:stmt Statement
328  * idle  noeat
329
330:label Label
331  * idle  noeat
332
333:struct Structure
334  * idle  noeat
335
336:storage StorageClass
337  * idle  noeat
338
339.end
340