Mercurial > emacs
annotate lisp/progmodes/ada-stmt.el @ 87498:566965810b9e
*** empty log message ***
author | Magnus Henoch <mange@freemail.hu> |
---|---|
date | Mon, 31 Dec 2007 00:57:51 +0000 |
parents | b6205894fe69 |
children | a1342e6e097a f55f9811f5d7 |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
34400
diff
changeset
|
1 ;;; ada-stmt.el --- an extension to Ada mode for inserting statement templates |
23868 | 2 |
75347 | 3 ;; Copyright (C) 1987, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
4 ;; 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. | |
23868 | 5 |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
6 ;; Authors: Daniel Pfeiffer, Markus Heritsch, Rolf Ebert <ebert@waporo.muc.de> |
73564
0058ef19e376
Change maintainer, apply whitespace-cleanup, checkdoc.
Juanma Barranquero <lekktu@gmail.com>
parents:
68773
diff
changeset
|
7 ;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org> |
23868 | 8 ;; Keywords: languages, ada |
9 | |
78233
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
11 |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
15 ;; any later version. |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
16 |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
20 ;; GNU General Public License for more details. |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
21 |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
25 ;; Boston, MA 02110-1301, USA. |
b6205894fe69
Add missing license notice (GPLv3 or later).
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
26 |
23868 | 27 ;;; Commentary: |
44467
e34b692b2fa9
Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
28 ;; This file is now automatically loaded from ada-mode.el, and creates a submenu |
e34b692b2fa9
Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
29 ;; in Ada/ on the menu bar. |
23868 | 30 |
31 ;;; History: | |
32 | |
33 ;; Created May 1987. | |
34 ;; Original version from V. Bowman as in ada.el of Emacs-18 | |
35 ;; (borrowed heavily from Mick Jordan's Modula-2 package for GNU, | |
36 ;; as modified by Peter Robinson, Michael Schmidt, and Tom Perrine.) | |
37 ;; | |
38 ;; Sep 1993. Daniel Pfeiffer <pfeiffer@cict.fr> (DP) | |
39 ;; Introduced statement.el for smaller code and user configurability. | |
40 ;; | |
41 ;; Nov 1993. Rolf Ebert <ebert@enpc.fr> (RE) Moved the | |
42 ;; skeleton generation into this separate file. The code still is | |
43 ;; essentially written by DP | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47744
diff
changeset
|
44 ;; |
23868 | 45 ;; Adapted Jun 1994. Markus Heritsch |
46 ;; <Markus.Heritsch@studbox.uni-stuttgart.de> (MH) | |
47 ;; added menu bar support for templates | |
48 ;; | |
49 ;; 1994/12/02 Christian Egli <cegli@hcsd.hac.com> | |
50 ;; General cleanup and bug fixes. | |
51 ;; | |
52 ;; 1995/12/20 John Hutchison <hutchiso@epi.syr.ge.com> | |
26226
b63d041c9108
Changed format of years in copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents:
26000
diff
changeset
|
53 ;; made it work with skeleton.el from Emacs-19.30. Several |
23868 | 54 ;; enhancements and bug fixes. |
55 | |
56 ;; BUGS: | |
57 ;;;> I have the following suggestions for the function template: 1) I | |
58 ;;;> don't want it automatically assigning it a name for the return variable. I | |
59 ;;;> never want it to be called "Result" because that is nondescriptive. If you | |
60 ;;;> must define a variable, give me the ability to specify its name. | |
61 ;;;> | |
62 ;;;> 2) You do not provide a type for variable 'Result'. Its type is the same | |
63 ;;;> as the function's return type, which the template knows, so why force me | |
64 ;;;> to type it in? | |
65 ;;;> | |
66 | |
67 ;;;It would be nice if one could configure such layout details separately | |
68 ;;;without patching the LISP code. Maybe the metalanguage used in ada-stmt.el | |
69 ;;;could be taken even further, providing the user with some nice syntax | |
70 ;;;for describing layout. Then my own hacks would survive the next | |
71 ;;;update of the package :-) | |
72 | |
73 | |
74 ;;; Code: | |
75 | |
50812
15929fed5553
(ada-xemacs): Variable removed, since it's better to use (featurep 'xemacs).
Juanma Barranquero <lekktu@gmail.com>
parents:
50739
diff
changeset
|
76 (require 'skeleton nil t) |
23868 | 77 (require 'easymenu) |
50812
15929fed5553
(ada-xemacs): Variable removed, since it's better to use (featurep 'xemacs).
Juanma Barranquero <lekktu@gmail.com>
parents:
50739
diff
changeset
|
78 (require 'ada-mode) |
23868 | 79 |
80 (defun ada-func-or-proc-name () | |
73564
0058ef19e376
Change maintainer, apply whitespace-cleanup, checkdoc.
Juanma Barranquero <lekktu@gmail.com>
parents:
68773
diff
changeset
|
81 "Return the name of the current function or procedure." |
23868 | 82 (save-excursion |
83 (let ((case-fold-search t)) | |
84 (if (re-search-backward ada-procedure-start-regexp nil t) | |
73933
f047602e0a17
(ada-func-or-proc-name): Match changes to ada-procedure-start-regexp.
Juanma Barranquero <lekktu@gmail.com>
parents:
73564
diff
changeset
|
85 (match-string 5) |
23868 | 86 "NAME?")))) |
87 | |
88 ;;; ---- statement skeletons ------------------------------------------ | |
89 | |
90 (define-skeleton ada-array | |
26000 | 91 "Insert array type definition. |
26226
b63d041c9108
Changed format of years in copyright notices.
Gerd Moellmann <gerd@gnu.org>
parents:
26000
diff
changeset
|
92 Prompt for component type and index subtypes." |
23868 | 93 () |
94 "array (" ("index definition: " str ", " ) -2 ") of " _ ?\;) | |
95 | |
96 | |
97 (define-skeleton ada-case | |
26000 | 98 "Build skeleton case statement. |
99 Prompt for the selector expression. Also builds the first when clause." | |
23868 | 100 "[selector expression]: " |
101 "case " str " is" \n | |
102 > "when " ("discrete choice: " str " | ") -3 " =>" \n | |
103 > _ \n | |
104 < < "end case;") | |
105 | |
106 | |
107 (define-skeleton ada-when | |
108 "Start a case statement alternative with a when clause." | |
109 () | |
110 < "when " ("discrete choice: " str " | ") -3 " =>" \n | |
111 >) | |
112 | |
113 | |
114 (define-skeleton ada-declare-block | |
115 "Insert a block with a declare part. | |
116 Indent for the first declaration." | |
117 "[block name]: " | |
118 < str & ?: & \n | |
119 > "declare" \n | |
120 > _ \n | |
121 < "begin" \n | |
122 > \n | |
123 < "end " str | -1 ?\;) | |
124 | |
125 | |
126 (define-skeleton ada-exception-block | |
127 "Insert a block with an exception part. | |
128 Indent for the first line of code." | |
129 "[block name]: " | |
130 < str & ?: & \n | |
131 > "begin" \n | |
132 > _ \n | |
133 < "exception" \n | |
134 > \n | |
135 < "end " str | -1 ?\;) | |
136 | |
137 | |
138 (define-skeleton ada-exception | |
139 "Insert an indented exception part into a block." | |
140 () | |
141 < "exception" \n | |
142 >) | |
143 | |
144 | |
145 (define-skeleton ada-exit-1 | |
146 "Insert then exit condition of the exit statement, prompting for condition." | |
147 "[exit condition]: " | |
148 "when " str | -5) | |
149 | |
150 | |
151 (define-skeleton ada-exit | |
152 "Insert an exit statement, prompting for loop name and condition." | |
153 "[name of loop to exit]: " | |
44467
e34b692b2fa9
Menu changed from Statements to Templates.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
154 "exit " str & ?\ (ada-exit-1) | -1 ?\;) |
23868 | 155 |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
156 ;;;###autoload |
23868 | 157 (defun ada-header () |
158 "Insert a descriptive header at the top of the file." | |
159 (interactive "*") | |
160 (save-excursion | |
161 (goto-char (point-min)) | |
162 (if (fboundp 'make-header) | |
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
163 (funcall (symbol-function 'make-header)) |
23868 | 164 (ada-header-tmpl)))) |
165 | |
166 | |
167 (define-skeleton ada-header-tmpl | |
168 "Insert a comment block containing the module title, author, etc." | |
169 "[Description]: " | |
170 "-- -*- Mode: Ada -*-" | |
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
171 "\n" ada-fill-comment-prefix "Filename : " (buffer-name) |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
172 "\n" ada-fill-comment-prefix "Description : " str |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
173 "\n" ada-fill-comment-prefix "Author : " (user-full-name) |
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
174 "\n" ada-fill-comment-prefix "Created On : " (current-time-string) |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
175 "\n" ada-fill-comment-prefix "Last Modified By: ." |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
176 "\n" ada-fill-comment-prefix "Last Modified On: ." |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
177 "\n" ada-fill-comment-prefix "Update Count : 0" |
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
178 "\n" ada-fill-comment-prefix "Status : Unknown, Use with caution!" |
23868 | 179 "\n") |
180 | |
181 | |
182 (define-skeleton ada-display-comment | |
183 "Inserts three comment lines, making a display comment." | |
184 () | |
30409
a530830f8a3d
(ada-stmt-add-to-ada-menu): Hide the menu if not in
Gerd Moellmann <gerd@gnu.org>
parents:
26226
diff
changeset
|
185 "--\n" ada-fill-comment-prefix _ "\n--") |
23868 | 186 |
187 | |
188 (define-skeleton ada-if | |
189 "Insert skeleton if statment, prompting for a boolean-expression." | |
190 "[condition]: " | |
191 "if " str " then" \n | |
192 > _ \n | |
193 < "end if;") | |
194 | |
195 | |
196 (define-skeleton ada-elsif | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
197 "Add an elsif clause to an if statement, |
23868 | 198 prompting for the boolean-expression." |
199 "[condition]: " | |
200 < "elsif " str " then" \n | |
201 >) | |
202 | |
203 | |
204 (define-skeleton ada-else | |
205 "Add an else clause inside an if-then-end-if clause." | |
206 () | |
207 < "else" \n | |
208 >) | |
209 | |
210 | |
211 (define-skeleton ada-loop | |
212 "Insert a skeleton loop statement. The exit statement is added by hand." | |
213 "[loop name]: " | |
214 < str & ?: & \n | |
215 > "loop" \n | |
216 > _ \n | |
217 < "end loop " str | -1 ?\;) | |
218 | |
219 | |
220 (define-skeleton ada-for-loop-prompt-variable | |
221 "Prompt for the loop variable." | |
222 "[loop variable]: " | |
223 str) | |
224 | |
225 | |
226 (define-skeleton ada-for-loop-prompt-range | |
227 "Prompt for the loop range." | |
228 "[loop range]: " | |
229 str) | |
230 | |
231 | |
232 (define-skeleton ada-for-loop | |
233 "Build a skeleton for-loop statement, prompting for the loop parameters." | |
234 "[loop name]: " | |
235 < str & ?: & \n | |
236 > "for " | |
237 (ada-for-loop-prompt-variable) | |
238 " in " | |
239 (ada-for-loop-prompt-range) | |
240 " loop" \n | |
241 > _ \n | |
242 < "end loop " str | -1 ?\;) | |
243 | |
244 | |
245 (define-skeleton ada-while-loop-prompt-entry-condition | |
246 "Prompt for the loop entry condition." | |
247 "[entry condition]: " | |
248 str) | |
249 | |
250 | |
251 (define-skeleton ada-while-loop | |
252 "Insert a skeleton while loop statement." | |
253 "[loop name]: " | |
254 < str & ?: & \n | |
255 > "while " | |
256 (ada-while-loop-prompt-entry-condition) | |
257 " loop" \n | |
258 > _ \n | |
259 < "end loop " str | -1 ?\;) | |
260 | |
261 | |
262 (define-skeleton ada-package-spec | |
263 "Insert a skeleton package specification." | |
264 "[package name]: " | |
265 "package " str " is" \n | |
266 > _ \n | |
267 < "end " str ?\;) | |
268 | |
269 | |
270 (define-skeleton ada-package-body | |
271 "Insert a skeleton package body -- includes a begin statement." | |
272 "[package name]: " | |
273 "package body " str " is" \n | |
274 > _ \n | |
275 ; < "begin" \n | |
276 < "end " str ?\;) | |
277 | |
278 | |
279 (define-skeleton ada-private | |
280 "Undent and start a private section of a package spec. Reindent." | |
281 () | |
282 < "private" \n | |
283 >) | |
284 | |
285 | |
286 (define-skeleton ada-function-spec-prompt-return | |
287 "Prompts for function result type." | |
288 "[result type]: " | |
289 str) | |
290 | |
291 | |
292 (define-skeleton ada-function-spec | |
293 "Insert a function specification. Prompts for name and arguments." | |
294 "[function name]: " | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
295 "function " str |
23868 | 296 " (" ("[parameter_specification]: " str "; " ) -2 ")" |
297 " return " | |
298 (ada-function-spec-prompt-return) | |
299 ";" \n ) | |
300 | |
301 | |
302 (define-skeleton ada-procedure-spec | |
303 "Insert a procedure specification, prompting for its name and arguments." | |
304 "[procedure name]: " | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
305 "procedure " str |
23868 | 306 " (" ("[parameter_specification]: " str "; " ) -2 ")" |
307 ";" \n ) | |
308 | |
309 | |
310 (define-skeleton ada-subprogram-body | |
311 "Insert frame for subprogram body. | |
312 Invoke right after `ada-function-spec' or `ada-procedure-spec'." | |
313 () | |
314 ;; Remove `;' from subprogram decl | |
315 (save-excursion | |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
316 (let ((pos (1+ (point)))) |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
317 (ada-search-ignore-string-comment ada-subprog-start-re t nil) |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
318 (when (ada-search-ignore-string-comment "(" nil pos t 'search-forward) |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
319 (backward-char 1) |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
320 (forward-sexp 1))) |
23868 | 321 (if (looking-at ";") |
73564
0058ef19e376
Change maintainer, apply whitespace-cleanup, checkdoc.
Juanma Barranquero <lekktu@gmail.com>
parents:
68773
diff
changeset
|
322 (delete-char 1))) |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
323 " is" \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
324 _ \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
325 < "begin" \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
326 \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
327 < "exception" \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
328 "when others => null;" \n |
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
329 < < "end " |
23868 | 330 (ada-func-or-proc-name) |
25902
92828b88cfcc
(ada-stmt-add-to-ada-menu): New function
Gerd Moellmann <gerd@gnu.org>
parents:
23869
diff
changeset
|
331 ";" \n) |
23868 | 332 |
333 | |
334 (define-skeleton ada-separate | |
335 "Finish a body stub with `separate'." | |
336 () | |
337 > "separate;" \n | |
338 <) | |
339 | |
340 | |
341 ;(define-skeleton ada-with | |
342 ; "Inserts a with clause, prompting for the list of units depended upon." | |
343 ; "[list of units depended upon]: " | |
344 ; "with " str ?\;) | |
345 | |
346 ;(define-skeleton ada-use | |
347 ; "Inserts a use clause, prompting for the list of packages used." | |
348 ; "[list of packages used]: " | |
349 ; "use " str ?\;) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47744
diff
changeset
|
350 |
23868 | 351 |
352 (define-skeleton ada-record | |
353 "Insert a skeleton record type declaration." | |
354 () | |
355 "record" \n | |
356 > _ \n | |
357 < "end record;") | |
358 | |
359 | |
360 (define-skeleton ada-subtype | |
361 "Start insertion of a subtype declaration, prompting for the subtype name." | |
362 "[subtype name]: " | |
363 "subtype " str " is " _ ?\; | |
364 (not (message "insert subtype indication."))) | |
365 | |
366 | |
367 (define-skeleton ada-type | |
368 "Start insertion of a type declaration, prompting for the type name." | |
369 "[type name]: " | |
370 "type " str ?\( | |
371 ("[discriminant specs]: " str " ") | |
372 | (backward-delete-char 1) | ?\) | |
373 " is " | |
374 (not (message "insert type definition."))) | |
375 | |
376 | |
377 (define-skeleton ada-task-body | |
378 "Insert a task body, prompting for the task name." | |
379 "[task name]: " | |
380 "task body " str " is\n" | |
381 "begin\n" | |
382 > _ \n | |
383 < "end " str ";" ) | |
384 | |
385 | |
386 (define-skeleton ada-task-spec | |
387 "Insert a task specification, prompting for the task name." | |
388 "[task name]: " | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
389 "task " str |
23868 | 390 " (" ("[discriminant]: " str "; ") ") is\n" |
391 > "entry " _ \n | |
392 <"end " str ";" ) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47744
diff
changeset
|
393 |
23868 | 394 |
395 (define-skeleton ada-get-param1 | |
396 "Prompt for arguments and if any enclose them in brackets." | |
397 () | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
398 ("[parameter_specification]: " str "; " ) & -2 & ")") |
23868 | 399 |
400 | |
401 (define-skeleton ada-get-param | |
402 "Prompt for arguments and if any enclose them in brackets." | |
403 () | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
404 " (" |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
405 (ada-get-param1) | -2) |
23868 | 406 |
407 | |
408 (define-skeleton ada-entry | |
409 "Insert a task entry, prompting for the entry name." | |
410 "[entry name]: " | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
411 "entry " str |
23868 | 412 (ada-get-param) |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
413 ";" \n) |
23868 | 414 |
415 | |
416 (define-skeleton ada-entry-family-prompt-discriminant | |
417 "Insert a entry specification, prompting for the entry name." | |
418 "[discriminant name]: " | |
419 str) | |
420 | |
421 | |
422 (define-skeleton ada-entry-family | |
423 "Insert a entry specification, prompting for the entry name." | |
424 "[entry name]: " | |
425 "entry " str | |
426 " (" (ada-entry-family-prompt-discriminant) ")" | |
427 (ada-get-param) | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
428 ";" \n) |
23868 | 429 |
430 | |
431 (define-skeleton ada-select | |
432 "Insert a select block." | |
433 () | |
434 "select\n" | |
435 > _ \n | |
436 < "end select;") | |
437 | |
438 | |
439 (define-skeleton ada-accept-1 | |
440 "Insert a condition statement, prompting for the condition name." | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
441 "[condition]: " |
23868 | 442 "when " str | -5 ) |
443 | |
444 | |
445 (define-skeleton ada-accept-2 | |
446 "Insert an accept statement, prompting for the name and arguments." | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
447 "[accept name]: " |
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
448 > "accept " str |
23868 | 449 (ada-get-param) |
450 " do" \n | |
451 > _ \n | |
452 < "end " str ";" ) | |
453 | |
454 | |
455 (define-skeleton ada-accept | |
456 "Insert an accept statement (prompt for condition, name and arguments)." | |
457 () | |
458 > (ada-accept-1) & " =>\n" | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
459 (ada-accept-2)) |
23868 | 460 |
461 | |
462 (define-skeleton ada-or-accept | |
73933
f047602e0a17
(ada-func-or-proc-name): Match changes to ada-procedure-start-regexp.
Juanma Barranquero <lekktu@gmail.com>
parents:
73564
diff
changeset
|
463 "Insert an accept alternative, prompting for the condition name." |
23868 | 464 () |
465 < "or\n" | |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
466 (ada-accept)) |
23868 | 467 |
468 | |
469 (define-skeleton ada-or-delay | |
73933
f047602e0a17
(ada-func-or-proc-name): Match changes to ada-procedure-start-regexp.
Juanma Barranquero <lekktu@gmail.com>
parents:
73564
diff
changeset
|
470 "Insert a delay alternative, prompting for the delay value." |
33823
d29063c1c480
(ada-template-map): Initialize and bind it to C-c t in ada-mode-map.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32301
diff
changeset
|
471 "[delay value]: " |
23868 | 472 < "or\n" |
473 > "delay " str ";") | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47744
diff
changeset
|
474 |
23868 | 475 |
476 (define-skeleton ada-or-terminate | |
73933
f047602e0a17
(ada-func-or-proc-name): Match changes to ada-procedure-start-regexp.
Juanma Barranquero <lekktu@gmail.com>
parents:
73564
diff
changeset
|
477 "Insert a terminate alternative." |
23868 | 478 () |
479 < "or\n" | |
480 > "terminate;") | |
481 | |
482 | |
483 (provide 'ada-stmt) | |
484 | |
52401 | 485 ;;; arch-tag: 94f51555-cc0e-44e5-8865-8788aae8ecd3 |
23868 | 486 ;;; ada-stmt.el ends here |