[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/haskell-tng-mode 269be91 072/385: revert broken grammar ru
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/haskell-tng-mode 269be91 072/385: revert broken grammar rules |
Date: |
Tue, 5 Oct 2021 23:59:04 -0400 (EDT) |
branch: elpa/haskell-tng-mode
commit 269be9193e4d77ce9f6acd729bd90f7f37b8645a
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>
revert broken grammar rules
---
haskell-tng-smie.el | 84 +++++++++++++++++++++++++------------------
test/haskell-tng-sexp-test.el | 6 ++--
test/src/layout.hs.sexps | 28 +++++++--------
3 files changed, 68 insertions(+), 50 deletions(-)
diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index 67de3f2..08bfe71 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -36,9 +36,10 @@
(infixexp "::" type)
(infixexp))
- ;; TODO update the lexer to provide a virtual token for infix
+ ;; TODO update the lexer to provide a virtual token for infix but keep
+ ;; popular operators with important fixity.
(infixexp
- (lexp "$" infixexp) ;; TODO arrange by fixity
+ (lexp "$" infixexp)
(lexp "+" infixexp)
(lexp "-" infixexp)
(lexp "*" infixexp)
@@ -48,40 +49,55 @@
(lexp ">>=" infixexp)
(lexp "`should`" infixexp)
(lexp "&" infixexp)
- ("-" infixexp)
- (lexp))
-
- (lexp
- ;; TODO apats, it is hard to formalise...
- ;;("\\" apats "->" exp)
- ("let" "{" decls "}" "in" exp)
- ("if" exp "then" exp "else" exp)
- ("case" exp "of" "{" alts "}")
- ("do" "{" stmts "}")
- ;; TODO fexp
+ ;;("-" infixexp) ;; can't be opener and neither
+ ;;(lexp)
)
- ;; TODO formal decls definition
- (decls
- (decls ";" decls)
- (decl))
- (decl
- (id "=" exp))
- ;; TODO formal alts definition
- (alts
- (alts ";" alts)
- (alt))
- (alt
- (id "->" exp))
- ;; TODO formal stmts definition
- (stmts
- (stmts ";" stmts)
- (stmt))
- (stmt
- (id "<-" exp))
-
- ;; TODO operator precedences
- ))))
+ ;; ;; FIXME these seem to break everything
+ ;; (lexp
+ ;; ;; TODO apats
+ ;; ;;("let" decls "in" exp)
+ ;; ;;("if" exp "then" exp "else" exp)
+ ;; ;;("case" exp "of" alts)
+ ;; ;;("do" stmts)
+ ;; ;; TODO where?
+ ;; ;; TODO fexp
+ ;; )
+
+ ;; (decls
+ ;; ;;("{" decls "}")
+ ;; (decls ";" decls)
+ ;; (decl))
+ ;; (decl
+ ;; (id "=" exp))
+ ;; (alts
+ ;; ;;("{" alts "}")
+ ;; (alts ";" alts)
+ ;; (alt))
+ ;; (alt
+ ;; (id "->" exp))
+ ;; (stmts
+ ;; ;;("{" stmts "}")
+ ;; (stmts ";" stmts)
+ ;; (stmt))
+ ;; (stmt
+ ;; (id "<-" exp))
+
+ )
+
+ ;; operator precedences
+ ;; TODO arrange by fixity
+ '((left "$"))
+ '((left "+"))
+ '((left "-"))
+ '((left "*"))
+ '((left "/"))
+ '((left "<$>"))
+ '((left "<*>"))
+ '((left ">>="))
+ '((left "&"))
+
+ )))
;; TODO indentation rules
;;
https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#SMIE-Indentation
diff --git a/test/haskell-tng-sexp-test.el b/test/haskell-tng-sexp-test.el
index a496606..dc3a15f 100644
--- a/test/haskell-tng-sexp-test.el
+++ b/test/haskell-tng-sexp-test.el
@@ -45,7 +45,8 @@
(forward-sexp)
(let ((forward (point)))
(backward-sexp)
- (cons (point) forward)))))
+ (unless (= (point) forward)
+ (cons (point) forward))))))
(backward-forward
(ignore-errors
(save-excursion
@@ -53,7 +54,8 @@
(backward-sexp)
(let ((backward (point)))
(forward-sexp)
- (cons backward (point)))))))
+ (unless (= backward (point))
+ (cons backward (point))))))))
(when forward-backward
(push forward-backward sexps))
(when backward-forward
diff --git a/test/src/layout.hs.sexps b/test/src/layout.hs.sexps
index a3b077a..a412dc4 100644
--- a/test/src/layout.hs.sexps
+++ b/test/src/layout.hs.sexps
@@ -1,20 +1,20 @@
(-- Figure 2.1 from the Haskell2010 report
-((module)) (AStack()( (Stack(),) (push(),) (pop(),) (top(),) (size) )) (where)
-(((data) (Stack) (a) = (Empty)
+(((((module)) (AStack()( (Stack(),) (push(),) (pop(),) (top(),) (size) ))
(where)
+(data) (Stack) (a) (=) (Empty)
(|) (MkStack) (a) (((Stack) (a)))
-(((push) (::) ((a) ->) ((Stack) (a) ->) (Stack) (a)))
-((push) (x) (s) = (MkStack) (x) (s))
+(push) (::) (a) (->) (Stack) (a) (->) (Stack) (a)
+(push) (x) (s) (=) (MkStack) (x) (s)
-(((size) (::) ((Stack) (a) ->) (Int)))
-((size) (s) = (length) (((stkToLst) (s))) (where)
- ((stkToLst) (Empty) = ([])
- ((stkToLst) (((MkStack) (x) (s))) = (x:xs) (where) ((xs) =
(stkToLst) (s)
+(size)) (::) (Stack) (a) (->) (Int)
+(size) (s) (=) (length) (((stkToLst) (s))) (where)
+ (stkToLst) (Empty) (=) ([])
+ (stkToLst) (((MkStack) (x) (s))) (=) (x:xs) (where) (xs) (=)
(stkToLst) (s)
-(()))))pop) (::) ((Stack) (a) ->) (((a(),) (Stack) (a))))
-((pop) (((MkStack) (x) (s)))
- = (((x(),) ((case (s) (of) ((r ->) (i) (r) (where) (i (x) = x))))))) -- (pop
Empty) is an (error)
+(pop)) (::) (Stack) (a) (->) (((a(),) (Stack) (a)))
+(pop) (((MkStack) (x) (s)))
+ (=) (((x)(,) (case) (s) (of) r (->) (i) (r) (where) i (x) (=) x)) -- (pop
Empty) is an error
-(((top) (::) ((Stack) (a) ->) (a)))
-((top) (((MkStack) (x) (s))) = (x)) -- (top Empty) is an
(error)
-))
\ No newline at end of file
+(top)) (::) (Stack) (a) (->) (a)
+(top) (((MkStack) (x) (s))) (=) (x) -- (top Empty) is an
error
+)
\ No newline at end of file
- [nongnu] elpa/haskell-tng-mode ad570a0 039/385: out of date comments, (continued)
- [nongnu] elpa/haskell-tng-mode ad570a0 039/385: out of date comments, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 7326aad 041/385: modules and more efficient none, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 49611c6 042/385: regression tests for fontification, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode c22f7d2 045/385: thoughts on future plans, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode a5f779d 047/385: initial SMIE tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode dae43ac 049/385: improvements to the default lexer, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode d76c6ad 053/385: some thoughts on WLDO detection, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 3e53f56 055/385: cleaner lexer test output, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 73e2b11 063/385: the new lexer works!, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 8e1a225 068/385: sexp tests, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 269be91 072/385: revert broken grammar rules,
ELPA Syncer <=
- [nongnu] elpa/haskell-tng-mode 3194e62 074/385: stefan to the rescue, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode b690037 081/385: comment-* support, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 502cc26 085/385: document a failure mode, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 08f924c 088/385: simplify the grammar rules, better s-exps, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 71cf945 048/385: lexer test based on Haskell2010, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 4d6bbfc 050/385: feedback from Stefan, improving lexing, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 96609e4 052/385: thoughts on layout inference, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 06b357c 054/385: hacky closing braces, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 64ad4a8 057/385: refactored to centralise state, ELPA Syncer, 2021/10/06
- [nongnu] elpa/haskell-tng-mode 0ac5a2f 059/385: copyright years and move the test assertions, ELPA Syncer, 2021/10/06