annotate lisp/modes/simula.el @ 124:9b50b4588a93 r20-1b15

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