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