Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/sml-mode/sml-defs.el
ViewVC logotype

Annotation of /sml/trunk/sml-mode/sml-defs.el

Parent Directory Parent Directory | Revision Log Revision Log


Revision 319 - (view) (download)

1 : monnier 319 ;;; sml-move.el
2 :    
3 :     (defconst rcsid-sml-defs "@(#)$Name$:$Id$")
4 :    
5 :     ;; Copyright (C) 1999-1999 Stefan Monnier <monnier@cs.yale.edu>
6 :     ;;
7 :     ;; This program is free software; you can redistribute it and/or modify
8 :     ;; it under the terms of the GNU General Public License as published by
9 :     ;; the Free Software Foundation; either version 2 of the License, or
10 :     ;; (at your option) any later version.
11 :     ;;
12 :     ;; This program is distributed in the hope that it will be useful,
13 :     ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 :     ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 :     ;; GNU General Public License for more details.
16 :     ;;
17 :     ;; You should have received a copy of the GNU General Public License
18 :     ;; along with this program; if not, write to the Free Software
19 :     ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 :    
21 :     (require 'cl)
22 :     (require 'sml-util)
23 :    
24 :     ;;;
25 :     ;;; Code
26 :     ;;;
27 :    
28 :     (defvar sml-outline-regexp "[ \t]*\\((\\*+\\|\\(let[ \t]+\\)?fun.\\)"
29 :     "Regexp matching a major heading.")
30 :    
31 :     ;;;
32 :     ;;; Internal defines
33 :     ;;;
34 :    
35 :     (defmap sml-bindings
36 :     ;; smarter cursor movement
37 :     '((forward-sexp . sml-user-forward-sexp)
38 :     (backward-sexp . sml-user-backward-sexp)
39 :     ;; Text-formatting commands:
40 :     ("\C-c\C-m" . sml-insert-form)
41 :     ("\C-c\C-i" . sml-mode-info)
42 :     ("\M-|" . sml-electric-pipe)
43 :     ("\;" . sml-electric-semi)
44 :     ("\M-\t" . sml-back-to-outer-indent)
45 :     ("\C-\M-\\" . sml-indent-region)
46 :     ("\t" . sml-indent-line) ; ...except this one
47 :     ;; Process commands added to sml-mode-map -- these should autoload
48 :     ("\C-c\C-l" . sml-load-file)
49 :     ("\C-c`" . sml-next-error))
50 :     "Generic bindings used in sml-mode and sml-inferior-mode.")
51 :    
52 :     (defmap sml-mode-map
53 :     '(("\C-c\C-c" . sml-make)
54 :     ("\C-c\C-s" . switch-to-sml)
55 :     ("\C-c\C-r" . sml-send-region)
56 :     ("\C-c\C-b" . sml-send-buffer))
57 :     "The keymap used in sml-mode."
58 :     :inherit sml-bindings)
59 :    
60 :     (defsyntax sml-mode-syntax-table
61 :     '((?\* . ". 23n")
62 :     (?\( . "()1")
63 :     (?\) . ")(4")
64 :     ("._'" . "_")
65 :     (",;" . ".")
66 :     ;; `!' is not really a prefix-char, oh well!
67 :     ("~#!" . "'")
68 :     ("%&$+-/:<=>?@`^|" . "."))
69 :     "The syntax table used in sml-mode.")
70 :    
71 :     ;;
72 :     ;; regexps
73 :     ;;
74 :    
75 :     (defun sml-syms-re (&rest syms)
76 :     (concat "\\<" (regexp-opt (flatten syms) t) "\\>"))
77 :    
78 :     ;;
79 :    
80 :     (defconst sml-module-head-syms
81 :     '("signature" "structure" "functor" "abstraction"))
82 :    
83 :     (defconst sml-begin-symbols-re
84 :     (sml-syms-re "let" "abstype" "local" "struct" "sig")
85 :     "Symbols matching the `end' symbol.")
86 :    
87 :     ;; (defconst sml-user-begin-symbols-re
88 :     ;; (sml-syms-re "let" "abstype" "local" "struct" "sig" "in" "with")
89 :     ;; "Symbols matching (loosely) the `end' symbol.")
90 :    
91 :     (defconst sml-sexp-head-symbols-re
92 :     (sml-syms-re "let" "abstype" "local" "struct" "sig" "in" "with"
93 :     "if" "then" "else" "case" "of" "fn" "fun" "val" "and"
94 :     sml-module-head-syms
95 :     "handle" "raise")
96 :     "Symbols starting an sexp.")
97 :    
98 :     ;; (defconst sml-not-arg-start-re
99 :     ;; (sml-syms-re "in" "of" "end" "andalso")
100 :     ;; "Symbols that can't be found at the head of an arg.")
101 :    
102 :     ;; (defconst sml-not-arg-re
103 :     ;; (sml-syms-re "in" "of" "end" "andalso")
104 :     ;; "Symbols that should not be confused with an arg.")
105 :    
106 :     (defconst sml-indent-starters
107 :     (list
108 :     (cons "\\<struct\\>" 0)
109 :     (cons (sml-syms-re sml-module-head-syms) '(sml-indent-level 0))
110 :     (cons "\\<local\\>" '(sml-indent-level 0))
111 :     (cons "\\<of\\>" '(3 nil))
112 :     (cons "\\<else\\>" '(sml-indent-level 0))
113 :     (cons "\\<in\\>" '(sml-indent-level nil))
114 :     (cons (sml-syms-re "abstype" "and" "case" "of" "datatype"
115 :     "fun" "if" "then" "else" "sharing" "infix" "infixr"
116 :     "let" "in" "local" "nonfix" "open" "raise" "sig"
117 :     "struct" "type" "val" "while" "do" "with" "withtype")
118 :     'sml-indent-level))
119 :     "")
120 :    
121 :     (defconst sml-starters-indent-after
122 :     (sml-syms-re "let" "local" "struct" "in" "sig" "with")
123 :     "Indent after these.")
124 :    
125 :     (defconst sml-=-starter-re
126 :     (sml-syms-re "val" "fun" "and" "datatype" "type" "abstype" "eqtype"
127 :     sml-module-head-syms)
128 :     "keywords which can be followed by a `='")
129 :    
130 :     (defconst sml-delegate
131 :     (list
132 :     (cons (sml-syms-re "of" "else" "then") '(not (sml-bolp)))
133 :     (cons "\\<in\\>" t))
134 :     "Words which might delegate indentation to their parent.")
135 :    
136 :     (defconst sml-starters-syms
137 :     (append sml-module-head-syms
138 :     '("abstype" "datatype" "exception" "fun"
139 :     "local" "infix" "infixr" "sharing" "nonfix"
140 :     "open" "type" "val" "and"
141 :     "withtype" "with"))
142 :     "The starters of new expressions.")
143 :     (defconst sml-starters-re (sml-syms-re sml-starters-syms))
144 :    
145 :     (defconst sml-exptrail-syms
146 :     '("if" "then" "else" "while" "do" "case" "of" "raise" "fn"))
147 :    
148 :     (defconst sml-pipehead-re
149 :     (sml-syms-re "fun" "fn" "and" "handle" "case" "datatype" "abstype")
150 :     "A `|' corresponds to one of these.")
151 :    
152 :     ;;
153 :     (provide 'sml-defs)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0