(compilation-handle-exit): Undo previous change.
[bpt/emacs.git] / lisp / progmodes / simula.el
CommitLineData
a26389d1
ER
1;;; simula.el --- SIMULA 87 code editing commands for Emacs
2
58142744
ER
3;; Copyright (C) 1992 Free Software Foundation, Inc.
4
f961a17c
ER
5;; Author: Hans Henrik Eriksen <hhe@ifi.uio.no>
6;; Maintainer: simula-mode@ifi.uio.no
338819bc 7;; Version: 0.992
f961a17c
ER
8;; Adapted-By: ESR
9;; Keywords: languages
10
a26389d1
ER
11;; This file is part of GNU Emacs.
12
13;; GNU Emacs is free software; you can redistribute it and/or modify
14;; it under the terms of the GNU General Public License as published by
3005d32e 15;; the Free Software Foundation; either version 2, or (at your option)
a26389d1
ER
16;; any later version.
17
18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;; GNU General Public License for more details.
22
23;; You should have received a copy of the GNU General Public License
b578f267
EN
24;; along with GNU Emacs; see the file COPYING. If not, write to the
25;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26;; Boston, MA 02111-1307, USA.
a26389d1 27
f961a17c
ER
28;;; Commentary:
29
d9ecc911
ER
30;; A major mode for editing the Simula language. It knows about Simula
31;; syntax and standard indentation commands. It also provides convenient
32;; abbrevs for Simula keywords.
33;;
34;; Hans Henrik Eriksen (the author) may be reached at:
a26389d1
ER
35;; Institutt for informatikk,
36;; Universitetet i Oslo
a26389d1 37
f961a17c 38;;; Code:
a26389d1
ER
39
40(provide 'simula-mode)
41
42(defconst simula-tab-always-indent nil
3005d32e
RS
43 "*Non-nil means TAB in SIMULA mode should always reindent the current line.
44Otherwise TAB indents only when point is within
45the run of whitespace at the beginning of the line.")
a26389d1
ER
46
47(defconst simula-indent-level 3
48 "*Indentation of SIMULA statements with respect to containing block.")
49
50(defconst simula-substatement-offset 3
51 "*Extra indentation after DO, THEN, ELSE, WHEN and OTHERWISE.")
52
53(defconst simula-continued-statement-offset 3
54 "*Extra indentation for lines not starting a statement or substatement.
55If value is a list, each line in a multipleline continued statement
56will have the car of the list extra indentation with respect to
57the previous line of the statement.")
58
59(defconst simula-label-offset -4711
3005d32e 60 "*Offset of SIMULA label lines relative to usual indentation.")
a26389d1
ER
61
62(defconst simula-if-indent '(0 . 0)
63 "*Extra indentation of THEN and ELSE with respect to the starting IF.
eb8c3be9 64Value is a cons cell, the car is extra THEN indentation and the cdr
3005d32e 65extra ELSE indentation. IF after ELSE is indented as the starting IF.")
a26389d1
ER
66
67(defconst simula-inspect-indent '(0 . 0)
3005d32e
RS
68 "*Extra indentation of WHEN and OTHERWISE with respect to the INSPECT.
69Value is a cons cell, the car is extra WHEN indentation
70and the cdr extra OTHERWISE indentation.")
a26389d1
ER
71
72(defconst simula-electric-indent nil
3005d32e 73 "*Non-nil means `simula-indent-line' function may reindent previous line.")
a26389d1
ER
74
75(defconst simula-abbrev-keyword 'upcase
3005d32e
RS
76 "*Specify how to convert case for SIMULA keywords.
77Value is one of the symbols `upcase', `downcase', `capitalize',
a4e104bf 78\(as in) `abbrev-table' or nil if they should not be changed.")
a26389d1
ER
79
80(defconst simula-abbrev-stdproc 'abbrev-table
3005d32e
RS
81 "*Specify how to convert case for standard SIMULA procedure and class names.
82Value is one of the symbols `upcase', `downcase', `capitalize',
a4e104bf 83\(as in) `abbrev-table', or nil if they should not be changed.")
a26389d1
ER
84
85(defvar simula-abbrev-file nil
3005d32e
RS
86 "*File with extra abbrev definitions for use in SIMULA mode.
87These are used together with the standard abbrev definitions for SIMULA.
88Please note that the standard definitions are required
89for SIMULA mode to function correctly.")
a26389d1
ER
90
91(defvar simula-mode-syntax-table nil
3005d32e 92 "Syntax table in SIMULA mode buffers.")
a26389d1
ER
93
94(if simula-mode-syntax-table
95 ()
3005d32e 96 (setq simula-mode-syntax-table (copy-syntax-table (standard-syntax-table)))
a26389d1
ER
97 (modify-syntax-entry ?! "<" simula-mode-syntax-table)
98 (modify-syntax-entry ?$ "." simula-mode-syntax-table)
99 (modify-syntax-entry ?% "." simula-mode-syntax-table)
100 (modify-syntax-entry ?' "\"" simula-mode-syntax-table)
101 (modify-syntax-entry ?\( "()" simula-mode-syntax-table)
102 (modify-syntax-entry ?\) ")(" simula-mode-syntax-table)
103 (modify-syntax-entry ?\; ">" simula-mode-syntax-table)
104 (modify-syntax-entry ?\[ "." simula-mode-syntax-table)
105 (modify-syntax-entry ?\\ "." simula-mode-syntax-table)
106 (modify-syntax-entry ?\] "." simula-mode-syntax-table)
107 (modify-syntax-entry ?_ "w" simula-mode-syntax-table)
108 (modify-syntax-entry ?\| "." simula-mode-syntax-table)
109 (modify-syntax-entry ?\{ "." simula-mode-syntax-table)
110 (modify-syntax-entry ?\} "." simula-mode-syntax-table))
111
112(defvar simula-mode-map ()
3005d32e 113 "Keymap used in SIMULA mode.")
a26389d1
ER
114
115(if simula-mode-map
116 ()
117 (setq simula-mode-map (make-sparse-keymap))
118 (define-key simula-mode-map "\C-c\C-u" 'simula-backward-up-level)
119 (define-key simula-mode-map "\C-c\C-p" 'simula-previous-statement)
120 (define-key simula-mode-map "\C-c\C-d" 'simula-forward-down-level)
121 (define-key simula-mode-map "\C-c\C-n" 'simula-next-statement)
122 ;(define-key simula-mode-map "\C-c\C-g" 'simula-goto-definition)
123 ;(define-key simula-mode-map "\C-c\C-h" 'simula-standard-help)
124 (define-key simula-mode-map "\177" 'backward-delete-char-untabify)
125 (define-key simula-mode-map ":" 'simula-electric-label)
126 (define-key simula-mode-map "\t" 'simula-indent-command))
127
128(defvar simula-mode-abbrev-table nil
3005d32e 129 "Abbrev table in SIMULA mode buffers")
a26389d1
ER
130
131
132(defun simula-mode ()
133 "Major mode for editing SIMULA code.
134\\{simula-mode-map}
135Variables controlling indentation style:
136 simula-tab-always-indent
137 Non-nil means TAB in SIMULA mode should always reindent the current line,
138 regardless of where in the line point is when the TAB command is used.
139 simula-indent-level
140 Indentation of SIMULA statements with respect to containing block.
141 simula-substatement-offset
142 Extra indentation after DO, THEN, ELSE, WHEN and OTHERWISE.
143 simula-continued-statement-offset 3
144 Extra indentation for lines not starting a statement or substatement,
3005d32e 145 e.g. a nested FOR-loop. If value is a list, each line in a multiple-
a26389d1
ER
146 line continued statement will have the car of the list extra indentation
147 with respect to the previous line of the statement.
148 simula-label-offset -4711
3005d32e 149 Offset of SIMULA label lines relative to usual indentation.
a26389d1
ER
150 simula-if-indent '(0 . 0)
151 Extra indentation of THEN and ELSE with respect to the starting IF.
eb8c3be9 152 Value is a cons cell, the car is extra THEN indentation and the cdr
3005d32e 153 extra ELSE indentation. IF after ELSE is indented as the starting IF.
a26389d1
ER
154 simula-inspect-indent '(0 . 0)
155 Extra indentation of WHEN and OTHERWISE with respect to the
3005d32e 156 corresponding INSPECT. Value is a cons cell, the car is
eb8c3be9 157 extra WHEN indentation and the cdr extra OTHERWISE indentation.
a26389d1 158 simula-electric-indent nil
3005d32e 159 If this variable is non-nil, `simula-indent-line'
a26389d1
ER
160 will check the previous line to see if it has to be reindented.
161 simula-abbrev-keyword 'upcase
3005d32e
RS
162 Determine how SIMULA keywords will be expanded. Value is one of
163 the symbols `upcase', `downcase', `capitalize', (as in) `abbrev-table',
164 or nil if they should not be changed.
a26389d1
ER
165 simula-abbrev-stdproc 'abbrev-table
166 Determine how standard SIMULA procedure and class names will be
3005d32e
RS
167 expanded. Value is one of the symbols `upcase', `downcase', `capitalize',
168 (as in) `abbrev-table', or nil if they should not be changed.
a26389d1
ER
169
170Turning on SIMULA mode calls the value of the variable simula-mode-hook
171with no arguments, if that value is non-nil
172
173Warning: simula-mode-hook should not read in an abbrev file without calling
eb8c3be9 174the function simula-install-standard-abbrevs afterwards, preferably not
a26389d1
ER
175at all."
176 (interactive)
177 (kill-all-local-variables)
178 (use-local-map simula-mode-map)
179 (setq major-mode 'simula-mode)
180 (setq mode-name "SIMULA")
181 (make-local-variable 'comment-column)
182 (setq comment-column 40)
183 (make-local-variable 'end-comment-column)
184 (setq end-comment-column 75)
185 (set-syntax-table simula-mode-syntax-table)
186 (make-local-variable 'paragraph-start)
c53857e9 187 (setq paragraph-start "[ \t]*$\\|\\f")
a26389d1
ER
188 (make-local-variable 'paragraph-separate)
189 (setq paragraph-separate paragraph-start)
190 (make-local-variable 'indent-line-function)
191 (setq indent-line-function 'simula-indent-line)
192 (make-local-variable 'require-final-newline)
193 (setq require-final-newline t)
194 (make-local-variable 'comment-start)
195 (setq comment-start "! ")
196 (make-local-variable 'comment-end)
197 (setq comment-end " ;")
198 (make-local-variable 'comment-start-skip)
199 (setq comment-start-skip "!+ *")
200 (make-local-variable 'parse-sexp-ignore-comments)
201 (setq parse-sexp-ignore-comments nil)
202 (make-local-variable 'comment-multi-line)
203 (setq comment-multi-line t)
204 (if simula-mode-abbrev-table
205 ()
206 (if simula-abbrev-file
207 (read-abbrev-file simula-abbrev-file)
208 (define-abbrev-table 'simula-mode-abbrev-table ()))
209 (let (abbrevs-changed)
210 (simula-install-standard-abbrevs)))
211 (setq local-abbrev-table simula-mode-abbrev-table)
212 (abbrev-mode 1)
213 (run-hooks 'simula-mode-hook))
214
215
216
217(defun simula-indent-line ()
3005d32e
RS
218 "Indent this line as SIMULA code.
219If `simula-electric-indent' is non-nil, indent previous line if necessary."
a26389d1
ER
220 (let ((origin (- (point-max) (point)))
221 (indent (simula-calculate-indent))
222 (case-fold-search t))
223 (unwind-protect
224 (progn
225 ;;
226 ;; manually expand abbrev on last line, if any
227 ;;
228 (end-of-line 0)
229 (expand-abbrev)
230 ;; now maybe we should reindent that line
231 (if simula-electric-indent
232 (progn
233 (beginning-of-line)
234 (skip-chars-forward " \t\f")
235 (if (and
236 (looking-at
237 "\\(end\\|if\\|then\\|else\\|when\\|otherwise\\)\\>")
238 (not (simula-context)))
239 ;; yes - reindent
240 (let ((post-indent (simula-calculate-indent)))
241 (if (eq (current-indentation) post-indent)
242 ()
243 (delete-horizontal-space)
244 (indent-to post-indent)))))))
245 (goto-char (- (point-max) origin))
246 (if (eq (current-indentation) indent)
247 (back-to-indentation)
248 (delete-horizontal-space)
249 (indent-to indent)))))
250
251
252(defun simula-indent-command (&optional whole-exp)
253 "Indent current line as SIMULA code, or insert TAB character.
3005d32e 254If `simula-tab-always-indent' is non-nil, always indent current line.
a26389d1
ER
255Otherwise, indent only if point is before any non-whitespace
256character on the line.
257
258A numeric argument, regardless of its value, means indent rigidly
259all the lines of the SIMULA statement after point so that this line
260becomes properly indented.
261The relative indentation among the lines of the statement are preserved."
262 (interactive "P")
263 (let ((case-fold-search t))
264 (if (or whole-exp simula-tab-always-indent
265 (save-excursion
266 (skip-chars-backward " \t\f")
267 (bolp)))
268 ;; reindent current line
269 (let ((indent (save-excursion
270 (beginning-of-line)
271 (simula-calculate-indent)))
272 (current (current-indentation))
273 (origin (- (point-max) (point)))
274 (bol (save-excursion
275 (skip-chars-backward " \t\f")
276 (bolp)))
277 beg end)
278 (unwind-protect
279 (if (eq current indent)
280 (if (save-excursion
281 (skip-chars-backward " \t\f")
282 (bolp))
283 (back-to-indentation))
284 (beginning-of-line)
285 (delete-horizontal-space)
286 (indent-to indent))
287 (if (not bol)
288 (goto-char (- (point-max) origin))))
289 (setq origin (point))
290 (if whole-exp
291 (save-excursion
292 (beginning-of-line 2)
293 (setq beg (point))
294 (goto-char origin)
295 (simula-next-statement 1)
296 (setq end (point))
297 (if (and (> end beg) (not (eq indent current)))
298 (indent-code-rigidly beg end (- indent current) "%")))))
299 (insert-tab))))
300
301
302(defun simula-context ()
3005d32e
RS
303 "Returns value according to syntactic SIMULA context of point.
304 0 point inside COMMENT comment
a26389d1
ER
305 1 point on SIMULA-compiler directive line
306 2 point inside END comment
307 3 point inside string
308 4 point inside character constant
309 nil otherwise."
310 ;; first, find out if this is a compiler directive line
311 (if (save-excursion
312 (beginning-of-line)
313 (eq (following-char) ?%))
314 ;; YES - return 1
315 1
316 (save-excursion
317 ;; The current line is NOT a compiler directive line.
318 ;; Now, the strategy is to search backward to find a semicolon
319 ;; that is NOT inside a string. The point after semicolon MUST be
320 ;; outside a comment, since semicolons are comment-ending and
321 ;; comments are non-recursive. We take advantage of the fact
322 ;; that strings MUST end on the same line as they started, so
323 ;; that we can easily decide whether we are inside a string or not.
324 (let (return-value (origin (point)))
325 (skip-chars-backward "^;" (point-min))
326 ;; found semicolon or beginning of buffer
327 (let (loopvalue (saved-point origin))
328 (while (and (not (bobp))
329 (if (progn
330 (beginning-of-line)
331 ;; compiler directive line? If so, cont searching..
332 (eq (following-char) ?%))
333 t
334 (while (< (point) saved-point)
335 (skip-chars-forward "^;\"'")
336 (forward-char 1)
337 (cond
338 ((eq (preceding-char) ?\;)
339 (setq saved-point (point)))
340 ((eq (preceding-char) ?\")
341 (skip-chars-forward "^\";")
342 (if (eq (following-char) ?\;)
343 (setq saved-point (point) loopvalue t)
344 (forward-char 1)))
345 (t
346 (if (eq (following-char) ?')
347 (forward-char 1))
348 (skip-chars-forward "^';")
349 (if (eq (following-char) ?\;)
350 (setq saved-point (point) loopvalue t)
351 (forward-char 1)))))
352 loopvalue))
353 (backward-char 1)
354 (skip-chars-backward "^;")
355 (setq saved-point (point) loopvalue nil)))
356 ;; Now we are CERTAIN that we are outside comments and strings.
357 ;; The job now is to search forward again towards the origin
358 ;; skipping directives, comments and strings correctly,
359 ;; so that we know what context we are in when we find the origin.
360 (while (and
361 (< (point) origin)
362 (re-search-forward
363 "\\<end\\>\\|!\\|\"\\|'\\|^%\\|\\<comment\\>" origin 'move))
364 (cond
365 ((memq (preceding-char) '(?d ?D))
366 (setq return-value 2)
367 (while (and (memq (preceding-char) '(?d ?D)) (not return-value))
368 (while (and (re-search-forward
369 ";\\|\\<end\\>\\|\\<else\\>\\|\\<otherwise\\>\\|\\<when\\>\\|^%"
370 origin 'move)
371 (eq (preceding-char) ?%))
372 (beginning-of-line 2)))
373 (if (looking-at "[ \t\n\f]*\\(;\\|\\<end\\>\\|\\<else\\>\\|\\<otherwise\\>\\|\\<when\\>\\)")
374 (setq return-value nil)))
375 ((memq (preceding-char) '(?! ?t ?T))
376 ; skip comment
377 (setq return-value 0)
378 (skip-chars-forward "^%;" origin)
379 (while (and return-value (< (point) origin))
380 (if (eq (following-char) ?\;)
381 (setq return-value nil)
382 (if (bolp)
383 (beginning-of-line 2) ; skip directive inside comment
384 (forward-char 1)) ; or single '%'
385 (skip-chars-forward "^%;" origin))))
386 ((eq (preceding-char) ?\")
387 (if (not (search-forward "\"" origin 'move))
388 (setq return-value 3)))
389 ((eq (preceding-char) ?\')
390 (if (or (eq (point) origin) (eobp))
391 (setq return-value 4)
392 (forward-char 1)
393 (if (not (search-forward "'" origin 'move))
394 (setq return-value 4))))
395 ;; compiler directive line - skip
396 (t (beginning-of-line 2))))
397 return-value)
398 )))
399
400
401(defun simula-electric-label ()
3005d32e 402 "If this is a label that starts the line, reindent the line."
a26389d1
ER
403 (interactive)
404 (expand-abbrev)
405 (insert ?:)
406 (let ((origin (- (point-max) (point)))
407 (case-fold-search t)
408 ;; don't mix a label with an assignment operator := :-
409 ;; therefore look at next typed character...
ae20cac8 410 (next-char (setq unread-command-events (list (read-event))))
a26389d1
ER
411 (com-char last-command-char))
412 (unwind-protect
413 ;; Problem: find out if character just read is a command char
414 ;; that would insert something after ':' making it a label.
415 ;; At least \n, \r (and maybe \t) falls into this category.
416 ;; This is a real crock, it depends on traditional keymap
417 ;; bindings, that is, printing characters doing self-insert,
418 ;; and no other command sequence inserting '-' or '='.
419 ;; simula-electric-label can be easily fooled...
420 (if (and (not (memq next-char '(?= ?-)))
421 (or (memq next-char '(?\n ?\r))
422 (and (eq next-char ?\t)
423 simula-tab-always-indent)
424 (not (memq (following-char) '(?= ?-))))
425 (not (simula-context))
426 ;; label?
427 (progn
428 (backward-char 1)
429 (skip-chars-backward " \t\f")
430 (skip-chars-backward "a-zA-Z0-9_")
431 (if (looking-at "virtual\\>")
432 nil
433 (skip-chars-backward " \t\f")
434 (bolp))))
435 (let ((amount (simula-calculate-indent)))
436 (delete-horizontal-space)
437 (indent-to amount)))
438 (goto-char (- (point-max) origin)))))
439
440
441(defun simula-backward-up-level (count)
442 "Move backward up COUNT block levels.
3005d32e 443If COUNT is negative, move forward up block level instead."
a26389d1
ER
444 (interactive "p")
445 (let ((origin (point))
446 (case-fold-search t))
447 (condition-case ()
448 (if (> count 0)
449 (while (> count 0)
450 (re-search-backward "\\<begin\\>\\|\\<end\\>")
451 (if (not (simula-context))
452 (setq count (if (memq (following-char) '(?b ?B))
453 (1- count)
454 (1+ count)))))
455 (while (< count 0)
456 (re-search-forward "\\<begin\\>\\|\\<end\\>")
457 (backward-word 1)
458 (if (not (simula-context))
459 (setq count (if (memq (following-char) '(?e ?E))
460 (1+ count)
461 (1- count))))
462 (backward-word -1)))
463 ;; If block level not found, jump back to origin and signal an error
464 (error (progn
465 (goto-char origin)
466 (error "No higher block level")))
467 (quit (progn
468 (goto-char origin)
469 (signal 'quit nil))))))
470
471
472(defun simula-forward-down-level (count)
473 "Move forward down COUNT block levels.
3005d32e 474If COUNT is negative, move backward down block level instead."
a26389d1
ER
475 (interactive "p")
476 ;; When we search for a deeper block level, we must never
477 ;; get out of the block where we started -> count >= start-count
478 (let ((start-count count)
479 (origin (point))
480 (case-fold-search t))
481 (condition-case ()
482 (if (< count 0)
483 (while (< count 0)
484 (re-search-backward "\\<begin\\>\\|\\<end\\>")
485 (if (not (simula-context))
486 (setq count (if (memq (following-char) '(?e ?E))
487 (1+ count)
488 (1- count))))
489 (if (< count start-count) (signal 'error nil)))
490 (while (> count 0)
491 (re-search-forward "\\<begin\\>\\|\\<end\\>")
492 (backward-word 1)
493 (if (not (simula-context))
494 (setq count (if (memq (following-char) '(?b ?B))
495 (1- count)
496 (1+ count))))
497 (backward-word -1)
498 ;; deeper level has to be found within starting block
499 (if (> count start-count) (signal 'error nil))))
500 ;; If block level not found, jump back to origin and signal an error
501 (error (progn
502 (goto-char origin)
503 (error "No containing block level")))
504 (quit (progn
505 (goto-char origin)
506 (signal 'quit nil))))))
507
508
509(defun simula-previous-statement (count)
510 "Move backward COUNT statements.
3005d32e 511If COUNT is negative, move forward instead."
a26389d1
ER
512 (interactive "p")
513 (if (< count 0)
514 (simula-next-statement (- count))
515 (let (status
516 (case-fold-search t)
517 (origin (point)))
518 (condition-case ()
519 (progn
520 (simula-skip-comment-backward)
521 (if (memq (preceding-char) '(?n ?N))
522 (progn
523 (backward-word 1)
524 (if (not (looking-at "\\<begin\\>"))
525 (backward-word -1)))
526 (if (eq (preceding-char) ?\;)
527 (backward-char 1)))
528 (while (and (natnump (setq count (1- count)))
529 (setq status (simula-search-backward
530 ";\\|\\<begin\\>" nil 'move))))
531 (if status
532 (progn
533 (if (eq (following-char) ?\;)
534 (forward-char 1)
535 (backward-word -1))))
536 (simula-skip-comment-forward))
537 (error (progn (goto-char origin)
538 (error "Incomplete statement (too many ENDs)")))
539 (quit (progn (goto-char origin) (signal 'quit nil)))))))
540
541
542(defun simula-next-statement (count)
3005d32e
RS
543 "Move forward COUNT statements.
544If COUNT is negative, move backward instead."
a26389d1
ER
545 (interactive "p")
546 (if (< count 0)
547 (simula-previous-statement (- count))
548 (let (status
549 (case-fold-search t)
550 (origin (point)))
551 (condition-case ()
552 (progn
553 (simula-skip-comment-forward)
554 (if (looking-at "\\<end\\>") (forward-word 1))
555 (while (and (natnump (setq count (1- count)))
556 (setq status (simula-search-forward
557 ";\\|\\<end\\>" (point-max) 'move))))
558 (if (and status (/= (preceding-char) ?\;))
559 (progn
560 (backward-word 1)
561 (simula-skip-comment-backward))))
562 (error (progn (goto-char origin)
563 (error "Incomplete statement (too few ENDs)")))
564 (quit (progn (goto-char origin) (signal 'quit nil)))))))
565
566
567(defun simula-skip-comment-backward ()
3005d32e 568 "Search towards bob to find first char that is outside a comment."
a26389d1
ER
569 (interactive)
570 (catch 'simula-out
571 (let (context)
572 (while t
573 (skip-chars-backward " \t\n\f")
574 (if (eq (preceding-char) ?\;)
575 (save-excursion
576 (backward-char 1)
577 (setq context (simula-context)))
578 (setq context (simula-context)))
579 (cond
580 ((memq context '(nil 3 4))
581 ;; check to see if we found a label
582 (if (and (eq (preceding-char) ?:)
583 (not (memq (following-char) '(?- ?=)))
584 (save-excursion
585 (skip-chars-backward ": \t\fa-zA-Z0-9_")
586 (not (looking-at "virtual\\>"))))
587 (skip-chars-backward ": \t\fa-zA-Z0-9_")
588 (throw 'simula-out nil)))
589 ((eq context 0)
590 ;; since we are inside a comment, it must start somewhere!
591 (while (and (re-search-backward "!\\|\\<comment\\>")
592 (memq (simula-context) '(0 1)))))
593 ((eq context 1)
594 (end-of-line 0)
595 (if (bobp)
596 (throw 'simula-out nil)))
597 ((eq context 2)
598 ;; an END-comment must belong to an END
599 (re-search-backward "\\<end\\>")
600 (forward-word 1)
601 (throw 'simula-out nil))
602 ;; should be impossible to get here..
603 )))))
604
605
606(defun simula-skip-comment-forward ()
3005d32e 607 "Search towards eob to find first char that is outside a comment."
a26389d1
ER
608 ;; this function assumes we start with point .outside a comment
609 (interactive)
610 (catch 'simula-out
611 (while t
612 (skip-chars-forward " \t\n\f")
613 (cond
614 ((looking-at "!\\|\\<comment\\>")
615 (search-forward ";" nil 'move))
616 ((and (bolp) (eq (following-char) ?%))
617 (beginning-of-line 2))
618 ((and (looking-at "[a-z0-9_]*[ \t\f]*:[^-=]")
619 (not (looking-at "virtual\\>")))
620 (skip-chars-forward "a-zA-Z0-9_ \t\f:"))
621 (t
622 (throw 'simula-out t))))))
623
624
625(defun simula-forward-up-level ()
626 (let ((continue-loop t)
627 (origin (point))
628 (case-fold-search t)
629 return-value
630 temp)
631 (while continue-loop
632 (if (re-search-backward "\\<begin\\>\\|\\<end\\>" (point-min) 'move)
633 (setq temp (simula-context)
634 return-value (and (memq (preceding-char) '(?d ?D))
635 (memq temp '(nil 2)))
636 continue-loop (and (not return-value)
637 (simula-forward-up-level)))
638 (setq continue-loop nil)))
639 (if return-value
640 t
641 (goto-char origin)
642 nil)))
643
644
645(defun simula-calculate-indent ()
646 (save-excursion
647 (let ((where (simula-context))
648 (origin (point))
649 (indent 0)
650 continued
651 start-line
652 temp
653 found-end
654 prev-cont)
655 (cond
656 ((eq where 0)
657 ;;
658 ;; Comment.
659 ;; If comment started on previous non-blank line, indent to the
660 ;; column where the comment started, else indent as that line.
661 ;;
662 (skip-chars-backward " \t\n\f")
663 (while (and (not (bolp)) (eq (simula-context) 0))
664 (re-search-backward "^\\|!\\|\\<comment\\>"))
665 (skip-chars-forward " \t\n\f")
666 (prog1
667 (current-column)
668 (goto-char origin)))
669 ;;
670 ;; Detect missing string delimiters
671 ;;
672 ((eq where 3)
673 (error "Inside string"))
674 ((eq where 4)
675 (error "Inside character constant"))
676 ;;
677 ;; check to see if inside ()'s
678 ;;
679 ((setq temp (simula-inside-parens))
680 temp)
681 ;;
682 ;; Calculate non-comment indentation
683 (t
684 ;; first, find out if this line starts with something that needs
eb8c3be9 685 ;; special indentation (END/IF/THEN/ELSE/WHEN/OTHERWISE or label)
a26389d1
ER
686 ;;
687 (skip-chars-forward " \t\f")
688 (cond
689 ;;
690 ;; END
691 ;;
692 ((looking-at "end\\>")
693 (setq indent (- simula-indent-level)
694 found-end t))
695 ;;
696 ;; IF/THEN/ELSE
697 ;;
698 ((looking-at "if\\>\\|then\\>\\|else\\>")
699 ;; search for the *starting* IF
700 (cond
701 ((memq (following-char) '(?T ?t))
702 (setq indent (car simula-if-indent)))
703 ((memq (following-char) '(?E ?e))
704 (setq indent (cdr simula-if-indent)))
705 (t
706 (forward-word 1)
707 (setq indent 0)))
708 (simula-find-if))
709 ;;
710 ;; WHEN/OTHERWISE
711 ;;
712 ((looking-at "when\\>\\|otherwise\\>")
713 ;; search for corresponding INSPECT
714 (if (memq (following-char) '(?W ?w))
715 (setq indent (car simula-inspect-indent))
716 (setq indent (cdr simula-inspect-indent)))
717 (simula-find-inspect))
718 ;;
719 ;; label:
720 ;;
721 ((and (not (looking-at "virtual\\>"))
722 (looking-at "[a-z0-9_]*[ \t\f]*:[^-=]"))
723 (setq indent simula-label-offset)))
724 ;; find line with non-comment text
725 (simula-skip-comment-backward)
726 (if (and found-end
727 (not (eq (preceding-char) ?\;))
728 (if (memq (preceding-char) '(?N ?n))
729 (save-excursion
ca3e10c7 730 (backward-word 1)
a26389d1
ER
731 (not (looking-at "begin\\>")))
732 t))
733 (progn
734 (simula-previous-statement 1)
735 (simula-skip-comment-backward)))
736 (setq start-line
737 (save-excursion (beginning-of-line) (point))
738 ;; - perhaps this is a continued statement
739 continued
740 (save-excursion
741 (and (not (bobp))
742 ;; (not found-end)
743 (if (eq (char-syntax (preceding-char)) ?w)
744 (progn
745 (backward-word 1)
746 (not (looking-at
747 "begin\\|then\\|else\\|when\\|otherwise\\|do"
748 )))
749 (not (memq (preceding-char) '(?: ?\;)))))))
750 ;;
751 ;; MAIN calculation loop - count BEGIN/DO etc.
752 ;;
753 (while (not (bolp))
754 (if (re-search-backward
755 ";\\|\\<\\(begin\\|end\\|if\\|else\\|then\\|when\\|otherwise\\|do\\)\\>"
756 start-line 'move)
757 (if (simula-context)
758 ();; found something in a comment/string - ignore
759 (setq temp (following-char))
760 (cond
761 ((eq temp ?\;)
762 (simula-previous-statement 1))
763 ((looking-at "begin\\>")
764 (setq indent (+ indent simula-indent-level)))
765 ((looking-at "end\\>")
766 (forward-word 1)
767 (simula-previous-statement 1))
768 ((looking-at "do\\>")
769 (setq indent (+ indent simula-substatement-offset))
770 (simula-find-do-match))
771 ((looking-at "\\(if\\|then\\|else\\)\\>")
772 (if (memq temp '(?I ?i))
773 (forward-word 1)
774 (setq indent (+ indent
775 simula-substatement-offset
776 (if (memq temp '(?T ?t))
777 (car simula-if-indent)
778 (cdr simula-if-indent)))))
779 (simula-find-if))
780 ((looking-at "\\<when\\>\\|\\<otherwise\\>")
781 (setq indent (+ indent
782 simula-substatement-offset
783 (if (memq temp '(?W ?w))
784 (car simula-if-indent)
785 (cdr simula-if-indent))))
786 (simula-find-inspect)))
787 ;; found the start of a [sub]statement
eb8c3be9 788 ;; add indentation for continued statement
a26389d1
ER
789 (if continued
790 (setq indent
791 (+ indent
792 (if (listp simula-continued-statement-offset)
793 (car simula-continued-statement-offset)
794 simula-continued-statement-offset))))
795 (setq start-line
796 (save-excursion (beginning-of-line) (point))
797 continued nil))
798 ;; search failed .. point is at beginning of line
799 ;; determine if we should continue searching
800 ;; (at or before comment or label)
801 ;; temp = t means finished
802 (setq temp
803 (and (not (simula-context))
804 (save-excursion
805 (skip-chars-forward " \t\f")
806 (or (looking-at "virtual")
807 (not
808 (looking-at
809 "!\\|comment\\>\\|[a-z0-9_]*[ \t\f]*:[^-=]")))))
810 prev-cont continued)
811 ;; if we are finished, find current line's indentation
812 (if temp
813 (setq indent (+ indent (current-indentation))))
814 ;; find next line with non-comment SIMULA text
815 ;; maybe indent extra if statement continues
816 (simula-skip-comment-backward)
817 (setq continued
818 (and (not (bobp))
819 (if (eq (char-syntax (preceding-char)) ?w)
820 (save-excursion
821 (backward-word 1)
822 (not (looking-at
823 "begin\\|then\\|else\\|when\\|otherwise\\|do")))
824 (not (memq (preceding-char) '(?: ?\;))))))
825 ;; if we the state of the continued-variable
eb8c3be9 826 ;; changed, add indentation for continued statement
a26389d1
ER
827 (if (or (and prev-cont (not continued))
828 (and continued
829 (listp simula-continued-statement-offset)))
830 (setq indent
831 (+ indent
832 (if (listp simula-continued-statement-offset)
833 (car simula-continued-statement-offset)
834 simula-continued-statement-offset))))
835 ;; while ends if point is at beginning of line at loop test
836 (if (not temp)
837 (setq start-line (save-excursion (beginning-of-line) (point)))
838 (beginning-of-line))))
839 ;;
eb8c3be9 840 ;; return indentation
a26389d1
ER
841 ;;
842 indent)))))
843
844
845(defun simula-find-if ()
3005d32e 846 "Find starting IF of a IF-THEN[-ELSE[-IF-THEN...]] statement."
a26389d1
ER
847 (catch 'simula-out
848 (while t
849 (if (and (simula-search-backward "\\<if\\>\\|;\\|\\<begin\\>"nil t)
850 (memq (following-char) '(?I ?i)))
851 (save-excursion
852 ;;
853 ;; find out if this IF was really the start of the IF statement
854 ;;
855 (simula-skip-comment-backward)
856 (if (and (eq (char-syntax (preceding-char)) ?w)
857 (progn
858 (backward-word 1)
859 (looking-at "else\\>")))
860 ()
861 (throw 'simula-out t)))
862 (if (not (looking-at "\\<if\\>"))
863 (error "Missing IF or misplaced BEGIN or ';' (can't find IF)")
864 ;;
865 ;; we were at the starting IF in the first place..
866 ;;
867 (throw 'simula-out t))))))
868
869
870(defun simula-find-inspect ()
3005d32e 871 "Find INSPECT matching WHEN or OTHERWISE."
a26389d1
ER
872 (catch 'simula-out
873 (let ((level 0))
874 ;;
875 ;; INSPECTs can be nested, have to find the corresponding one
876 ;;
877 (while t
878 (if (and (simula-search-backward "\\<inspect\\>\\|\\<otherwise\\>\\|;"
879 nil t)
880 (/= (following-char) ?\;))
881 (if (memq (following-char) '(?O ?o))
882 (setq level (1+ level))
883 (if (zerop level)
884 (throw 'simula-out t)
885 (setq level (1- level))))
886 (error "Missing INSPECT or misplaced ';' (can't find INSPECT)"))))))
887
888
889(defun simula-find-do-match ()
890 "Find keyword matching DO: FOR, WHILE, INSPECT or WHEN"
891 (while (and (re-search-backward
892 "\\<\\(do\\|for\\|while\\|inspect\\|when\\|end\\|begin\\)\\>\\|;"
893 nil 'move)
894 (simula-context)))
895 (if (and (looking-at "\\<\\(for\\|while\\|inspect\\|when\\)\\>")
896 (not (simula-context)))
897 () ;; found match
898 (error "No matching FOR, WHILE or INSPECT for DO, or misplaced ';'")))
899
900
901(defun simula-inside-parens ()
3005d32e 902 "Return position after `(' on line if inside parentheses, nil otherwise."
a26389d1
ER
903 (save-excursion
904 (let ((parlevel 0))
905 (catch 'simula-out
906 (while t
907 (if (re-search-backward "(\\|)\\|;" nil t)
908 (if (eq (simula-context) nil)
909 ;; found something - check it out
910 (cond
911 ((eq (following-char) ?\;)
912 (if (zerop parlevel)
913 (throw 'simula-out nil)
eb8c3be9 914 (error "Parenthesis mismatch or misplaced ';'")))
a26389d1
ER
915 ((eq (following-char) ?\()
916 (if (zerop parlevel)
917 (throw 'simula-out (1+ (current-column)))
918 (setq parlevel (1- parlevel))))
919 (t (setq parlevel (1+ parlevel))))
920 );; nothing - inside comment or string
921 ;; search failed
922 (throw 'simula-out nil)))))))
923
924
925(defun simula-goto-definition ()
926 "Goto point of definition of variable, procedure or class."
927 (interactive))
928
929
930(defun simula-expand-stdproc ()
931 (if (or (not simula-abbrev-stdproc) (simula-context))
932 (unexpand-abbrev)
933 (cond
934 ((eq simula-abbrev-stdproc 'upcase) (upcase-word -1))
935 ((eq simula-abbrev-stdproc 'downcase) (downcase-word -1))
936 ((eq simula-abbrev-stdproc 'capitalize) (capitalize-word -1)))))
937
938
939(defun simula-expand-keyword ()
940 (if (or (not simula-abbrev-keyword) (simula-context))
941 (unexpand-abbrev)
942 (cond
943 ((eq simula-abbrev-keyword 'upcase) (upcase-word -1))
944 ((eq simula-abbrev-keyword 'downcase) (downcase-word -1))
945 ((eq simula-abbrev-keyword 'capitalize) (capitalize-word -1)))))
946
947
948(defun simula-electric-keyword ()
3005d32e 949 "Expand SIMULA keyword. If it starts the line, reindent."
a26389d1
ER
950 ;; redisplay
951 (let ((show-char (eq this-command 'self-insert-command)))
eb8c3be9 952 ;; If the abbrev expansion results in reindentation, the user may have
a26389d1
ER
953 ;; to wait some time before the character he typed is displayed
954 ;; (the char causing the expansion is inserted AFTER the hook function
955 ;; is called). This is annoying in case of normal characters.
956 ;; However, if the user pressed a key bound to newline, it is better
957 ;; to have the line inserted after the begin-end match.
958 (if show-char
959 (progn
960 (insert-char last-command-char 1)
961 (sit-for 0)
962 (backward-char 1)))
963 (if (let ((where (simula-context))
964 (case-fold-search t))
965 (if where
966 (if (and (eq where 2) (eq (char-syntax (preceding-char)) ?w))
967 (save-excursion
968 (backward-word 1)
969 (not (looking-at "end\\>"))))))
970 (unexpand-abbrev)
971 (cond
972 ((not simula-abbrev-keyword) (unexpand-abbrev))
973 ((eq simula-abbrev-keyword 'upcase) (upcase-word -1))
974 ((eq simula-abbrev-keyword 'downcase) (downcase-word -1))
975 ((eq simula-abbrev-keyword 'capitalize) (capitalize-word -1)))
976 (let ((pos (- (point-max) (point)))
977 (case-fold-search t)
978 null)
979 (condition-case null
980 (progn
981 ;; check if the expanded word is on the beginning of the line.
982 (if (and (eq (char-syntax (preceding-char)) ?w)
983 (progn
984 (backward-word 1)
985 (if (looking-at "end\\>")
986 (save-excursion
987 (simula-backward-up-level 1)
988 (if (pos-visible-in-window-p)
989 (sit-for 1)
990 (message
991 (concat "Matches "
992 (buffer-substring
993 (point)
994 (+ (point) (window-width))))))))
995 (skip-chars-backward " \t\f")
996 (bolp)))
997 (let ((indent (simula-calculate-indent)))
998 (if (eq indent (current-indentation))
999 ()
1000 (delete-horizontal-space)
1001 (indent-to indent)))
1002 (skip-chars-forward " \t\f"))
1003 ;; check for END - blow whistles and ring bells
1004
1005 (goto-char (- (point-max) pos))
1006 (if show-char
1007 (delete-char 1)))
1008 (quit (goto-char (- (point-max) pos))))))))
1009
1010
1011(defun simula-search-backward (string &optional limit move)
1012 (setq string (concat string "\\|\\<end\\>"))
1013 (let (level)
1014 (catch 'simula-out
1015 (while (re-search-backward string limit move)
1016 (if (simula-context)
1017 ()
1018 (if (looking-at "\\<end\\>")
1019 (progn
1020 (setq level 0)
1021 (while (natnump level)
1022 (re-search-backward "\\<begin\\>\\|\\<end\\>")
1023 (if (simula-context)
1024 ()
1025 (setq level (if (memq (following-char) '(?b ?B))
1026 (1- level)
1027 (1+ level))))))
1028 (throw 'simula-out t)))))))
1029
1030
1031(defun simula-search-forward (string &optional limit move)
1032 (setq string (concat string "\\|\\<begin\\>"))
1033 (let (level)
1034 (catch 'exit
1035 (while (re-search-forward string limit move)
1036 (goto-char (match-beginning 0))
1037 (if (simula-context)
1038 (goto-char (1- (match-end 0)))
1039 (if (looking-at "\\<begin\\>")
1040 (progn
1041 (goto-char (1- (match-end 0)))
1042 (setq level 0)
1043 (while (natnump level)
1044 (re-search-forward "\\<begin\\>\\|\\<end\\>")
1045 (backward-word 1)
1046 (if (not (simula-context))
1047 (setq level (if (memq (following-char) '(?e ?E))
1048 (1- level)
1049 (1+ level))))
1050 (backward-word -1)))
1051 (goto-char (1- (match-end 0)))
1052 (throw 'exit t)))))))
1053
1054
1055(defun simula-install-standard-abbrevs ()
3005d32e 1056 "Define Simula keywords, procedures and classes in local abbrev table."
a26389d1
ER
1057 ;; procedure and class names are as of the SIMULA 87 standard.
1058 (interactive)
1059 (mapcar (function (lambda (args)
1060 (apply 'define-abbrev simula-mode-abbrev-table args)))
1061 '(("abs" "Abs" simula-expand-stdproc)
1062 ("accum" "Accum" simula-expand-stdproc)
1063 ("activate" "ACTIVATE" simula-expand-keyword)
1064 ("addepsilon" "AddEpsilon" simula-expand-stdproc)
1065 ("after" "AFTER" simula-expand-keyword)
1066 ("and" "AND" simula-expand-keyword)
1067 ("arccos" "ArcCos" simula-expand-stdproc)
1068 ("arcsin" "ArcSin" simula-expand-stdproc)
1069 ("arctan" "ArcTan" simula-expand-stdproc)
1070 ("arctan2" "ArcTan2" simula-expand-stdproc)
1071 ("array" "ARRAY" simula-expand-keyword)
1072 ("at" "AT" simula-expand-keyword)
1073 ("before" "BEFORE" simula-expand-keyword)
1074 ("begin" "BEGIN" simula-expand-keyword)
1075 ("blanks" "Blanks" simula-expand-stdproc)
1076 ("boolean" "BOOLEAN" simula-expand-keyword)
1077 ("breakoutimage" "BreakOutImage" simula-expand-stdproc)
1078 ("bytefile" "ByteFile" simula-expand-stdproc)
1079 ("call" "Call" simula-expand-stdproc)
1080 ("cancel" "Cancel" simula-expand-stdproc)
1081 ("cardinal" "Cardinal" simula-expand-stdproc)
1082 ("char" "Char" simula-expand-stdproc)
1083 ("character" "CHARACTER" simula-expand-keyword)
1084 ("checkpoint" "CheckPoint" simula-expand-stdproc)
1085 ("class" "CLASS" simula-expand-keyword)
1086 ("clear" "Clear" simula-expand-stdproc)
1087 ("clocktime" "ClockTime" simula-expand-stdproc)
1088 ("close" "Close" simula-expand-stdproc)
1089 ("comment" "COMMENT" simula-expand-keyword)
1090 ("constant" "Constant" simula-expand-stdproc)
1091 ("copy" "Copy" simula-expand-stdproc)
1092 ("cos" "Cos" simula-expand-stdproc)
1093 ("cosh" "CosH" simula-expand-stdproc)
1094 ("cotan" "CoTan" simula-expand-stdproc)
1095 ("cputime" "CpuTime" simula-expand-stdproc)
1096 ("current" "Current" simula-expand-stdproc)
1097 ("datetime" "DateTime" simula-expand-stdproc)
1098 ("decimalmark" "DecimalMark" simula-expand-stdproc)
1099 ("delay" "DELAY" simula-expand-keyword)
1100 ("deleteimage" "DeleteImage" simula-expand-stdproc)
1101 ("detach" "Detach" simula-expand-stdproc)
1102 ("digit" "Digit" simula-expand-stdproc)
1103 ("directbytefile" "DirectByteFile" simula-expand-stdproc)
1104 ("directfile" "DirectFile" simula-expand-stdproc)
1105 ("discrete" "Discrete" simula-expand-stdproc)
1106 ("do" "DO" simula-expand-keyword)
1107 ("downcase" "Downcase" simula-expand-stdproc)
1108 ("draw" "Draw" simula-expand-stdproc)
1109 ("eject" "Eject" simula-expand-stdproc)
1110 ("else" "ELSE" simula-electric-keyword)
1111 ("empty" "Empty" simula-expand-stdproc)
1112 ("end" "END" simula-electric-keyword)
1113 ("endfile" "Endfile" simula-expand-stdproc)
1114 ("entier" "Entier" simula-expand-stdproc)
1115 ("eq" "EQ" simula-expand-keyword)
1116 ("eqv" "EQV" simula-expand-keyword)
1117 ("erlang" "Erlang" simula-expand-stdproc)
1118 ("error" "Error" simula-expand-stdproc)
1119 ("evtime" "EvTime" simula-expand-stdproc)
1120 ("exp" "Exp" simula-expand-stdproc)
1121 ("external" "EXTERNAL" simula-expand-keyword)
1122 ("false" "FALSE" simula-expand-keyword)
1123 ("field" "Field" simula-expand-stdproc)
1124 ("file" "File" simula-expand-stdproc)
1125 ("first" "First" simula-expand-stdproc)
1126 ("follow" "Follow" simula-expand-stdproc)
1127 ("for" "FOR" simula-expand-keyword)
1128 ("ge" "GE" simula-expand-keyword)
1129 ("getchar" "GetChar" simula-expand-stdproc)
1130 ("getfrac" "GetFrac" simula-expand-stdproc)
1131 ("getint" "GetInt" simula-expand-stdproc)
1132 ("getreal" "GetReal" simula-expand-stdproc)
1133 ("go" "GO" simula-expand-keyword)
1134 ("goto" "GOTO" simula-expand-keyword)
1135 ("gt" "GT" simula-expand-keyword)
1136 ("head" "Head" simula-expand-stdproc)
1137 ("hidden" "HIDDEN" simula-expand-keyword)
1138 ("histd" "HistD" simula-expand-stdproc)
1139 ("histo" "Histo" simula-expand-stdproc)
1140 ("hold" "Hold" simula-expand-stdproc)
1141 ("idle" "Idle" simula-expand-stdproc)
1142 ("if" "IF" simula-expand-keyword)
1143 ("image" "Image" simula-expand-stdproc)
1144 ("imagefile" "ImageFile" simula-expand-stdproc)
1145 ("imp" "IMP" simula-expand-keyword)
1146 ("in" "IN" simula-expand-keyword)
1147 ("inbyte" "InByte" simula-expand-stdproc)
1148 ("inbytefile" "InByteFile" simula-expand-stdproc)
1149 ("inchar" "InChar" simula-expand-stdproc)
1150 ("infile" "InFile" simula-expand-stdproc)
1151 ("infrac" "InFrac" simula-expand-stdproc)
1152 ("inimage" "InImage" simula-expand-stdproc)
1153 ("inint" "InInt" simula-expand-stdproc)
1154 ("inner" "INNER" simula-expand-keyword)
1155 ("inreal" "InReal" simula-expand-stdproc)
1156 ("inrecord" "InRecord" simula-expand-stdproc)
1157 ("inspect" "INSPECT" simula-expand-keyword)
1158 ("integer" "INTEGER" simula-expand-keyword)
1159 ("intext" "InText" simula-expand-stdproc)
1160 ("into" "Into" simula-expand-stdproc)
1161 ("is" "IS" simula-expand-keyword)
1162 ("isochar" "ISOChar" simula-expand-stdproc)
1163 ("isopen" "IsOpen" simula-expand-stdproc)
1164 ("isorank" "ISORank" simula-expand-stdproc)
1165 ("label" "LABEL" simula-expand-keyword)
1166 ("last" "Last" simula-expand-stdproc)
1167 ("lastitem" "LastItem" simula-expand-stdproc)
1168 ("lastloc" "LastLoc" simula-expand-stdproc)
1169 ("le" "LE" simula-expand-keyword)
1170 ("length" "Length" simula-expand-stdproc)
1171 ("letter" "Letter" simula-expand-stdproc)
1172 ("line" "Line" simula-expand-stdproc)
1173 ("linear" "Linear" simula-expand-stdproc)
1174 ("linesperpage" "LinesPerPage" simula-expand-stdproc)
1175 ("link" "Link" simula-expand-stdproc)
1176 ("linkage" "Linkage" simula-expand-stdproc)
1177 ("ln" "Ln" simula-expand-stdproc)
1178 ("locate" "Locate" simula-expand-stdproc)
1179 ("location" "Location" simula-expand-stdproc)
1180 ("lock" "Lock" simula-expand-stdproc)
1181 ("locked" "Locked" simula-expand-stdproc)
1182 ("log10" "Log10" simula-expand-stdproc)
1183 ("long" "LONG" simula-expand-keyword)
1184 ("lowcase" "LowCase" simula-expand-stdproc)
1185 ("lowerbound" "LowerBound" simula-expand-stdproc)
1186 ("lowten" "LowTen" simula-expand-stdproc)
1187 ("lt" "LT" simula-expand-keyword)
1188 ("main" "Main" simula-expand-stdproc)
1189 ("max" "Max" simula-expand-stdproc)
1190 ("maxint" "MaxInt" simula-expand-stdproc)
1191 ("maxlongreal" "MaxLongReal" simula-expand-stdproc)
1192 ("maxloc" "MaxLoc" simula-expand-stdproc)
1193 ("maxrank" "MaxRank" simula-expand-stdproc)
1194 ("maxreal" "MaxReal" simula-expand-stdproc)
1195 ("min" "Min" simula-expand-stdproc)
1196 ("minint" "MinInt" simula-expand-stdproc)
1197 ("minlongreal" "MinLongReal" simula-expand-stdproc)
1198 ("minrank" "MinRank" simula-expand-stdproc)
1199 ("minreal" "MinReal" simula-expand-stdproc)
1200 ("mod" "Mod" simula-expand-stdproc)
1201 ("more" "More" simula-expand-stdproc)
1202 ("name" "NAME" simula-expand-keyword)
1203 ("ne" "NE" simula-expand-keyword)
1204 ("negexp" "NegExp" simula-expand-stdproc)
1205 ("new" "NEW" simula-expand-keyword)
1206 ("nextev" "NextEv" simula-expand-stdproc)
1207 ("none" "NONE" simula-expand-keyword)
1208 ("normal" "Normal" simula-expand-stdproc)
1209 ("not" "NOT" simula-expand-keyword)
1210 ("notext" "NOTEXT" simula-expand-keyword)
1211 ("open" "Open" simula-expand-stdproc)
1212 ("or" "OR" simula-expand-keyword)
1213 ("otherwise" "OTHERWISE" simula-electric-keyword)
1214 ("out" "Out" simula-expand-stdproc)
1215 ("outbyte" "OutByte" simula-expand-stdproc)
1216 ("outbytefile" "OutByteFile" simula-expand-stdproc)
1217 ("outchar" "OutChar" simula-expand-stdproc)
1218 ("outfile" "OutFile" simula-expand-stdproc)
1219 ("outfix" "OutFix" simula-expand-stdproc)
1220 ("outfrac" "OutFrac" simula-expand-stdproc)
1221 ("outimage" "OutImage" simula-expand-stdproc)
1222 ("outint" "OutInt" simula-expand-stdproc)
1223 ("outreal" "OutReal" simula-expand-stdproc)
1224 ("outrecord" "OutRecord" simula-expand-stdproc)
1225 ("outtext" "OutText" simula-expand-stdproc)
1226 ("page" "Page" simula-expand-stdproc)
1227 ("passivate" "Passivate" simula-expand-stdproc)
1228 ("poisson" "Poisson" simula-expand-stdproc)
1229 ("pos" "Pos" simula-expand-stdproc)
1230 ("precede" "Precede" simula-expand-stdproc)
1231 ("pred" "Pred" simula-expand-stdproc)
1232 ("prev" "Prev" simula-expand-stdproc)
1233 ("printfile" "PrintFile" simula-expand-stdproc)
1234 ("prior" "PRIOR" simula-expand-keyword)
1235 ("procedure" "PROCEDURE" simula-expand-keyword)
1236 ("process" "Process" simula-expand-stdproc)
1237 ("protected" "PROTECTED" simula-expand-keyword)
1238 ("putchar" "PutChar" simula-expand-stdproc)
1239 ("putfix" "PutFix" simula-expand-stdproc)
1240 ("putfrac" "PutFrac" simula-expand-stdproc)
1241 ("putint" "PutInt" simula-expand-stdproc)
1242 ("putreal" "PutReal" simula-expand-stdproc)
1243 ("qua" "QUA" simula-expand-keyword)
1244 ("randint" "RandInt" simula-expand-stdproc)
1245 ("rank" "Rank" simula-expand-stdproc)
1246 ("reactivate" "REACTIVATE" simula-expand-keyword)
1247 ("real" "REAL" simula-expand-keyword)
1248 ("ref" "REF" simula-expand-keyword)
1249 ("resume" "Resume" simula-expand-stdproc)
1250 ("setaccess" "SetAccess" simula-expand-stdproc)
1251 ("setpos" "SetPos" simula-expand-stdproc)
1252 ("short" "SHORT" simula-expand-keyword)
1253 ("sign" "Sign" simula-expand-stdproc)
1254 ("simset" "SimSet" simula-expand-stdproc)
1255 ("simulaid" "SimulaId" simula-expand-stdproc)
1256 ("simulation" "Simulation" simula-expand-stdproc)
1257 ("sin" "Sin" simula-expand-stdproc)
1258 ("sinh" "SinH" simula-expand-stdproc)
1259 ("sourceline" "SourceLine" simula-expand-stdproc)
1260 ("spacing" "Spacing" simula-expand-stdproc)
1261 ("sqrt" "Sqrt" simula-expand-stdproc)
1262 ("start" "Start" simula-expand-stdproc)
1263 ("step" "STEP" simula-expand-keyword)
1264 ("strip" "Strip" simula-expand-stdproc)
1265 ("sub" "Sub" simula-expand-stdproc)
1266 ("subepsilon" "SubEpsilon" simula-expand-stdproc)
1267 ("suc" "Suc" simula-expand-stdproc)
1268 ("switch" "SWITCH" simula-expand-keyword)
1269 ("sysin" "SysIn" simula-expand-stdproc)
1270 ("sysout" "SysOut" simula-expand-stdproc)
1271 ("tan" "Tan" simula-expand-stdproc)
1272 ("tanh" "TanH" simula-expand-stdproc)
1273 ("terminate_program" "Terminate_Program" simula-expand-stdproc)
1274 ("terminated" "Terminated" simula-expand-stdproc)
1275 ("text" "TEXT" simula-expand-keyword)
1276 ("then" "THEN" simula-electric-keyword)
1277 ("this" "THIS" simula-expand-keyword)
1278 ("time" "Time" simula-expand-stdproc)
1279 ("to" "TO" simula-expand-keyword)
1280 ("true" "TRUE" simula-expand-keyword)
1281 ("uniform" "Uniform" simula-expand-stdproc)
1282 ("unlock" "Unlock" simula-expand-stdproc)
1283 ("until" "UNTIL" simula-expand-keyword)
1284 ("upcase" "Upcase" simula-expand-stdproc)
1285 ("upperbound" "UpperBound" simula-expand-stdproc)
1286 ("value" "VALUE" simula-expand-keyword)
1287 ("virtual" "VIRTUAL" simula-expand-keyword)
1288 ("wait" "Wait" simula-expand-stdproc)
1289 ("when" "WHEN" simula-electric-keyword)
1290 ("while" "WHILE" simula-expand-keyword))))
1291
1292;;; simula.el ends here