[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 0d5e020 151/385: support LambdaCase
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 0d5e020 151/385: support LambdaCase |
Date: |
Tue, 5 Oct 2021 23:59:20 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 0d5e020efd4ecccfb75e7ced10bc7acee8fda1cc
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
support LambdaCase
---
haskell-tng-layout.el | 6 ++++--
haskell-tng-rx.el | 1 +
haskell-tng-smie.el | 7 ++++++-
test/haskell-tng-indent-test.el | 1 -
test/src/indentation.hs.append.indent | 8 ++++----
test/src/indentation.hs.insert.indent | 6 +++---
test/src/indentation.hs.layout | 6 +++---
test/src/indentation.hs.lexer | 8 ++++----
test/src/indentation.hs.reindent | 4 ++--
test/src/indentation.hs.sexps | 8 ++++----
test/src/medley.hs | 4 ++++
test/src/medley.hs.faceup | 4 ++++
test/src/medley.hs.layout | 4 ++++
test/src/medley.hs.lexer | 4 ++++
test/src/medley.hs.syntax | 4 ++++
15 files changed, 51 insertions(+), 24 deletions(-)
diff --git a/haskell-tng-layout.el b/haskell-tng-layout.el
index 9d2cd7f..106bccd 100644
--- a/haskell-tng-layout.el
+++ b/haskell-tng-layout.el
@@ -50,7 +50,6 @@ the layout engine."
;; TODO a visual debugging option would be great, showing virtuals as overlays
;; EXT:NonDecreasingIndentation
-;; EXT:LambdaCase
(defun haskell-tng-layout:virtuals-at-point ()
"List of virtual `{' `}' and `;' at point, according to the
@@ -99,7 +98,10 @@ Designed to be called repeatedly, managing its own caching."
(while (not (eobp))
(forward-comment (point-max))
(cond
- ((looking-at (rx word-start (| "where" "let" "do" "of") word-end))
+ ((looking-at (rx symbol-start
+ (| "\\case" ;; LambdaCase
+ "where" "let" "do" "of")
+ word-end))
(goto-char (match-end 0))
(forward-comment (point-max))
(when (not (looking-at "{"))
diff --git a/haskell-tng-rx.el b/haskell-tng-rx.el
index eb4ab74..a5135a7 100644
--- a/haskell-tng-rx.el
+++ b/haskell-tng-rx.el
@@ -39,6 +39,7 @@ give false positives." `(|
"infixr" "instance" "let" "module" "newtype" "of"
"then" "type" "where" "_")
word-end)
+ (: symbol-start "\\case" word-end) ;; LambdaCase
(: "{..}") ;; RecordWildCards
(: word-start "':" symbol-end) ;; DataKinds (consider foo':bar)
(: ,(if hack
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index 1ed75d7..476e837 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -76,7 +76,9 @@
("let" blk "in")
("let" blk)
("do" blk)
- ("case" id "of" blk))
+ ("case" id "of" blk)
+ ("\\case" blk) ;; LambdaCase
+ )
(blk
("{" blk "}")
(blk ";" blk)
@@ -163,6 +165,7 @@ information, to aid in the creation of new rules."
(:after
(pcase arg
((or "let" "do" "of" "=" "in") 2)
+ ("\\case" 2) ;; LambdaCase
("where" (if (smie-rule-parent-p "module") 0 2))
))
@@ -180,6 +183,8 @@ information, to aid in the creation of new rules."
;; bloo = blu
((or "{" "where" "let" "do" "case")
(smie-rule-parent))
+ ("\\case" ;; LambdaCase
+ (smie-rule-parent))
))
))
diff --git a/test/haskell-tng-indent-test.el b/test/haskell-tng-indent-test.el
index 609423d..3ed324b 100644
--- a/test/haskell-tng-indent-test.el
+++ b/test/haskell-tng-indent-test.el
@@ -12,7 +12,6 @@
(require 'haskell-tng-testutils
"test/haskell-tng-testutils.el")
-;; TODO LambdaCase
;; TODO coproduct definitions, the | should align with =
;; TODO lists, records, tuples
;; TODO long type signatures vs definitions
diff --git a/test/src/indentation.hs.append.indent
b/test/src/indentation.hs.append.indent
index d5af495..e671bed 100644
--- a/test/src/indentation.hs.append.indent
+++ b/test/src/indentation.hs.append.indent
@@ -105,10 +105,10 @@ case_of wibble = case wibble of
1 v
lambda_case = \case
-1 v
+1 v
Nothing -> ""
-v 1
+1 v
Just fish -> fish
-v 1
+1 v
-v 1
\ No newline at end of file
+1 v
\ No newline at end of file
diff --git a/test/src/indentation.hs.insert.indent
b/test/src/indentation.hs.insert.indent
index 1f01887..7d32101 100644
--- a/test/src/indentation.hs.insert.indent
+++ b/test/src/indentation.hs.insert.indent
@@ -105,8 +105,8 @@ case_of wibble = case wibble of
1 v
lambda_case = \case
-1 2 v
+1 v
Nothing -> ""
-2 1 v
+1 v
Just fish -> fish
-v 1
\ No newline at end of file
+1 v
\ No newline at end of file
diff --git a/test/src/indentation.hs.layout b/test/src/indentation.hs.layout
index f4b88aa..a142e23 100644
--- a/test/src/indentation.hs.layout
+++ b/test/src/indentation.hs.layout
@@ -52,6 +52,6 @@ module Indentation where
;Just fish -> fish
};lambda_case = \case
- Nothing -> ""
- Just fish -> fish
-}
\ No newline at end of file
+ {Nothing -> ""
+ ;Just fish -> fish
+}}
\ No newline at end of file
diff --git a/test/src/indentation.hs.lexer b/test/src/indentation.hs.lexer
index e08c25a..00f4e22 100644
--- a/test/src/indentation.hs.lexer
+++ b/test/src/indentation.hs.lexer
@@ -51,7 +51,7 @@ VARID VARID
{ CONID -> §
; CONID VARID -> VARID
-} ; VARID = \ case
-CONID -> §
-CONID VARID -> VARID
-}
+} ; VARID = \case
+{ CONID -> §
+; CONID VARID -> VARID
+} }
diff --git a/test/src/indentation.hs.reindent b/test/src/indentation.hs.reindent
index 37a2177..8695185 100644
--- a/test/src/indentation.hs.reindent
+++ b/test/src/indentation.hs.reindent
@@ -106,7 +106,7 @@ v 1
v 1
lambda_case = \case
-1 2 v
+1 v
Nothing -> ""
-2 1 v
+v 1
Just fish -> fish
\ No newline at end of file
diff --git a/test/src/indentation.hs.sexps b/test/src/indentation.hs.sexps
index fa270e1..e503f2e 100644
--- a/test/src/indentation.hs.sexps
+++ b/test/src/indentation.hs.sexps
@@ -51,7 +51,7 @@
((Nothing) -> ("")
((Just) (fish) -> (fish))
-)(lambda_case) = (\)(case
- (Nothing) -> ("")
- (Just) (fish) -> (fish)))))))))
-)))
\ No newline at end of file
+)(lambda_case) = (\(case
+ ((Nothing) -> ("")
+ ((Just) (fish) -> (fish))
+)))))))))))))
\ No newline at end of file
diff --git a/test/src/medley.hs b/test/src/medley.hs
index 7e91619..7c76ec4 100644
--- a/test/src/medley.hs
+++ b/test/src/medley.hs
@@ -145,4 +145,8 @@ foo = do
test = 1 `shouldBe` 1
+cases = \case
+ Nothing -> "no"
+ Just _ -> "yes"
+
bar = do -- an incomplete do block
diff --git a/test/src/medley.hs.faceup b/test/src/medley.hs.faceup
index 31e7b83..ec46a15 100644
--- a/test/src/medley.hs.faceup
+++ b/test/src/medley.hs.faceup
@@ -145,5 +145,9 @@
«:haskell-tng:toplevel:test» «:haskell-tng:keyword:=» 1 `shouldBe` 1
+«:haskell-tng:toplevel:cases» «:haskell-tng:keyword:=»
«:haskell-tng:keyword:\case»
+ «:haskell-tng:constructor:Nothing» «:haskell-tng:keyword:->» «s:"no"»
+ «:haskell-tng:constructor:Just» «:haskell-tng:keyword:_»
«:haskell-tng:keyword:->» «s:"yes"»
+
«:haskell-tng:toplevel:bar» «:haskell-tng:keyword:=» «:haskell-tng:keyword:do»
«m:-- »«x:an incomplete do block
»
\ No newline at end of file
diff --git a/test/src/medley.hs.layout b/test/src/medley.hs.layout
index e87c3c5..c5ad093 100644
--- a/test/src/medley.hs.layout
+++ b/test/src/medley.hs.layout
@@ -145,5 +145,9 @@ module Foo.Bar.Main
}};test = 1 `shouldBe` 1
+;cases = \case
+ Nothing -> "no"
+ Just _ -> "yes"
+
;bar = do -- an incomplete do block
{}}
\ No newline at end of file
diff --git a/test/src/medley.hs.lexer b/test/src/medley.hs.lexer
index dfbc55a..53f2eba 100644
--- a/test/src/medley.hs.lexer
+++ b/test/src/medley.hs.lexer
@@ -145,5 +145,9 @@ CONSYM CONID « CONID » « CONID CONID »
} } ; VARID = 1 SYMID 1
+; VARID = \case
+CONID -> §
+CONID _ -> §
+
; VARID = do
{ } }
diff --git a/test/src/medley.hs.syntax b/test/src/medley.hs.syntax
index 614e97c..496dba9 100644
--- a/test/src/medley.hs.syntax
+++ b/test/src/medley.hs.syntax
@@ -145,4 +145,8 @@ www _ ww>
>
wwww _ w $wwwwwwww$ w>
>
+wwwww _ _wwww>
+ wwwwwww __ "ww">
+ wwww w __ "www">
+>
www _ ww __ ww wwwwwwwwww ww wwwww>
- [nongnu] elpa/haskell-tng-mode 04ebec6 204/385: third party integrations, (continued)
- [nongnu] elpa/haskell-tng-mode 04ebec6 204/385: third party integrations, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode aa9bbb7 216/385: add (broken) test coverage for consyms, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5f423b9 100/385: some alts in the indentation test, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 50b53d3 114/385: tng compilation tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 36ece6d 117/385: low hanging fruit, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 489e4c9 124/385: document explicit export fontification bug, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 91a1d08 136/385: creating small scenarios for indentation specs, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode ec39a64 133/385: improvements to indentation alts and compilation info, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode f67557b 142/385: fix a layout corner case, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 20f4091 152/385: support dollars in indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 0d5e020 151/385: support LambdaCase,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 08a3946 163/385: records indentation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3449847 162/385: no need to special-case dollar, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8b5a4d4 177/385: improve indentation tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode cb801b4 015/385: moar multiline type search, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode de48840 030/385: multiline import anchors, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 5c50be0 044/385: remove redundant TODOs, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 174c63b 046/385: laying the foundations for SMIE, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 97ce717 058/385: improve the testing, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 2a2afee 064/385: cache invalidation and tests for layout invalidation, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3ca869f 067/385: code reorganisation, ELPA Syncer, 2021/10/06