comparison src/elisp/urweb-defs.el @ 446:86c063fedc4d

Parsing 'let'
author Adam Chlipala <adamc@hcoop.net>
date Sat, 01 Nov 2008 10:47:10 -0400
parents cca935276869
children f542bc3133dc
comparison
equal deleted inserted replaced
445:dfc8c991abd0 446:86c063fedc4d
89 (defconst urweb-module-head-syms 89 (defconst urweb-module-head-syms
90 '("signature" "structure" "functor")) 90 '("signature" "structure" "functor"))
91 91
92 92
93 (defconst urweb-begin-syms 93 (defconst urweb-begin-syms
94 '("struct" "sig") 94 '("let" "struct" "sig")
95 "Symbols matching the `end' symbol.") 95 "Symbols matching the `end' symbol.")
96 96
97 (defconst urweb-begin-syms-re 97 (defconst urweb-begin-syms-re
98 (urweb-syms-re urweb-begin-syms) 98 (urweb-syms-re urweb-begin-syms)
99 "Symbols matching the `end' symbol.") 99 "Symbols matching the `end' symbol.")
101 ;; (defconst urweb-user-begin-symbols-re 101 ;; (defconst urweb-user-begin-symbols-re
102 ;; (urweb-syms-re "let" "abstype" "local" "struct" "sig" "in" "with") 102 ;; (urweb-syms-re "let" "abstype" "local" "struct" "sig" "in" "with")
103 ;; "Symbols matching (loosely) the `end' symbol.") 103 ;; "Symbols matching (loosely) the `end' symbol.")
104 104
105 (defconst urweb-sexp-head-symbols-re 105 (defconst urweb-sexp-head-symbols-re
106 (urweb-syms-re "struct" "sig" "with" 106 (urweb-syms-re "let" "struct" "sig" "in" "with"
107 "if" "then" "else" "case" "of" "fn" "fun" "val" "and" 107 "if" "then" "else" "case" "of" "fn" "fun" "val" "and"
108 "datatype" "type" "open" "include" 108 "datatype" "type" "open" "include"
109 urweb-module-head-syms 109 urweb-module-head-syms
110 "con" "fold" "where" "extern" "constraint" "constraints" 110 "con" "fold" "where" "extern" "constraint" "constraints"
111 "table" "sequence" "class") 111 "table" "sequence" "class")
112 "Symbols starting an sexp.") 112 "Symbols starting an sexp.")
113 113
114 ;; (defconst urweb-not-arg-start-re 114 ;; (defconst urweb-not-arg-start-re
115 ;; (urweb-syms-re "in" "of" "end" "andalso") 115 ;; (urweb-syms-re "in" "of" "end" "andalso")
116 ;; "Symbols that can't be found at the head of an arg.") 116 ;; "Symbols that can't be found at the head of an arg.")
131 (urweb-preproc-alist 131 (urweb-preproc-alist
132 `((,urweb-module-head-syms "d=" 0) 132 `((,urweb-module-head-syms "d=" 0)
133 ("if" "else" 0) 133 ("if" "else" 0)
134 (,urweb-=-starter-syms nil) 134 (,urweb-=-starter-syms nil)
135 (("case" "datatype" "if" "then" "else" 135 (("case" "datatype" "if" "then" "else"
136 "open" "sig" "struct" "type" "val" 136 "let" "open" "sig" "struct" "type" "val"
137 "con" "constraint" "table" "sequence" "class"))))) 137 "con" "constraint" "table" "sequence" "class")))))
138 138
139 (defconst urweb-starters-indent-after 139 (defconst urweb-starters-indent-after
140 (urweb-syms-re "struct" "sig") 140 (urweb-syms-re "let" "in" "struct" "sig")
141 "Indent after these.") 141 "Indent after these.")
142 142
143 (defconst urweb-delegate 143 (defconst urweb-delegate
144 (urweb-preproc-alist 144 (urweb-preproc-alist
145 `((("of" "else" "then" "with" "d=") . (not (urweb-bolp))) 145 `((("of" "else" "then" "with" "d=") . (not (urweb-bolp)))
162 :group 'urweb 162 :group 'urweb
163 :type '(repeat (cons string integer))) 163 :type '(repeat (cons string integer)))
164 164
165 (defconst urweb-open-paren 165 (defconst urweb-open-paren
166 (urweb-preproc-alist 166 (urweb-preproc-alist
167 `((,(list* urweb-begin-syms) ,urweb-begin-syms-re "\\<end\\>"))) 167 `((,(list* "in" urweb-begin-syms) ,urweb-begin-syms-re "\\<end\\>")))
168 "Symbols that should behave somewhat like opening parens.") 168 "Symbols that should behave somewhat like opening parens.")
169 169
170 (defconst urweb-close-paren 170 (defconst urweb-close-paren
171 `(("end" ,urweb-begin-syms-re) 171 `(("in" "\\<let\\>")
172 ("end" ,urweb-begin-syms-re)
172 ("then" "\\<if\\>") 173 ("then" "\\<if\\>")
173 ("else" "\\<if\\>" (urweb-bolp)) 174 ("else" "\\<if\\>" (urweb-bolp))
174 ("of" "\\<case\\>") 175 ("of" "\\<case\\>")
175 ("</xml>" "<xml>") 176 ("</xml>" "<xml>")
176 ("d=" nil)) 177 ("d=" nil))