Commit | Line | Data |
---|---|---|
e8af40ee | 1 | ;;; ebnf-yac.el --- parser for Yacc/Bison |
984ae001 | 2 | |
5df4f04c | 3 | ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
d7a0267c | 4 | ;; Free Software Foundation, Inc. |
984ae001 | 5 | |
ac4780a1 VJL |
6 | ;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
7 | ;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> | |
ae16d111 | 8 | ;; Keywords: wp, ebnf, PostScript |
3ced5caa | 9 | ;; Version: 1.4 |
bd78fa1d | 10 | ;; Package: ebnf2ps |
984ae001 | 11 | |
8d9ea7b1 | 12 | ;; This file is part of GNU Emacs. |
984ae001 | 13 | |
b1fc2b50 | 14 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
984ae001 | 15 | ;; it under the terms of the GNU General Public License as published by |
b1fc2b50 GM |
16 | ;; the Free Software Foundation, either version 3 of the License, or |
17 | ;; (at your option) any later version. | |
984ae001 | 18 | |
8d9ea7b1 | 19 | ;; GNU Emacs is distributed in the hope that it will be useful, |
984ae001 GM |
20 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;; GNU General Public License for more details. | |
23 | ||
24 | ;; You should have received a copy of the GNU General Public License | |
b1fc2b50 | 25 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
984ae001 GM |
26 | |
27 | ;;; Commentary: | |
28 | ||
29 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
30 | ;; | |
31 | ;; | |
32 | ;; This is part of ebnf2ps package. | |
33 | ;; | |
34 | ;; This package defines a parser for Yacc/Bison. | |
35 | ;; | |
36 | ;; See ebnf2ps.el for documentation. | |
37 | ;; | |
38 | ;; | |
39 | ;; Yacc/Bison Syntax | |
40 | ;; ----------------- | |
41 | ;; | |
42 | ;; YACC = { YACC-Definitions }* "%%" { YACC-Rule }* [ "%%" [ YACC-Code ] ]. | |
43 | ;; | |
ac4780a1 VJL |
44 | ;; YACC-Definitions = ( "%token" | "%left" | "%right" | "%nonassoc" ) |
45 | ;; [ "<" Name ">" ] Name-List | |
46 | ;; | "%prec" Name | |
984ae001 GM |
47 | ;; | "any other Yacc definition" |
48 | ;; . | |
49 | ;; | |
50 | ;; YACC-Code = "any C definition". | |
51 | ;; | |
52 | ;; YACC-Rule = Name ":" Alternative ";". | |
53 | ;; | |
54 | ;; Alternative = { Sequence || "|" }*. | |
55 | ;; | |
56 | ;; Sequence = { Factor }*. | |
57 | ;; | |
58 | ;; Factor = Name | |
59 | ;; | "'" "character" "'" | |
60 | ;; | "error" | |
61 | ;; | "{" "C like commands" "}" | |
62 | ;; . | |
63 | ;; | |
64 | ;; Name-List = { Name || "," }*. | |
65 | ;; | |
66 | ;; Name = "[A-Za-z][A-Za-z0-9_.]*". | |
67 | ;; | |
68 | ;; Comment = "/*" "any character, but the sequence \"*/\"" "*/" | |
60df7255 | 69 | ;; | "//" "any character, but the newline \"\\n\"" "\\n". |
984ae001 GM |
70 | ;; |
71 | ;; | |
ac4780a1 VJL |
72 | ;; In other words, a valid Name begins with a letter (upper or lower case) |
73 | ;; followed by letters, decimal digits, underscore (_) or point (.). For | |
74 | ;; example: this_is_a_valid.name, Another_EXAMPLE, mIxEd.CaSe. | |
75 | ;; | |
76 | ;; | |
77 | ;; Acknowledgements | |
78 | ;; ---------------- | |
79 | ;; | |
80 | ;; Thanks to Matthew K. Junker <junker@alum.mit.edu> for the suggestion to deal | |
81 | ;; with %right, %left and %prec pragmas. His suggestion was extended to deal | |
82 | ;; with %nonassoc pragma too. | |
83 | ;; | |
84 | ;; | |
984ae001 GM |
85 | ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
86 | ||
e8af40ee | 87 | ;;; Code: |
984ae001 GM |
88 | |
89 | ||
90 | (require 'ebnf-otz) | |
91 | ||
92 | ||
93 | (defvar ebnf-yac-lex nil | |
94 | "Value returned by `ebnf-yac-lex' function.") | |
95 | ||
96 | ||
97 | (defvar ebnf-yac-token-list nil | |
98 | "List of `%TOKEN' names.") | |
99 | ||
100 | ||
101 | (defvar ebnf-yac-skip-char nil | |
102 | "Non-nil means skip printable characters with no grammatical meaning.") | |
103 | ||
104 | ||
105 | (defvar ebnf-yac-error nil | |
b373b419 | 106 | "Non-nil means \"error\" occurred.") |
984ae001 GM |
107 | |
108 | \f | |
109 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
f504d516 | 110 | ;; Syntactic analyzer |
984ae001 GM |
111 | |
112 | ||
113 | ;;; YACC = { YACC-Definitions }* "%%" { YACC-Rule }* [ "%%" [ YACC-Code ] ]. | |
114 | ;;; | |
115 | ;;; YACC-Code = "any C definition". | |
116 | ||
117 | (defun ebnf-yac-parser (start) | |
118 | "yacc/Bison parser." | |
119 | (let ((total (+ (- ebnf-limit start) 1)) | |
120 | (bias (1- start)) | |
121 | (origin (point)) | |
122 | syntax-list token rule) | |
123 | (goto-char start) | |
124 | (setq token (ebnf-yac-lex)) | |
125 | (and (eq token 'end-of-input) | |
e8af40ee | 126 | (error "Invalid Yacc/Bison file format")) |
984ae001 | 127 | (or (eq (ebnf-yac-definitions token) 'yac-separator) |
e8af40ee | 128 | (error "Missing `%%%%'")) |
984ae001 GM |
129 | (setq token (ebnf-yac-lex)) |
130 | (while (not (memq token '(end-of-input yac-separator))) | |
131 | (ebnf-message-float | |
132 | "Parsing...%s%%" | |
133 | (/ (* (- (point) bias) 100.0) total)) | |
134 | (setq token (ebnf-yac-rule token) | |
135 | rule (cdr token) | |
136 | token (car token)) | |
137 | (or (ebnf-add-empty-rule-list rule) | |
138 | (setq syntax-list (cons rule syntax-list)))) | |
139 | (goto-char origin) | |
140 | syntax-list)) | |
141 | ||
142 | ||
ac4780a1 VJL |
143 | ;;; YACC-Definitions = ( "%token" | "%left" | "%right" | "%nonassoc" ) |
144 | ;;; [ "<" Name ">" ] Name-List | |
145 | ;;; | "%prec" Name | |
984ae001 GM |
146 | ;;; | "any other Yacc definition" |
147 | ;;; . | |
148 | ||
149 | (defun ebnf-yac-definitions (token) | |
150 | (let ((ebnf-yac-skip-char t)) | |
151 | (while (not (memq token '(yac-separator end-of-input))) | |
152 | (setq token | |
153 | (cond | |
ac4780a1 VJL |
154 | ;; ( "%token" | "%left" | "%right" | "%nonassoc" ) |
155 | ;; [ "<" Name ">" ] Name-List | |
984ae001 GM |
156 | ((eq token 'yac-token) |
157 | (setq token (ebnf-yac-lex)) | |
158 | (when (eq token 'open-angle) | |
159 | (or (eq (ebnf-yac-lex) 'non-terminal) | |
e8af40ee | 160 | (error "Missing type name")) |
984ae001 | 161 | (or (eq (ebnf-yac-lex) 'close-angle) |
e8af40ee | 162 | (error "Missing `>'")) |
984ae001 GM |
163 | (setq token (ebnf-yac-lex))) |
164 | (setq token (ebnf-yac-name-list token) | |
165 | ebnf-yac-token-list (nconc (cdr token) | |
166 | ebnf-yac-token-list)) | |
167 | (car token)) | |
ac4780a1 VJL |
168 | ;; "%prec" Name |
169 | ((eq token 'yac-prec) | |
170 | (or (eq (ebnf-yac-lex) 'non-terminal) | |
171 | (error "Missing prec name")) | |
172 | (ebnf-yac-lex)) | |
173 | ;; "any other Yacc definition" | |
984ae001 GM |
174 | (t |
175 | (ebnf-yac-lex)) | |
176 | ))) | |
177 | token)) | |
178 | ||
179 | ||
180 | ;;; YACC-Rule = Name ":" Alternative ";". | |
181 | ||
182 | (defun ebnf-yac-rule (token) | |
183 | (let ((header ebnf-yac-lex) | |
184 | (action ebnf-action) | |
185 | body) | |
186 | (setq ebnf-action nil) | |
187 | (or (eq token 'non-terminal) | |
e8af40ee | 188 | (error "Invalid rule name")) |
984ae001 | 189 | (or (eq (ebnf-yac-lex) 'colon) |
e8af40ee | 190 | (error "Invalid rule: missing `:'")) |
984ae001 GM |
191 | (setq body (ebnf-yac-alternative)) |
192 | (or (eq (car body) 'period) | |
e8af40ee | 193 | (error "Invalid rule: missing `;'")) |
984ae001 GM |
194 | (setq body (cdr body)) |
195 | (ebnf-eps-add-production header) | |
196 | (cons (ebnf-yac-lex) | |
197 | (ebnf-make-production header body action)))) | |
198 | ||
199 | ||
200 | ;;; Alternative = { Sequence || "|" }*. | |
201 | ||
202 | (defun ebnf-yac-alternative () | |
203 | (let (body sequence) | |
204 | (while (eq (car (setq sequence (ebnf-yac-sequence))) | |
205 | 'alternative) | |
206 | (and (setq sequence (cdr sequence)) | |
207 | (setq body (cons sequence body)))) | |
208 | (ebnf-token-alternative body sequence))) | |
209 | ||
210 | ||
211 | ;;; Sequence = { Factor }*. | |
212 | ||
213 | (defun ebnf-yac-sequence () | |
214 | (let (ebnf-yac-error token seq factor) | |
215 | (while (setq token (ebnf-yac-lex) | |
216 | factor (ebnf-yac-factor token)) | |
217 | (setq seq (cons factor seq))) | |
218 | (cons token | |
6411a60a VJL |
219 | (if (and ebnf-yac-ignore-error-recovery ebnf-yac-error) |
220 | ;; ignore error recovery | |
221 | nil | |
222 | (ebnf-token-sequence seq))))) | |
984ae001 GM |
223 | |
224 | ||
225 | ;;; Factor = Name | |
226 | ;;; | "'" "character" "'" | |
227 | ;;; | "error" | |
228 | ;;; | "{" "C like commands" "}" | |
229 | ;;; . | |
230 | ||
231 | (defun ebnf-yac-factor (token) | |
232 | (cond | |
233 | ;; 'character' | |
234 | ((eq token 'terminal) | |
235 | (ebnf-make-terminal ebnf-yac-lex)) | |
236 | ;; Name | |
237 | ((eq token 'non-terminal) | |
238 | (ebnf-make-non-terminal ebnf-yac-lex)) | |
239 | ;; "error" | |
240 | ((eq token 'yac-error) | |
241 | (ebnf-make-special ebnf-yac-lex)) | |
242 | ;; not a factor | |
243 | (t | |
244 | nil) | |
245 | )) | |
246 | ||
247 | ||
248 | ;;; Name-List = { Name || "," }*. | |
249 | ||
250 | (defun ebnf-yac-name-list (token) | |
251 | (let (names) | |
252 | (when (eq token 'non-terminal) | |
253 | (while (progn | |
254 | (setq names (cons ebnf-yac-lex names) | |
255 | token (ebnf-yac-lex)) | |
256 | (eq token 'comma)) | |
257 | (or (eq (ebnf-yac-lex) 'non-terminal) | |
e8af40ee | 258 | (error "Missing token name")))) |
984ae001 GM |
259 | (cons token names))) |
260 | ||
261 | \f | |
262 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
263 | ;; Lexical analyzer | |
264 | ||
265 | ||
266 | ;;; Name = "[A-Za-z][A-Za-z0-9_.]*". | |
267 | ;;; | |
268 | ;;; Comment = "/*" "any character, but the sequence \"*/\"" "*/" | |
269 | ;;; | "//" "any character" "\\n". | |
270 | ||
271 | (defconst ebnf-yac-token-table | |
272 | ;; control character & 8-bit character are set to `error' | |
273 | (let ((table (make-vector 256 'error))) | |
274 | ;; upper & lower case letters: | |
5d66fabc | 275 | (mapc |
984ae001 GM |
276 | #'(lambda (char) |
277 | (aset table char 'non-terminal)) | |
278 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") | |
279 | ;; printable characters: | |
5d66fabc | 280 | (mapc |
984ae001 GM |
281 | #'(lambda (char) |
282 | (aset table char 'character)) | |
283 | "!#$&()*+-.0123456789=?@[\\]^_`~") | |
284 | ;; Override space characters: | |
285 | (aset table ?\n 'space) ; [NL] linefeed | |
286 | (aset table ?\r 'space) ; [CR] carriage return | |
287 | (aset table ?\t 'space) ; [HT] horizontal tab | |
288 | (aset table ?\ 'space) ; [SP] space | |
289 | ;; Override form feed character: | |
290 | (aset table ?\f 'form-feed) ; [FF] form feed | |
291 | ;; Override other lexical characters: | |
292 | (aset table ?< 'open-angle) | |
293 | (aset table ?> 'close-angle) | |
294 | (aset table ?, 'comma) | |
295 | (aset table ?% 'yac-pragma) | |
296 | (aset table ?/ 'slash) | |
297 | (aset table ?\{ 'yac-code) | |
298 | (aset table ?\" 'string) | |
299 | (aset table ?\' 'terminal) | |
300 | (aset table ?: 'colon) | |
301 | (aset table ?| 'alternative) | |
302 | (aset table ?\; 'period) | |
303 | table) | |
304 | "Vector used to map characters to a lexical token.") | |
305 | ||
306 | ||
307 | (defun ebnf-yac-initialize () | |
308 | "Initializations for Yacc/Bison parser." | |
309 | (setq ebnf-yac-token-list nil)) | |
310 | ||
311 | ||
312 | (defun ebnf-yac-lex () | |
f103649a | 313 | "Lexical analyzer for Yacc/Bison. |
984ae001 GM |
314 | |
315 | Return a lexical token. | |
316 | ||
317 | See documentation for variable `ebnf-yac-lex'." | |
318 | (if (>= (point) ebnf-limit) | |
319 | 'end-of-input | |
320 | (let (token) | |
321 | ;; skip spaces, code blocks and comments | |
322 | (while (if (> (following-char) 255) | |
323 | (progn | |
324 | (setq token 'error) | |
325 | nil) | |
326 | (setq token (aref ebnf-yac-token-table (following-char))) | |
327 | (cond | |
328 | ((or (eq token 'space) | |
329 | (and ebnf-yac-skip-char | |
330 | (eq token 'character))) | |
331 | (ebnf-yac-skip-spaces)) | |
332 | ((eq token 'yac-code) | |
333 | (ebnf-yac-skip-code)) | |
334 | ((eq token 'slash) | |
335 | (ebnf-yac-handle-comment)) | |
336 | ((eq token 'form-feed) | |
337 | (forward-char) | |
338 | (setq ebnf-action 'form-feed)) | |
339 | (t nil) | |
340 | ))) | |
341 | (cond | |
342 | ;; end of input | |
343 | ((>= (point) ebnf-limit) | |
344 | 'end-of-input) | |
345 | ;; error | |
346 | ((eq token 'error) | |
eac9c0ef | 347 | (error "Invalid character")) |
984ae001 GM |
348 | ;; "string" |
349 | ((eq token 'string) | |
350 | (setq ebnf-yac-lex (ebnf-get-string)) | |
351 | 'string) | |
352 | ;; terminal: 'char' | |
353 | ((eq token 'terminal) | |
354 | (setq ebnf-yac-lex (ebnf-string " -&(-~" ?\' "terminal")) | |
355 | 'terminal) | |
356 | ;; non-terminal, terminal or "error" | |
357 | ((eq token 'non-terminal) | |
358 | (setq ebnf-yac-lex (ebnf-buffer-substring "0-9A-Za-z_.")) | |
359 | (cond ((member ebnf-yac-lex ebnf-yac-token-list) | |
360 | 'terminal) | |
361 | ((string= ebnf-yac-lex "error") | |
362 | (setq ebnf-yac-error t) | |
363 | 'yac-error) | |
364 | (t | |
365 | 'non-terminal) | |
366 | )) | |
367 | ;; %% and Yacc pragmas (%TOKEN, %START, etc). | |
368 | ((eq token 'yac-pragma) | |
369 | (forward-char) | |
370 | (cond | |
371 | ;; Yacc separator | |
372 | ((eq (following-char) ?%) | |
373 | (forward-char) | |
374 | 'yac-separator) | |
ac4780a1 VJL |
375 | ;; %TOKEN, %RIGHT, %LEFT, %PREC, %NONASSOC |
376 | ((cdr (assoc (upcase (ebnf-buffer-substring "0-9A-Za-z_")) | |
377 | '(("TOKEN" . yac-token) | |
378 | ("RIGHT" . yac-token) | |
379 | ("LEFT" . yac-token) | |
380 | ("NONASSOC" . yac-token) | |
381 | ("PREC" . yac-prec))))) | |
984ae001 GM |
382 | ;; other Yacc pragmas |
383 | (t | |
384 | 'yac-pragma) | |
385 | )) | |
386 | ;; miscellaneous | |
387 | (t | |
388 | (forward-char) | |
389 | token) | |
390 | )))) | |
391 | ||
392 | ||
393 | (defun ebnf-yac-skip-spaces () | |
394 | (skip-chars-forward | |
395 | (if ebnf-yac-skip-char | |
396 | "\n\r\t !#$&()*+-.0123456789=?@[\\\\]^_`~" | |
397 | "\n\r\t ") | |
398 | ebnf-limit) | |
399 | (< (point) ebnf-limit)) | |
400 | ||
401 | ||
a1548b10 GM |
402 | ;; replace the range "\177-\377" (see `ebnf-range-regexp'). |
403 | (defconst ebnf-yac-skip-chars | |
404 | (ebnf-range-regexp "^{}/'\"\000-\010\013\016-\037" ?\177 ?\377)) | |
405 | ||
406 | ||
984ae001 GM |
407 | (defun ebnf-yac-skip-code () |
408 | (forward-char) | |
409 | (let ((pair 1)) | |
410 | (while (> pair 0) | |
a1548b10 | 411 | (skip-chars-forward ebnf-yac-skip-chars ebnf-limit) |
984ae001 GM |
412 | (cond |
413 | ((= (following-char) ?{) | |
414 | (forward-char) | |
415 | (setq pair (1+ pair))) | |
416 | ((= (following-char) ?}) | |
417 | (forward-char) | |
418 | (setq pair (1- pair))) | |
419 | ((= (following-char) ?/) | |
420 | (ebnf-yac-handle-comment)) | |
421 | ((= (following-char) ?\") | |
422 | (ebnf-get-string)) | |
423 | ((= (following-char) ?\') | |
424 | (ebnf-string " -&(-~" ?\' "character")) | |
425 | (t | |
eac9c0ef | 426 | (error "Invalid character")) |
984ae001 GM |
427 | ))) |
428 | (ebnf-yac-skip-spaces)) | |
429 | ||
430 | ||
431 | (defun ebnf-yac-handle-comment () | |
432 | (forward-char) | |
433 | (cond | |
434 | ;; begin comment | |
435 | ((= (following-char) ?*) | |
436 | (ebnf-yac-skip-comment) | |
437 | (ebnf-yac-skip-spaces)) | |
438 | ;; line comment | |
439 | ((= (following-char) ?/) | |
440 | (end-of-line) | |
441 | (ebnf-yac-skip-spaces)) | |
442 | ;; no comment | |
443 | (t nil) | |
444 | )) | |
445 | ||
446 | ||
647a066c GM |
447 | ;; replace the range "\177-\237" (see `ebnf-range-regexp'). |
448 | (defconst ebnf-yac-comment-chars | |
449 | (ebnf-range-regexp "^*\000-\010\013\016-\037" ?\177 ?\237)) | |
984ae001 GM |
450 | |
451 | ||
452 | (defun ebnf-yac-skip-comment () | |
453 | (forward-char) | |
454 | (cond | |
455 | ;; open EPS file | |
456 | ((and ebnf-eps-executing (= (following-char) ?\[)) | |
457 | (ebnf-eps-add-context (ebnf-yac-eps-filename))) | |
458 | ;; close EPS file | |
459 | ((and ebnf-eps-executing (= (following-char) ?\])) | |
460 | (ebnf-eps-remove-context (ebnf-yac-eps-filename))) | |
3ced5caa VJL |
461 | ;; EPS header |
462 | ((and ebnf-eps-executing (= (following-char) ?H)) | |
463 | (ebnf-eps-header-comment (ebnf-yac-eps-filename))) | |
464 | ;; EPS footer | |
465 | ((and ebnf-eps-executing (= (following-char) ?F)) | |
466 | (ebnf-eps-footer-comment (ebnf-yac-eps-filename))) | |
984ae001 GM |
467 | ;; any other action in comment |
468 | (t | |
469 | (setq ebnf-action (aref ebnf-comment-table (following-char)))) | |
470 | ) | |
471 | (let ((not-end t)) | |
472 | (while not-end | |
473 | (skip-chars-forward ebnf-yac-comment-chars ebnf-limit) | |
474 | (cond ((>= (point) ebnf-limit) | |
e8af40ee | 475 | (error "Missing end of comment: `*/'")) |
984ae001 GM |
476 | ((= (following-char) ?*) |
477 | (skip-chars-forward "*" ebnf-limit) | |
478 | (when (= (following-char) ?/) | |
479 | ;; end of comment | |
480 | (forward-char) | |
481 | (setq not-end nil))) | |
482 | (t | |
eac9c0ef | 483 | (error "Invalid character")) |
984ae001 GM |
484 | )))) |
485 | ||
486 | ||
487 | (defun ebnf-yac-eps-filename () | |
488 | (forward-char) | |
489 | (buffer-substring-no-properties | |
490 | (point) | |
491 | (let ((chars (concat ebnf-yac-comment-chars "\n")) | |
492 | found) | |
493 | (while (not found) | |
494 | (skip-chars-forward chars ebnf-limit) | |
495 | (setq found | |
496 | (cond ((>= (point) ebnf-limit) | |
497 | (point)) | |
498 | ((= (following-char) ?*) | |
499 | (skip-chars-forward "*" ebnf-limit) | |
500 | (if (/= (following-char) ?\/) | |
501 | nil | |
502 | (backward-char) | |
503 | (point))) | |
504 | (t | |
505 | (point)) | |
506 | ))) | |
507 | found))) | |
508 | ||
509 | \f | |
510 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
511 | ||
512 | ||
513 | (provide 'ebnf-yac) | |
514 | ||
515 | ||
cbee283d | 516 | ;; arch-tag: 8a96989c-0b1d-42ba-a020-b2901f9a2a4d |
984ae001 | 517 | ;;; ebnf-yac.el ends here |