annotate lisp/modes/simula.el @ 193:f53b5ca2e663 r20-3b23

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