[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 20f4091 152/385: support dollars in inden
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 20f4091 152/385: support dollars in indentation |
Date: |
Tue, 5 Oct 2021 23:59:20 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 20f4091711c2ca22e871f91793816430ea751bed
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
support dollars in indentation
---
.python-version | 2 +-
haskell-tng-lexer.el | 5 +++++
haskell-tng-smie.el | 7 ++++---
test/haskell-tng-indent-test.el | 2 ++
test/src/indentation.hs | 6 ++++++
test/src/indentation.hs.append.indent | 14 +++++++++++++-
test/src/indentation.hs.insert.indent | 14 +++++++++++++-
test/src/indentation.hs.layout | 8 +++++++-
test/src/indentation.hs.lexer | 8 +++++++-
test/src/indentation.hs.reindent | 14 +++++++++++++-
test/src/indentation.hs.sexps | 8 +++++++-
test/src/medley.hs | 4 ++--
test/src/medley.hs.faceup | 4 ++--
test/src/medley.hs.layout | 6 +++---
test/src/medley.hs.lexer | 6 +++---
test/src/medley.hs.syntax | 4 ++--
16 files changed, 90 insertions(+), 22 deletions(-)
diff --git a/.python-version b/.python-version
index 0f44168..c1e43e6 100644
--- a/.python-version
+++ b/.python-version
@@ -1 +1 @@
-3.6.4
+3.7.3
diff --git a/haskell-tng-lexer.el b/haskell-tng-lexer.el
index 8ea1a68..158b9bf 100644
--- a/haskell-tng-lexer.el
+++ b/haskell-tng-lexer.el
@@ -113,6 +113,9 @@ the lexer."
((looking-at (rx "'["))
;; DataKinds
(null (goto-char (+ (point) 1))))
+ ((looking-at (rx symbol-start "$" symbol-end))
+ ;; special handling of these operators
+ (haskell-tng-lexer:last-match))
((looking-at haskell-tng:regexp:kindsym)
;; caveat: doesn't include typelevel lists, see fast-syntax
(haskell-tng-lexer:last-match nil "KINDSYM"))
@@ -176,6 +179,8 @@ the lexer."
;; non-trivial inversion
(goto-char (- (point) 1))
(haskell-tng-lexer:backward-token))
+ ((looking-back (rx symbol-start "$" symbol-end) lbp 't)
+ (haskell-tng-lexer:last-match 'reverse))
((looking-back haskell-tng:regexp:kindsym lbp 't)
(haskell-tng-lexer:last-match 'reverse "KINDSYM"))
((looking-back haskell-tng:regexp:kindid lbp 't)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index 476e837..ea4a01b 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -67,6 +67,7 @@
(infixexp
(id ":" infixexp) ;; keyword infix
(id "':" infixexp) ;; DataKinds
+ (id "$" infixexp) ;; special case
(id "SYMID" infixexp))
;; WLDOs
@@ -159,12 +160,12 @@ information, to aid in the creation of new rules."
;; get called with `:list-intro "HEAD"` when indenting positions A and B.
(:list-intro
(pcase arg
- ((or "<-" "=") t)
+ ((or "<-" "=" "$") t)
))
(:after
(pcase arg
- ((or "let" "do" "of" "=" "in") 2)
+ ((or "let" "do" "of" "=" "in" "$" "->") 2)
("\\case" 2) ;; LambdaCase
("where" (if (smie-rule-parent-p "module") 0 2))
))
@@ -181,7 +182,7 @@ information, to aid in the creation of new rules."
;;
;; blah = bloo where
;; bloo = blu
- ((or "{" "where" "let" "do" "case")
+ ((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 3ed324b..e8643e6 100644
--- a/test/haskell-tng-indent-test.el
+++ b/test/haskell-tng-indent-test.el
@@ -16,6 +16,8 @@
;; TODO lists, records, tuples
;; 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/src/indentation.hs b/test/src/indentation.hs
index 278ad20..74df4bd 100644
--- a/test/src/indentation.hs
+++ b/test/src/indentation.hs
@@ -54,3 +54,9 @@ case_of wibble = case wibble of
lambda_case = \case
Nothing -> ""
Just fish -> fish
+
+dollars f Nothing = f $
+ "" ""
+ ""
+dollars f (Just a) = f $ \s ->
+ a
diff --git a/test/src/indentation.hs.append.indent
b/test/src/indentation.hs.append.indent
index e671bed..4d7ad5c 100644
--- a/test/src/indentation.hs.append.indent
+++ b/test/src/indentation.hs.append.indent
@@ -111,4 +111,16 @@ lambda_case = \case
Just fish -> fish
1 v
-1 v
\ No newline at end of file
+1 v
+dollars f Nothing = f $
+1 v
+ "" ""
+1 v
+ ""
+1 v
+dollars f (Just a) = f $ \s ->
+1 v
+ a
+2 1 v
+
+1 2 v
\ No newline at end of file
diff --git a/test/src/indentation.hs.insert.indent
b/test/src/indentation.hs.insert.indent
index 7d32101..57835ab 100644
--- a/test/src/indentation.hs.insert.indent
+++ b/test/src/indentation.hs.insert.indent
@@ -109,4 +109,16 @@ lambda_case = \case
Nothing -> ""
1 v
Just fish -> fish
-1 v
\ No newline at end of file
+1 v
+
+1 v
+dollars f Nothing = f $
+1 v
+ "" ""
+1 v
+ ""
+1 v
+dollars f (Just a) = f $ \s ->
+1 v
+ a
+v 1
\ No newline at end of file
diff --git a/test/src/indentation.hs.layout b/test/src/indentation.hs.layout
index a142e23..93e42c6 100644
--- a/test/src/indentation.hs.layout
+++ b/test/src/indentation.hs.layout
@@ -54,4 +54,10 @@ module Indentation where
};lambda_case = \case
{Nothing -> ""
;Just fish -> fish
-}}
\ No newline at end of file
+
+};dollars f Nothing = f $
+ "" ""
+ ""
+;dollars f (Just a) = f $ \s ->
+ a
+}
\ No newline at end of file
diff --git a/test/src/indentation.hs.lexer b/test/src/indentation.hs.lexer
index 00f4e22..1e34f64 100644
--- a/test/src/indentation.hs.lexer
+++ b/test/src/indentation.hs.lexer
@@ -54,4 +54,10 @@ VARID VARID
} ; VARID = \case
{ CONID -> §
; CONID VARID -> VARID
-} }
+
+} ; VARID VARID CONID = VARID $
+§ §
+§
+; VARID VARID « CONID VARID » = VARID $ \ VARID ->
+VARID
+}
diff --git a/test/src/indentation.hs.reindent b/test/src/indentation.hs.reindent
index 8695185..8383795 100644
--- a/test/src/indentation.hs.reindent
+++ b/test/src/indentation.hs.reindent
@@ -109,4 +109,16 @@ lambda_case = \case
1 v
Nothing -> ""
v 1
- Just fish -> fish
\ No newline at end of file
+ Just fish -> fish
+1 v
+
+v 1
+dollars f Nothing = f $
+1 v
+ "" ""
+1 v
+ ""
+v 1
+dollars f (Just a) = f $ \s ->
+1 v
+ a
\ No newline at end of file
diff --git a/test/src/indentation.hs.sexps b/test/src/indentation.hs.sexps
index e503f2e..f07a653 100644
--- a/test/src/indentation.hs.sexps
+++ b/test/src/indentation.hs.sexps
@@ -54,4 +54,10 @@
)(lambda_case) = (\(case
((Nothing) -> ("")
((Just) (fish) -> (fish))
-)))))))))))))
\ No newline at end of file
+
+))(dollars) (f) (Nothing) = (f) $
+ ("") ("")
+ ("")
+((dollars) (f) ((Just) (a)) = (f) $ (\)(s) ->
+ (a))))))))))
+)))
\ No newline at end of file
diff --git a/test/src/medley.hs b/test/src/medley.hs
index 7c76ec4..d55706a 100644
--- a/test/src/medley.hs
+++ b/test/src/medley.hs
@@ -146,7 +146,7 @@ foo = do
test = 1 `shouldBe` 1
cases = \case
- Nothing -> "no"
- Just _ -> "yes"
+ Nothing -> "no" & toUpper
+ Just _ -> toUpper $ "yes"
bar = do -- an incomplete do block
diff --git a/test/src/medley.hs.faceup b/test/src/medley.hs.faceup
index ec46a15..9eb0f6c 100644
--- a/test/src/medley.hs.faceup
+++ b/test/src/medley.hs.faceup
@@ -146,8 +146,8 @@
«: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:constructor:Nothing» «:haskell-tng:keyword:->» «s:"no"» &
toUpper
+ «:haskell-tng:constructor:Just» «:haskell-tng:keyword:_»
«:haskell-tng:keyword:->» toUpper $ «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 c5ad093..178e162 100644
--- a/test/src/medley.hs.layout
+++ b/test/src/medley.hs.layout
@@ -146,8 +146,8 @@ module Foo.Bar.Main
}};test = 1 `shouldBe` 1
;cases = \case
- Nothing -> "no"
- Just _ -> "yes"
+ {Nothing -> "no" & toUpper
+ ;Just _ -> toUpper $ "yes"
-;bar = do -- an incomplete do block
+};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 53f2eba..2943d14 100644
--- a/test/src/medley.hs.lexer
+++ b/test/src/medley.hs.lexer
@@ -146,8 +146,8 @@ CONSYM CONID « CONID » « CONID CONID »
} } ; VARID = 1 SYMID 1
; VARID = \case
-CONID -> §
-CONID _ -> §
+{ CONID -> § SYMID VARID
+; CONID _ -> VARID $ §
-; VARID = do
+} ; VARID = do
{ } }
diff --git a/test/src/medley.hs.syntax b/test/src/medley.hs.syntax
index 496dba9..fe3ab6f 100644
--- a/test/src/medley.hs.syntax
+++ b/test/src/medley.hs.syntax
@@ -146,7 +146,7 @@ www _ ww>
wwww _ w $wwwwwwww$ w>
>
wwwww _ _wwww>
- wwwwwww __ "ww">
- wwww w __ "www">
+ wwwwwww __ "ww" _ wwwwwww>
+ wwww w __ wwwwwww _ "www">
>
www _ ww __ ww wwwwwwwwww ww wwwww>
- [nongnu] elpa/haskell-tng-mode 144cabf 202/385: fix test assertions, (continued)
- [nongnu] elpa/haskell-tng-mode 144cabf 202/385: fix test assertions, ELPA Syncer, 2021/10/06
- [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 <=
- [nongnu] elpa/haskell-tng-mode 0d5e020 151/385: support LambdaCase, ELPA Syncer, 2021/10/06
- [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