annotate lisp/modes/simula.el @ 8:4b173ad71786 r19-15b5

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