branch: elpa/haskell-tng-mode commit 907c8fadcfdd3a78dfedffab30be16c437b9dee0 Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
ImplicitParams indentation --- haskell-tng-rx.el | 4 ++- test/haskell-tng-indent-test.el | 1 - test/haskell-tng-syntax-test.el | 2 ++ test/src/indentation.hs | 5 +++ test/src/indentation.hs.append.indent | 10 ++++++ test/src/indentation.hs.insert.indent | 10 ++++++ test/src/indentation.hs.layout | 7 +++- test/src/indentation.hs.lexer | 7 +++- test/src/indentation.hs.reindent | 12 ++++++- test/src/indentation.hs.sexps | 9 +++-- test/src/indentation.hs.syntax | 67 +++++++++++++++++++++++++++++++++++ 11 files changed, 127 insertions(+), 7 deletions(-) diff --git a/haskell-tng-rx.el b/haskell-tng-rx.el index a5135a7..bf090bd 100644 --- a/haskell-tng-rx.el +++ b/haskell-tng-rx.el @@ -88,7 +88,9 @@ give false positives." `(| (defconst haskell-tng:regexp:conid (rx-to-string `(: word-start ,haskell-tng:rx:conid))) (defconst haskell-tng:regexp:varid - (rx-to-string `(: word-start ,haskell-tng:rx:varid))) + (rx-to-string `(| (: word-start ,haskell-tng:rx:varid) + (: symbol-start (char ??) ,haskell-tng:rx:varid) ;; ImplicitParams + ))) (defconst haskell-tng:regexp:symid (rx-to-string haskell-tng:rx:symid)) (defconst haskell-tng:regexp:toplevel diff --git a/test/haskell-tng-indent-test.el b/test/haskell-tng-indent-test.el index e8643e6..977bc6e 100644 --- a/test/haskell-tng-indent-test.el +++ b/test/haskell-tng-indent-test.el @@ -17,7 +17,6 @@ ;; TODO long type signatures vs definitions ;; TODO if/then/else ;; TODO following opening bracket in a record defn, shouldn't indent so much -;; TODO ImplicitParams in let ;; Three indentation regression tests are possible: ;; diff --git a/test/haskell-tng-syntax-test.el b/test/haskell-tng-syntax-test.el index efb2e5a..c8a64a4 100644 --- a/test/haskell-tng-syntax-test.el +++ b/test/haskell-tng-syntax-test.el @@ -53,6 +53,8 @@ (should (have-expected-syntax (testdata "src/medley.hs"))) (should (have-expected-syntax (testdata "src/layout.hs"))) + + (should (have-expected-syntax (testdata "src/indentation.hs"))) ) ;;; haskell-tng-syntax-test.el ends here diff --git a/test/src/indentation.hs b/test/src/indentation.hs index 74df4bd..42cb7b4 100644 --- a/test/src/indentation.hs +++ b/test/src/indentation.hs @@ -47,6 +47,11 @@ let_in a b = let in flibble blah +implicit_let foo bar = + let ?foo = foo + ?bar = bar + in rar + case_of wibble = case wibble of Nothing -> "" Just fish -> fish diff --git a/test/src/indentation.hs.append.indent b/test/src/indentation.hs.append.indent index 4d7ad5c..3d8ddab 100644 --- a/test/src/indentation.hs.append.indent +++ b/test/src/indentation.hs.append.indent @@ -96,6 +96,16 @@ let_in a b = let 2 v 1 1 v 2 +implicit_let foo bar = +1 v + let ?foo = foo +1 v + ?bar = bar +1 v + in rar +v 1 2 + +v 1 2 case_of wibble = case wibble of 1 v Nothing -> "" diff --git a/test/src/indentation.hs.insert.indent b/test/src/indentation.hs.insert.indent index 57835ab..a82b222 100644 --- a/test/src/indentation.hs.insert.indent +++ b/test/src/indentation.hs.insert.indent @@ -96,6 +96,16 @@ let_in a b = let 2 v 1 1 v 2 +implicit_let foo bar = +1 v 2 + let ?foo = foo +1 v + ?bar = bar +2 1 v + in rar +v 1 2 + +v 1 2 case_of wibble = case wibble of 1 v Nothing -> "" diff --git a/test/src/indentation.hs.layout b/test/src/indentation.hs.layout index 93e42c6..a23d743 100644 --- a/test/src/indentation.hs.layout +++ b/test/src/indentation.hs.layout @@ -47,7 +47,12 @@ module Indentation where ;in flibble blah -};case_of wibble = case wibble of +};implicit_let foo bar = + let {?foo = foo + ;?bar = bar + }in rar + +;case_of wibble = case wibble of {Nothing -> "" ;Just fish -> fish diff --git a/test/src/indentation.hs.lexer b/test/src/indentation.hs.lexer index 1e34f64..81e8b7b 100644 --- a/test/src/indentation.hs.lexer +++ b/test/src/indentation.hs.lexer @@ -47,7 +47,12 @@ where ; in VARID VARID -} ; VARID VARID = case VARID of +} ; VARID VARID VARID = +let { VARID = VARID +; VARID = VARID +} in VARID + +; VARID VARID = case VARID of { CONID -> ยง ; CONID VARID -> VARID diff --git a/test/src/indentation.hs.reindent b/test/src/indentation.hs.reindent index 8383795..a8f3fce 100644 --- a/test/src/indentation.hs.reindent +++ b/test/src/indentation.hs.reindent @@ -96,7 +96,17 @@ v 1 2 flibble blah 2 v 1 -v 1 2 +v 2 3 1 +implicit_let foo bar = +v 1 + let ?foo = foo +v 2 1 + ?bar = bar +v 1 + in rar +v 1 2 + +v 1 2 case_of wibble = case wibble of 1 v Nothing -> "" diff --git a/test/src/indentation.hs.sexps b/test/src/indentation.hs.sexps index f07a653..eea2d64 100644 --- a/test/src/indentation.hs.sexps +++ b/test/src/indentation.hs.sexps @@ -47,7 +47,12 @@ )in) (flibble) (blah) -)(case_of) (wibble) = ((case (wibble) (of) +)(implicit_let) (foo) (bar) = + (let ((?foo) = (foo) + ((?bar) = (bar)) + )in) (rar) + +((case_of) (wibble) = ((case (wibble) (of) ((Nothing) -> ("") ((Just) (fish) -> (fish)) @@ -59,5 +64,5 @@ ("") ("") ("") ((dollars) (f) ((Just) (a)) = (f) $ (\)(s) -> - (a)))))))))) + (a))))))))))) ))) \ No newline at end of file diff --git a/test/src/indentation.hs.syntax b/test/src/indentation.hs.syntax new file mode 100644 index 0000000..17e596e --- /dev/null +++ b/test/src/indentation.hs.syntax @@ -0,0 +1,67 @@ +_ _ wwwwwwwww wwwwwwwwwww wwwwwwwww.> +__> +__ wwww www wwwwwwwwww wwwwwwwww ww (ww_)wwwwwwwwwww www ww wwwwwwwwww wwww.> +__> +__ wwwww wwwwww "wwwwww wwwwwwwwww" wwwwwwww wwwww ww wwwwww www wwww ww> +__ ww_wwwwww wwwwwww ww wwww wwwwwww www wwwwwwwwww. ww wwww ww wwwww wwwww.> +__ ww wwwww wwwwwww www wwwww wwww wwwwwwww wwwwwwwwwww (w.w. ww ww wwww wwww> +__ www www ww w wwww ww wwww wwwwwwwww wwwwwww. wwww ww wwwwwwww wwww ww> +__ wwwwwwww wwww wwww wwwwwww ww wwwww w www www)_> +wwwwww wwwwwwwwwww wwwww> +> +wwwwww www.www> +wwwwww www.www wwwwww ( www.> + www> + )> +> +wwwwwwww _ ww> + www __ wwww wwww wwww> + www __ wwww wwww> + wwww __ wwwwww wwwwwwwwww> + wwww __ wwwwww wwwwwwwwww> + wwwwwwwwww> + wwwwwwwwwww wwww> + www www _ wwww wwww> + wwww __ wwwwww wwwwwwwwww> + www _ wwww> + www _> + wwww> + wwww www __ wwwwww wwwwwwwwww> +> +wwwwwwwww _ __ wwwwww wwwwwwwwww> + ww www __ wwww> + ww www __ wwww __ wwww wwwww ww www> + www __ wwww wwwww ww www> +> +wwwwwwwwwwww w w _ www w w> + wwwww __ wwwwww wwwwwwwwww> + www _ www www __ wwwwwwww> + www _ wwww wwww __ wwww wwwww ww www> + wwwww __ wwwwww wwwwwwwwww> + www w _ wwww __ wwwwwwww> + www _ wwww __ wwww wwwww ww www> +> +wwwwww w w _ www> + wwww _ wwww> + wwwwww w _ wwww> + ww> + wwwwwww wwww> +> +wwwwwwwwwwww www www _> + www _www _ www> + _www _ www> + ww www> +> +wwwwwww wwwwww _ wwww wwwwww ww> + wwwwwww __ ""> + wwww wwww __ wwww> +> +wwwwwwwwwww _ _wwww> + wwwwwww __ ""> + wwww wwww __ wwww> +> +wwwwwww w wwwwwww _ w _> + "" ""> + ""> +wwwwwww w (wwww w) _ w _ _w __> + w>