Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
444 lines (419 sloc) 23.3 KB
--- tuareg-2.0.4/tuareg.el 2010-11-14 15:22:06.000000000 +0100
+++ tuareg-2.0.4-lwt/tuareg.el 2012-05-09 18:02:04.811798035 +0200
@@ -1046,7 +1046,7 @@
'("module" "class" "functor" "object" "type" "val" "inherit"
"include" "virtual" "constraint" "exception" "external" "open"
"method" "and" "initializer" "to" "downto" "do" "done" "else"
- "begin" "end" "let" "in" "then" "with"))
+ "begin" "end" "let" "lwt" "in" "then" "with"))
(setq abbrevs-changed nil))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1174,39 +1174,39 @@
(setq
tuareg-font-lock-keywords
`(,@(and (tuareg-editing-ls3)
- '(("\\<\\(let[ \t\n]+\\(clock\\|node\\|static\\)\\|present\\|automaton\\|where\\|match\\|with\\|do\\|done\\|unless\\|until\\|reset\\|every\\)\\>"
+ '(("\\<\\(let[ \t\n]+\\(clock\\|node\\|static\\)\\|present\\|automaton\\|where\\|match\\|match_lwt\\|with\\|do\\|done\\|unless\\|until\\|reset\\|every\\)\\>"
0 tuareg-font-lock-governing-face nil nil)))
- ("\\<\\(external\\|open\\|include\\|rule\\|s\\(ig\\|truct\\)\\|module\\|functor\\|with[ \t\n]+\\(type\\|module\\)\\|val\\|type\\|method\\|virtual\\|constraint\\|class\\|in\\|inherit\\|initializer\\|let\\|rec\\|object\\|and\\|begin\\|end\\)\\>"
+ ("\\<\\(external\\|open\\|include\\|rule\\|s\\(ig\\|truct\\)\\|module\\|functor\\|with[ \t\n]+\\(type\\|module\\)\\|val\\|type\\|method\\|virtual\\|constraint\\|class\\|in\\|inherit\\|initializer\\|let\\|lwt\\|rec\\|object\\|and\\|begin\\|end\\)\\>"
0 tuareg-font-lock-governing-face nil nil)
,@(and tuareg-support-metaocaml
'(("\\.<\\|>\\.\\|\\.~\\|\\.!"
0 tuareg-font-lock-multistage-face nil nil)))
("\\<\\(false\\|true\\)\\>" 0 font-lock-constant-face nil nil)
- ("\\<\\(as\\|do\\(ne\\|wnto\\)?\\|else\\|for\\|if\\|mutable\\|new\\|p\\(arser\\|rivate\\)\\|t\\(hen\\|o\\|ry\\)\\|wh\\(en\\|ile\\)\\|match\\|with\\|lazy\\|exception\\|raise\\|failwith[f]?\\|exit\\|assert\\|fun\\(ction\\)?\\)\\>"
+ ("\\<\\(as\\|do\\(ne\\|wnto\\)?\\|else\\|for\\|for_lwt\\|if\\|mutable\\|new\\|p\\(arser\\|rivate\\)\\|t\\(hen\\|o\\|ry\\)\\|try_lwt\\|finally\\|raise_lwt\\|assert_lwt\\|wh\\(en\\|ile\\)\\|match\\|match_lwt\\|with\\|lazy\\|exception\\|raise\\|failwith[f]?\\|exit\\|assert\\|fun\\(ction\\)?\\)\\>"
0 font-lock-keyword-face nil nil)
,@(if (tuareg-editing-ls3)
'(("\\<\\(merge\\|when\\|emit\\|period\\)\\>"
0 font-lock-keyword-face nil nil)
("[][;,()|{}]\\|[@^!:*=<>&/%+~?#---]\\.?\\|\\.\\.\\.*\\|\\<\\(asr\\|asl\\|lsr\\|lsl\\|l?or\\|l?and\\|lxor\\|l?not\\|mod\\|of\\|ref\\|fby\\|pre\\|last\\|at\\)\\>"
0 tuareg-font-lock-operator-face nil nil)
- ("\\<\\(\\(method\\([ \t\n]+\\(private\\|virtual\\)\\)?\\)\\([ \t\n]+virtual\\)?\\|val\\([ \t\n]+mutable\\)?\\|external\\|and\\|class\\|let\\([ \t\n]+\\(rec\\|clock\\|node\\|static\\)\\)?\\)\\>[ \t\n]*\\(['_[:lower:]]\\(\\w\\|[._]\\)*\\)\\>[ \t\n]*\\(\\(\\w\\|[()_?~.'*:--->]\\)+\\|=[ \t\n]*fun\\(ction\\)?\\>\\)"
+ ("\\<\\(\\(method\\([ \t\n]+\\(private\\|virtual\\)\\)?\\)\\([ \t\n]+virtual\\)?\\|val\\([ \t\n]+mutable\\)?\\|external\\|and\\|class\\|let\\|lwt\\([ \t\n]+\\(rec\\|clock\\|node\\|static\\)\\)?\\)\\>[ \t\n]*\\(['_[:lower:]]\\(\\w\\|[._]\\)*\\)\\>[ \t\n]*\\(\\(\\w\\|[()_?~.'*:--->]\\)+\\|=[ \t\n]*fun\\(ction\\)?\\>\\)"
9 font-lock-function-name-face keep nil))
'(("[][;,()|{}]\\|[@^!:*=<>&/%+~?#---]\\.?\\|\\.\\.\\.*\\|\\<\\(asr\\|asl\\|lsr\\|lsl\\|l?or\\|l?and\\|lxor\\|l?not\\|mod\\|of\\|ref\\)\\>"
0 tuareg-font-lock-operator-face nil nil)
- ("\\<\\(\\(method\\([ \t\n]+\\(private\\|virtual\\)\\)?\\)\\([ \t\n]+virtual\\)?\\|val\\([ \t\n]+mutable\\)?\\|external\\|and\\|class\\|let\\([ \t\n]+rec\\)?\\)\\>[ \t\n]*\\(['_[:lower:]]\\(\\w\\|[._]\\)*\\)\\>[ \t\n]*\\(\\(\\w\\|[()_?~.'*:--->]\\)+\\|=[ \t\n]*fun\\(ction\\)?\\>\\)"
+ ("\\<\\(\\(method\\([ \t\n]+\\(private\\|virtual\\)\\)?\\)\\([ \t\n]+virtual\\)?\\|val\\([ \t\n]+mutable\\)?\\|external\\|and\\|class\\|let\\|lwt\\([ \t\n]+rec\\)?\\)\\>[ \t\n]*\\(['_[:lower:]]\\(\\w\\|[._]\\)*\\)\\>[ \t\n]*\\(\\(\\w\\|[()_?~.'*:--->]\\)+\\|=[ \t\n]*fun\\(ction\\)?\\>\\)"
8 font-lock-function-name-face keep nil)))
("\\<method\\([ \t\n]+\\(private\\|virtual\\)\\)?\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)"
3 font-lock-function-name-face keep nil)
("\\<\\(fun\\(ction\\)?\\)\\>[ \t\n]*\\(\\(\\w\\|[_ \t()*,]\\)+\\)"
3 font-lock-variable-name-face keep nil)
,@(if (tuareg-editing-ls3)
- '(("\\<\\(reset\\|do\\|val\\([ \t\n]+mutable\\)?\\|external\\|and\\|class\\|let\\([ \t\n]+rec\\)?\\)\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)"
+ '(("\\<\\(reset\\|do\\|val\\([ \t\n]+mutable\\)?\\|external\\|and\\|class\\|let\\|lwt\\([ \t\n]+rec\\)?\\)\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)"
4 font-lock-variable-name-face keep nil)
- ("\\<\\(reset\\|do\\|val\\([ \t\n]+mutable\\)?\\|external\\|method\\|and\\|class\\|let\\([ \t\n]+\\(rec\\|clock\\|node\\|static\\)\\)?\\)\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)\\>\\(\\(\\w\\|[->_ \t,?~.]\\|(\\(\\w\\|[--->_ \t,?~.=]\\)*)\\)*\\)"
+ ("\\<\\(reset\\|do\\|val\\([ \t\n]+mutable\\)?\\|external\\|method\\|and\\|class\\|let\\|lwt\\([ \t\n]+\\(rec\\|clock\\|node\\|static\\)\\)?\\)\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)\\>\\(\\(\\w\\|[->_ \t,?~.]\\|(\\(\\w\\|[--->_ \t,?~.=]\\)*)\\)*\\)"
7 font-lock-variable-name-face keep nil))
- '(("\\<\\(val\\([ \t\n]+mutable\\)?\\|external\\|and\\|class\\|let\\([ \t\n]+rec\\)?\\)\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)"
+ '(("\\<\\(val\\([ \t\n]+mutable\\)?\\|external\\|and\\|class\\|let\\|lwt\\([ \t\n]+rec\\)?\\)\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)"
4 font-lock-variable-name-face keep nil)
- ("\\<\\(val\\([ \t\n]+mutable\\)?\\|external\\|method\\|and\\|class\\|let\\([ \t\n]+rec\\)?\\)\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)\\>\\(\\(\\w\\|[->_ \t,?~.]\\|(\\(\\w\\|[--->_ \t,?~.=]\\)*)\\)*\\)"
+ ("\\<\\(val\\([ \t\n]+mutable\\)?\\|external\\|method\\|and\\|class\\|let\\|lwt\\([ \t\n]+rec\\)?\\)\\>[ \t\n]*\\(\\(\\w\\|[_,?~.]\\)*\\)\\>\\(\\(\\w\\|[->_ \t,?~.]\\|(\\(\\w\\|[--->_ \t,?~.=]\\)*)\\)*\\)"
6 font-lock-variable-name-face keep nil)))
( "\\<\\(open\\|\\(class\\([ \t\n]+type\\)?\\)\\([ \t\n]+virtual\\)?\\|inherit\\|include\\|module\\([ \t\n]+\\(type\\|rec\\)\\)?\\|type\\)\\>[ \t\n]*\\(['~?]*\\([_--->.* \t]\\|\\w\\|(['~?]*\\([_--->.,* \t]\\|\\w\\)*)\\)*\\)"
7 font-lock-type-face keep nil)
@@ -1347,7 +1347,8 @@
"else" "exception" "external" "to" "then" "try" "type"
"virtual" "val" "while" "when" "with" "if" "in" "inherit"
"for" "fun" "functor" "function" "let" "do" "downto"
- "parse" "parser" "rule" "of")
+ "parse" "parser" "rule" "of"
+ "lwt" "match_lwt" "try_lwt" "for_lwt" "while_lwt" "finally")
"\\|->\\|[;,|]")
"Regexp for all recognized keywords.")
@@ -1405,7 +1406,7 @@
(defconst tuareg-matching-kwop-regexp
(concat tuareg-matching-keyword-regexp
- "\\|\\<with\\>\\|[|>]?\\]\\|>?}\\|[|)]\\|;;")
+ "\\|\\<\\(with\\|finally\\)\\>\\|[|>]?\\]\\|>?}\\|[|)]\\|;;")
"Regexp matching Caml keywords or operators which act as end block delimiters.")
(defconst tuareg-matching-kwop-regexp-ls3
@@ -1419,7 +1420,7 @@
tuareg-matching-kwop-regexp))
(defconst tuareg-block-regexp
- (concat (tuareg-ro "for" "while" "do" "if" "begin" "sig" "struct" "object")
+ (concat (tuareg-ro "for" "for_lwt" "while" "while_lwt" "do" "if" "begin" "sig" "struct" "object")
"\\|[][(){}]\\|\\*)"))
(defconst tuareg-find-kwop-regexp
@@ -1427,7 +1428,7 @@
(defconst tuareg-find-kwop-regexp-ls3
(concat tuareg-find-kwop-regexp "\\|"
- (tuareg-ro "where" "automaton" "present" "match")))
+ (tuareg-ro "where" "automaton" "present" "match" "match_lwt")))
(defun tuareg-give-find-kwop-regexp ()
(if (tuareg-editing-ls3)
@@ -1436,7 +1437,7 @@
(defconst tuareg-governing-phrase-regexp
(tuareg-ro "val" "type" "method" "module" "constraint" "class" "inherit"
- "initializer" "external" "exception" "open" "let" "object"
+ "initializer" "external" "exception" "open" "let" "lwt" "object"
"include")
"Regexp matching tuareg phrase delimitors.")
@@ -1450,7 +1451,9 @@
("begin" . tuareg-begin-indent)
(".<" . tuareg-begin-indent)
("for" . tuareg-for-while-indent)
+ ("for_lwt" . tuareg-for-while-indent)
("while" . tuareg-for-while-indent)
+ ("while_lwt" . tuareg-for-while-indent)
("do" . tuareg-do-indent)
("val" . tuareg-val-indent)
("fun" . tuareg-fun-indent)
@@ -1458,8 +1461,12 @@
("then" . tuareg-if-then-else-indent)
("else" . tuareg-if-then-else-indent)
("let" . tuareg-let-indent)
+ ("lwt" . tuareg-let-indent)
("match" . tuareg-match-indent)
+ ("match_lwt" . tuareg-match-indent)
("try" . tuareg-try-indent)
+ ("try_lwt" . tuareg-try-indent)
+ ("finally" . tuareg-try-indent)
("rule" . tuareg-rule-indent)
;; Case match keywords
@@ -1492,6 +1499,7 @@
("in" . tuareg-find-in-match)
("where" . tuareg-find-in-match)
("with" . tuareg-find-with-match)
+ ("finally" . tuareg-find-with-match)
("else" . tuareg-find-else-match)
("then" . tuareg-find-then-match)
("do" . tuareg-find-do-match)
@@ -1503,7 +1511,7 @@
(defun tuareg-find-leading-kwop-match (kwop)
(funcall (cdr (assoc kwop tuareg-leading-kwop-alist))))
-(defconst tuareg-binding-regexp "\\(\\<and\\>\\|(*\\<let\\>\\)")
+(defconst tuareg-binding-regexp "\\(\\<and\\>\\|(*\\<let\\>\\|(*\\<lwt\\>\\)")
(defun tuareg-assoc-indent (kwop &optional look-for-let-or-and)
"Return relative indentation of the keyword given in argument."
@@ -1577,11 +1585,12 @@
(defconst tuareg-find-and-match-regexp
(concat (tuareg-ro "do" "done" "else" "end" "in" "then" "down" "downto"
"for" "while" "do" "if" "begin" "sig" "struct" "class"
- "rule" "exception" "let" "in" "type" "val" "module")
+ "rule" "exception" "let" "in" "type" "val" "module"
+ "lwt" "try_lwt" "for_lwt" "while_lwt" "finally")
"\\|[][(){}]\\|\\*)"))
(defconst tuareg-find-phrase-beginning-regexp
(concat (tuareg-ro "end" "type" "module" "sig" "struct" "class"
- "exception" "open" "let")
+ "exception" "open" "let" "lwt")
"\\|^#[ \t]*[a-z][_a-z]*\\>\\|;;"))
(defconst tuareg-find-phrase-beginning-and-regexp
(concat "\\<\\(and\\)\\>\\|" tuareg-find-phrase-beginning-regexp))
@@ -1604,35 +1613,35 @@
(setq
tuareg-find-comma-match-regexp
(tuareg-make-find-kwop-regexp
- (concat (tuareg-ro "and" "match" "begin" "else" "exception" "then" "try"
- "with" "or" "fun" "function" "let" "do")
+ (concat (tuareg-ro "and" "match" "match_lwt" "begin" "else" "exception" "then" "try" "try_lwt"
+ "with" "or" "fun" "function" "let" "lwt" "do" "finally")
"\\|->\\|[[{(]"))
tuareg-find-with-match-regexp
(tuareg-make-find-kwop-regexp
- (concat (tuareg-ro "match" "try" "module" "begin" "with" "type")
+ (concat (tuareg-ro "match" "match_lwt" "try" "try_lwt" "module" "begin" "with" "type" "finally")
"\\|[[{(]"))
tuareg-find-in-match-regexp
- (tuareg-make-find-kwop-regexp (tuareg-ro "let" "open"))
+ (tuareg-make-find-kwop-regexp (tuareg-ro "let" "lwt" "open"))
tuareg-find-else-match-regexp
(tuareg-make-find-kwop-regexp ";")
tuareg-find-do-match-regexp
(tuareg-make-find-kwop-regexp "->")
tuareg-find-=-match-regexp
(tuareg-make-find-kwop-regexp
- (concat (tuareg-ro "val" "let" "method" "module" "type" "class" "when"
+ (concat (tuareg-ro "val" "let" "lwt" "method" "module" "type" "class" "when"
"if" "in" "do")
"\\|="))
tuareg-find-pipe-match-regexp
(tuareg-make-find-kwop-regexp (tuareg-give-match-pipe-kwop-regexp))
tuareg-find-arrow-match-regexp
(tuareg-make-find-kwop-regexp
- (concat (tuareg-ro "external" "type" "val" "method" "let" "with" "fun"
+ (concat (tuareg-ro "external" "type" "val" "method" "let" "lwt" "with" "fun"
"function" "functor" "class" "parser")
"\\|[|;]"))
tuareg-find-semicolon-match-regexp
(tuareg-make-find-kwop-regexp
(concat ";" tuareg-no-more-code-this-line-regexp "\\|->\\|"
- (tuareg-ro "let" "method" "with" "try" "initializer")))
+ (tuareg-ro "let" "lwt" "method" "with" "try" "try_lwt" "initializer" "finally")))
tuareg-find-phrase-indentation-regexp
(tuareg-make-find-kwop-regexp
(concat tuareg-governing-phrase-regexp "\\|" (tuareg-ro "and" "every")))
@@ -1651,7 +1660,7 @@
(concat tuareg-find-comma-match-regexp "\\|=")
tuareg-find-monadic-match-regexp
(concat tuareg-block-regexp "\\|\\([;=]\\)\\|\\(->\\)\\|"
- (tuareg-ro "val" "let" "method" "module" "type" "class" "when"
+ (tuareg-ro "val" "let" "lwt" "method" "module" "type" "class" "when"
"if" "in" "do" "done" "end"))))
(defun tuareg-strip-trailing-whitespace (string)
@@ -1838,7 +1847,8 @@
((string= kwop2 "and")
(tuareg-find-and-match))
((and (string= kwop "module")
- (string= kwop2 "let"))
+ (or (string= kwop2 "let")
+ (string= kwop2 "lwt")))
kwop2)
(t (goto-char old-point) kwop))))
(t kwop))))
@@ -1873,7 +1883,7 @@
(looking-at tuareg-if-when-regexp)))
(defconst tuareg-captive-regexp
- (tuareg-ro "let" "if" "when" "module" "type" "class"))
+ (tuareg-ro "let" "lwt" "if" "when" "module" "type" "class"))
(defun tuareg-captive-= ()
(save-excursion
(tuareg-find-=-match)
@@ -1955,7 +1965,7 @@
kwop)))))))
(defconst tuareg-semicolon-match-stop-regexp
- (tuareg-ro "and" "do" "end" "in" "with"))
+ (tuareg-ro "and" "do" "end" "in" "with" "finally"))
(defconst tuareg-no-code-after-paren-regexp
(tuareg-no-code-after "[[{(][|<]?"))
(defun tuareg-semicolon-indent-kwop-point (&optional leading-semi-colon)
@@ -2004,11 +2014,14 @@
((string= kwop "where")
(tuareg-find-in-match)
(+ (tuareg-paren-or-indentation-column) tuareg-in-indent))
- ((string= kwop "let")
+ ((or (string= kwop "let") (string= kwop "lwt"))
(+ (current-column) tuareg-let-indent))
((string= kwop "try")
(forward-char 3) (skip-syntax-forward " ")
(current-column))
+ ((string= kwop "try_lwt")
+ (forward-char 7) (skip-syntax-forward " ")
+ (current-column))
(t (tuareg-paren-or-indentation-indent)))
kwop point)))
@@ -2020,7 +2033,7 @@
(setq ,kwop (tuareg-find-and-match))))
(defconst tuareg-phrase-regexp-1 (tuareg-ro "module" "type"))
-(defconst tuareg-phrase-regexp-2 (tuareg-ro "and" "let" "module" "with"))
+(defconst tuareg-phrase-regexp-2 (tuareg-ro "and" "let" "lwt" "module" "with"))
(defconst tuareg-phrase-regexp-3
(tuareg-ro "and" "end" "every" "in" "with"))
(defun tuareg-find-phrase-indentation (&optional phrase-break)
@@ -2069,7 +2082,8 @@
(setq tmpkwop (tuareg-find-in-match))
(tuareg-reset-and-kwop tmpkwop)
(setq curr (point))
- (and (string= tmpkwop "let")
+ (and (or (string= tmpkwop "let")
+ (string= tmpkwop "lwt"))
(not (tuareg-looking-at-internal-let))))))
(goto-char curr)
(tuareg-find-phrase-indentation phrase-break))
@@ -2077,7 +2091,7 @@
(end-of-line)
(tuareg-skip-blank-and-comments)
(current-column))
- ((string= kwop "let")
+ ((or (string= kwop "let") (string= kwop "lwt"))
(if (tuareg-looking-at-internal-let)
(tuareg-find-phrase-indentation phrase-break)
(current-column)))
@@ -2122,16 +2136,18 @@
tuareg-back-to-paren-or-indentation-regexp
tuareg-paren-or-indentation-stop-regexp))
(retval))
- (when (string= kwop "with")
+ (when (or (string= kwop "with") (string= kwop "finally"))
(let ((with-point (point)))
(setq kwop (tuareg-find-with-match))
- (if (or (string= kwop "match") (string= kwop "try"))
+ (if (or (string= kwop "match") (string= kwop "match_lwt")
+ (string= kwop "try") (string= kwop "try_lwt"))
(tuareg-find-kwop tuareg-back-to-paren-or-indentation-regexp
"\\<and\\>")
(setq kwop "with") (goto-char with-point))))
(setq retval
(cond
((string= kwop "with") nil)
+ ((string= kwop "finally") nil)
((or (string= kwop "in") (string= kwop "do"))
(tuareg-in-indentation-p))
; ((looking-at "[[{(]") (tuareg-search-forward-paren) nil)
@@ -2166,8 +2182,8 @@
(defconst tuareg-internal-let-regexp
(concat "[[({;=]\\|"
- (tuareg-ro "begin" "open" "if" "in" "do" "try" "then" "else"
- "match" "while" "when")))
+ (tuareg-ro "begin" "open" "if" "in" "do" "try" "try_lwt" "then" "else"
+ "match" "match_lwt" "while" "while_lwt" "when")))
(defun tuareg-looking-at-internal-let ()
(save-excursion
(tuareg-find-meaningful-word)
@@ -2178,7 +2194,7 @@
(or (looking-at tuareg-internal-let-regexp)
(looking-at tuareg-operator-regexp)))))
-(defconst tuareg-false-module-regexp (tuareg-ro "and" "let" "with"))
+(defconst tuareg-false-module-regexp (tuareg-ro "and" "let" "lwt" "with"))
(defun tuareg-looking-at-false-module ()
(save-excursion
(tuareg-find-meaningful-word)
@@ -2302,7 +2318,9 @@
(goto-char matching-pos)
(tuareg-find-arrow-match) ; matching `val' or `let'
(+ (current-column) tuareg-val-indent))
- ((or (string= matching-kwop "val") (string= matching-kwop "let"))
+ ((or (string= matching-kwop "val")
+ (string= matching-kwop "let")
+ (string= matching-kwop "lwt"))
(+ (current-column) tuareg-val-indent))
((string= matching-kwop "|")
(goto-char matching-pos)
@@ -2338,7 +2356,8 @@
(tuareg-find-arrow-match)
(+ (current-column) tuareg-default-indent))
((or (string= kwop "val")
- (string= kwop "let"))
+ (string= kwop "let")
+ (string= kwop "lwt"))
(goto-char pos)
(+ (current-column) tuareg-val-indent))
((string= kwop "type")
@@ -2409,7 +2428,8 @@
(char-equal ?\{ (preceding-char))))
(tuareg-backward-char)
(tuareg-indent-from-paren t start-pos))
- ((and (looking-at "\\<let\\>") (string= mkwop "in"))
+ ((and (or (looking-at "\\<let\\>")
+ (looking-at "\\<lwt\\>")) (string= mkwop "in"))
(+ (current-column) tuareg-in-indent))
(t (+ (tuareg-paren-or-indentation-column)
(tuareg-assoc-indent mkwop)))))
@@ -2419,7 +2439,7 @@
(tuareg-indent-from-paren leading-operator start-pos)
(+ tuareg-default-indent
(tuareg-indent-from-paren leading-operator start-pos))))
- ((or (string= kwop "let") (string= kwop "and"))
+ ((or (string= kwop "let") (string= kwop "lwt") (string= kwop "and"))
(tuareg-back-to-paren-or-indentation)
(+ (tuareg-paren-or-indentation-indent)
(tuareg-assoc-indent kwop t)))
@@ -2458,13 +2478,19 @@
(+ (current-column) -3 tuareg-default-indent)
(skip-syntax-forward " ")
(+ (current-column) tuareg-default-indent)))
+ ((string= kwop "try_lwt")
+ (forward-char 7)
+ (if (looking-at tuareg-no-more-code-this-line-regexp)
+ (+ (current-column) -7 tuareg-default-indent)
+ (skip-syntax-forward " ")
+ (+ (current-column) tuareg-default-indent)))
(t (+ (if (tuareg-in-indentation-p)
(current-column)
(tuareg-paren-or-indentation-indent))
(tuareg-assoc-indent kwop t)))))
(defconst tuareg-=-indent-regexp-1
- (tuareg-ro "val" "let" "method" "module" "class" "when" "for" "if" "do"))
+ (tuareg-ro "val" "let" "lwt" "method" "module" "class" "when" "for" "for_lwt" "if" "do"))
(defun tuareg-compute-=-indent (start-pos)
(let ((current-column-module-type nil) (kwop1 (tuareg-find-=-match))
@@ -2510,7 +2536,7 @@
(current-column))
(defconst tuareg-definitions-regexp
- (tuareg-ro "and" "val" "type" "module" "class" "exception" "let")
+ (tuareg-ro "and" "val" "type" "module" "class" "exception" "let" "lwt")
"Regexp matching definition phrases.")
(defun tuareg-compute-normal-indent ()
@@ -2649,7 +2675,9 @@
(string= matching-kwop "struct"))
(tuareg-paren-or-indentation-indent))
((or (string= matching-kwop "try")
- (string= matching-kwop "match"))
+ (string= matching-kwop "try_lwt")
+ (string= matching-kwop "match")
+ (string= matching-kwop "match_lwt"))
(tuareg-compute-kwop-indent-general kwop matching-kwop))
(t (goto-char old-point)
(tuareg-compute-kwop-indent-general kwop matching-kwop))))
@@ -2668,6 +2696,7 @@
(and (string= kwop "end")
(tuareg-editing-ls3)
(or (string= matching-kwop "match")
+ (string= matching-kwop "match_lwt")
(string= matching-kwop "automaton")
(string= matching-kwop "present"))))
(if (tuareg-in-indentation-p)
@@ -2675,7 +2704,8 @@
(tuareg-paren-or-indentation-column)))
((string= kwop "in")
(+ (current-column)
- (tuareg-add-default-indent (string= matching-kwop "let"))))
+ (tuareg-add-default-indent (or (string= matching-kwop "let")
+ (string= matching-kwop "lwt")))))
((not (string= kwop "and")) ; pretty general case
(tuareg-compute-kwop-indent-general kwop matching-kwop))
((string= matching-kwop "with")
@@ -2737,7 +2767,7 @@
(t (current-column))))
((tuareg-in-literal-p)
(current-column))
- ((or (looking-at "\\<let\\>") (looking-at "\\<open\\>"))
+ ((or (looking-at "\\<let\\>") (looking-at "\\<lwt\\>") (looking-at "\\<open\\>"))
(if (tuareg-looking-at-internal-let)
(if (tuareg-looking-at-in-let)
(progn
@@ -2932,7 +2962,7 @@
(tuareg-find-kwop tuareg-find-phrase-beginning-regexp))
(while (and (> (point) (point-min)) (< (point) old-point)
(or (not (looking-at tuareg-find-phrase-beginning-and-regexp))
- (and (looking-at "\\<let\\>")
+ (and (or (looking-at "\\<let\\>") (looking-at "\\<lwt\\>"))
(tuareg-looking-at-internal-let))
(and (looking-at "\\<and\\>")
(save-excursion