comparison lisp/modes/simula.el @ 0:376386a54a3c r19-14

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