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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 333, Tue Jun 15 03:41:26 1999 UTC revision 334, Thu Jun 17 02:43:15 1999 UTC
# Line 68  Line 68 
68      ("%&$+-/:<=>?@`^|"   . "."))      ("%&$+-/:<=>?@`^|"   . "."))
69    "The syntax table used in sml-mode.")    "The syntax table used in sml-mode.")
70    
71  (defconst sml-menu  
72    
73    (easy-menu-define sml-mode-menu sml-mode-map "Menu used in sml-mode."
74    '("SML"    '("SML"
75      ("Process"      ("Process"
76       ["Start default ML compiler" sml           :active (fboundp 'sml)]       ["Start default ML compiler" sml           (fboundp 'sml)]
77       ["-" nil nil]       ["-" nil nil]
78       ["run CM.make"             sml-make        :active (featurep 'sml-proc)]       ["run CM.make"             sml-make        (featurep 'sml-proc)]
79       ["load ML source file"     sml-load-file   :active (featurep 'sml-proc)]       ["load ML source file"     sml-load-file   (featurep 'sml-proc)]
80       ["switch to ML buffer"     switch-to-sml   :active (featurep 'sml-proc)]       ["switch to ML buffer"     switch-to-sml   (featurep 'sml-proc)]
81       ["--" nil nil]       ["--" nil nil]
82       ["send buffer contents"    sml-send-buffer :active (featurep 'sml-proc)]       ["send buffer contents"    sml-send-buffer (featurep 'sml-proc)]
83       ["send region"             sml-send-region :active (featurep 'sml-proc)]       ["send region"             sml-send-region (featurep 'sml-proc)]
84       ["send paragraph"          sml-send-function :active (featurep 'sml-proc)]       ["send paragraph"          sml-send-function (featurep 'sml-proc)]
85       ["goto next error"         sml-next-error  :active (featurep 'sml-proc)]       ["goto next error"         sml-next-error  (featurep 'sml-proc)]
86       ["---" nil nil]       ["---" nil nil]
87       ["Standard ML of New Jersey" sml-smlnj     :active (fboundp 'sml-smlnj)]       ["Standard ML of New Jersey" sml-smlnj     (fboundp 'sml-smlnj)]
88       ["Poly/ML"                 sml-poly-ml     :active (fboundp 'sml-poly-ml)]       ["Poly/ML"                 sml-poly-ml     (fboundp 'sml-poly-ml)]
89       ["Moscow ML"               sml-mosml       :active (fboundp 'sml-mosml)]       ["Moscow ML"               sml-mosml       (fboundp 'sml-mosml)]
90       ["Help for Inferior ML"    (describe-function 'inferior-sml-mode) :active (featurep 'sml-proc)])       ["Help for Inferior ML"    (describe-function 'inferior-sml-mode) :active (featurep 'sml-proc)])
91      ["electric pipe"     sml-electric-pipe t]      ["electric pipe"     sml-electric-pipe t]
92      ["insert SML form"   sml-insert-form t]      ["insert SML form"   sml-insert-form t]
93      ("Forms"      ("Forms" :filter sml-forms-menu)
      ["abstype"     sml-form-abstype t]  
      ["datatype"    sml-form-datatype t]  
      ["-" nil nil]  
      ["let"         sml-form-let t]  
      ["local"       sml-form-local t]  
      ["case"        sml-form-case t]  
      ["--" nil nil]  
      ["signature"   sml-form-signature t]  
      ["functor"     sml-form-functor t]  
      ["structure"   sml-form-structure t])  
94      ("Format/Mode Variables"      ("Format/Mode Variables"
95       ["indent region"             sml-indent-region t]       ["indent region"             sml-indent-region t]
96       ["outdent"                   sml-back-to-outer-indent t]       ["outdent"                   sml-back-to-outer-indent t]
# Line 117  Line 109 
109      ["-----" nil nil]      ["-----" nil nil]
110      ["Remove overlay"    (sml-error-overlay 'undo) :active (sml-overlay-active-p)]))      ["Remove overlay"    (sml-error-overlay 'undo) :active (sml-overlay-active-p)]))
111    
 (when (ignore-errors (require 'easymenu))  
   (easy-menu-define sml-mode-menu  
                     sml-mode-map  
                     "Menu used in sml-mode."  
                     sml-menu))  
   
112  ;;; Make's sure they appear in the menu bar when sml-mode-map is active.  ;;; Make's sure they appear in the menu bar when sml-mode-map is active.
113  ;; On the hook for XEmacs only -- see easy-menu-add in auc-menu.el.  ;; On the hook for XEmacs only -- see easy-menu-add in auc-menu.el.
114  ;; (defun sml-mode-menu-bar ()  ;; (defun sml-mode-menu-bar ()
# Line 143  Line 129 
129  (defconst sml-module-head-syms  (defconst sml-module-head-syms
130    '("signature" "structure" "functor" "abstraction"))    '("signature" "structure" "functor" "abstraction"))
131    
132    
133    (defconst sml-begin-syms
134      '("let" "abstype" "local" "struct" "sig")
135      "Symbols matching the `end' symbol.")
136    
137  (defconst sml-begin-symbols-re  (defconst sml-begin-symbols-re
138    (sml-syms-re "let" "abstype" "local" "struct" "sig")    (sml-syms-re "let" "abstype" "local" "struct" "sig")
139    "Symbols matching the `end' symbol.")    "Symbols matching the `end' symbol.")
# Line 154  Line 145 
145  (defconst sml-sexp-head-symbols-re  (defconst sml-sexp-head-symbols-re
146    (sml-syms-re "let" "abstype" "local" "struct" "sig" "in" "with"    (sml-syms-re "let" "abstype" "local" "struct" "sig" "in" "with"
147                 "if" "then" "else" "case" "of" "fn" "fun" "val" "and"                 "if" "then" "else" "case" "of" "fn" "fun" "val" "and"
148                   "datatype" "type" "exception" "open" "infix" "infixr" "nonfix"
149                 sml-module-head-syms                 sml-module-head-syms
150                 "handle" "raise")                 "handle" "raise")
151    "Symbols starting an sexp.")    "Symbols starting an sexp.")
# Line 166  Line 158 
158  ;;   (sml-syms-re "in" "of" "end" "andalso")  ;;   (sml-syms-re "in" "of" "end" "andalso")
159  ;;   "Symbols that should not be confused with an arg.")  ;;   "Symbols that should not be confused with an arg.")
160    
161  (defconst sml-indent-starters  (defconst sml-=-starter-syms
162    (list    (list* "|" "val" "fun" "and" "datatype" "type" "abstype" "eqtype"
163     (cons "\\<struct\\>" 0)           sml-module-head-syms)
164     (cons (sml-syms-re sml-module-head-syms) '(sml-indent-level 0))    "Symbols that can be followed by a `='.")
165     (cons "\\<local\\>" '(sml-indent-level 0))  (defconst sml-=-starter-re
166     (cons "\\<of\\>" '(3 nil))    (concat "\\S.|\\S.\\|" (sml-syms-re (cdr sml-=-starter-syms)))
167     (cons "\\<else\\>" '(sml-indent-level 0))    "Symbols that can be followed by a `='.")
168     (cons "\\<in\\|fun\\|and\\>" '(sml-indent-level nil))  
169     (cons (sml-syms-re "abstype" "case" "datatype"  (defconst sml-indent-rule
170                        "if" "then" "else" "sharing" "infix" "infixr"    (sml-preproc-alist
171                        "let" "local" "nonfix" "open" "raise" "sig"     `(("struct" . 0)
172                        "struct" "type" "val" "while" "do" "with" "withtype")       (,sml-module-head-syms . ("d=" 0))
173           'sml-indent-level))       ("local" . ("in" 0))
174         ;;("of" . (3 nil))
175         ;;("else" . (sml-indent-level 0))
176         ;;(("in" "fun" "and" "of") . (sml-indent-level nil))
177         (,sml-=-starter-syms . (nil))
178         (("abstype" "case" "datatype" "if" "then" "else" "sharing" "infix" "infixr"
179           "let" "local" "nonfix" "open" "raise" "sig" "struct" "type" "val" "while"
180           "do" "with" "withtype"))))
181    "")    "")
182    
183  (defconst sml-starters-indent-after  (defconst sml-starters-indent-after
184    (sml-syms-re "let" "local" "struct" "in" "sig" "with")    (sml-syms-re "let" "local" "struct" "in" "sig" "with")
185    "Indent after these.")    "Indent after these.")
186    
 (defconst sml-=-starter-re  
   (sml-syms-re "val" "fun" "and" "datatype" "type" "abstype" "eqtype"  
                sml-module-head-syms)  
   "keywords which can be followed by a `='")  
   
187  (defconst sml-delegate  (defconst sml-delegate
188    (list    (sml-preproc-alist
189     (cons (sml-syms-re "of" "else" "then") '(not (sml-bolp)))     `((("of" "else" "then" "d=") . (not (sml-bolp)))
190     (cons "\\<in\\>" t))       ("in" . t)))
191    "Words which might delegate indentation to their parent.")    "Words which might delegate indentation to their parent.")
192    
193    (defconst sml-symbol-indent
194      '(("fn" . -3)
195        ("of" . 1)
196        ;;("in" . 1)
197        ("d=" . 2))
198      "Special indentation alist for some symbols.")
199    
200    (defconst sml-open-paren
201      (sml-preproc-alist
202       `((,(list* "with" "in" sml-begin-syms) . "\\<end\\>")))
203      "Symbols that should behave somewhat like opening parens.")
204    
205    (defconst sml-close-paren
206      `(("in" . "\\<l\\(ocal\\|et\\)\\>")
207        ("with" . "\\<abstype\\>")
208        ("withtype" . "\\<\\(abs\\|data\\)type\\>")
209        ("end" . ,sml-begin-symbols-re)
210        ("then" . "\\<if\\>")
211        ("else" . "\\<if\\>")
212        ("of" . "\\<case\\>")
213        ("d=" . nil))
214      "Symbols that should behave somewhat like close parens.")
215    
216    (defconst sml-agglomerate-re "\\<else[ \t]+if\\>"
217      "Regexp of compound symbols (pairs of symbols to be considered as one).")
218    
219    (defconst sml-non-nested-of-starter-re
220      (sml-syms-re "datatype" "abstype" "exception")
221      "Symbols that can introduce an `of' that shouldn't behave like a paren.")
222    
223  (defconst sml-starters-syms  (defconst sml-starters-syms
224    (append sml-module-head-syms    (append sml-module-head-syms
225            '("abstype" "datatype" "exception" "fun"            '("abstype" "datatype" "exception" "fun"
# Line 206  Line 230 
230  (defconst sml-starters-re (sml-syms-re sml-starters-syms))  (defconst sml-starters-re (sml-syms-re sml-starters-syms))
231    
232  (defconst sml-exptrail-syms  (defconst sml-exptrail-syms
233    '("if" "then" "else" "while" "do" "case" "of" "raise" "fn"))    '("if" "then" "else" "while" "withtype" "do" "case" "of" "raise" "fn"))
234    
235  (defconst sml-pipehead-re  (defconst sml-pipehead-re
236    (sml-syms-re "fun" "fn" "and" "handle" "case" "datatype" "abstype")    (concat
237       "|\\S.\\|"
238       (sml-syms-re "of" "fun" "fn" "and" "handle" "datatype" "abstype"))
239    "A `|' corresponds to one of these.")    "A `|' corresponds to one of these.")
240    
241  ;;  ;;

Legend:
Removed from v.333  
changed lines
  Added in v.334

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