emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode 08f924c 088/385: simplify the grammar rul


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode 08f924c 088/385: simplify the grammar rules, better s-exps
Date: Tue, 5 Oct 2021 23:59:07 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit 08f924c7372d927c6c62edfdfe11da8c15e7d75b
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@gmail.com>

    simplify the grammar rules, better s-exps
---
 haskell-tng-smie.el       | 41 ++++++++++++++++++-----------------------
 test/src/grammar.hs.sexps |  6 +++---
 test/src/layout.hs.sexps  |  2 +-
 3 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el
index b549e27..816767e 100644
--- a/haskell-tng-smie.el
+++ b/haskell-tng-smie.el
@@ -46,40 +46,35 @@
     '((id)
 
       ;; commas only allowed in brackets
-      (context
-       ("(" context ")")
-       (context "," context))
+      (list
+       ("(" list ")")
+       ("[" list "]")
+       (list "," list))
 
-      ;; operators, we don't care about precedences
+      ;; operators all have the same precedence
       (infixexp
-       (id "SYMID" infixexp)
-       (id))
+       (id "SYMID" infixexp))
 
       ;; WLDOs
       (wldo
-       ("where" decls)
-       ("let" decls)
-       ("do" stmts)
-       ("of" alts))
-      (decls
-       ("{" decls "}")
-       (decls ";" decls)
+       ("where" block)
+       ("let" block "in")
+       ("do" block)
+       ("case" id "of" block))
+      (block
+       ("{" block "}")
+       (block ";" block)
+       (id "<-" id)
+       (id "->" id)
        (id "=" id))
-      (stmts
-       ("{" stmts "}")
-       (stmts ";" stmts)
-       (id "<-" id))
-      (alts
-       ("{" alts "}")
-       (alts ";" alts)
-       (id "->" id))
 
+      (logic
+       ("if" id "then" id "else" id))
       )
 
     ;; operator precedences
     '((assoc ";")
-      (assoc ",")
-      )
+      (assoc ","))
 
     )))
 
diff --git a/test/src/grammar.hs.sexps b/test/src/grammar.hs.sexps
index e5cfece..155fe72 100644
--- a/test/src/grammar.hs.sexps
+++ b/test/src/grammar.hs.sexps
@@ -2,7 +2,7 @@
 (module) (Foo.(Bar)) (where
 
 ((calc) (::) (Int) -> (Int)
-((calc) (a) = (if) (a) < (10)
-         (then) (a) + (a) * (a) + (a)
-         (else) ((a) + (a)) * ((a) + (a)))
+((calc) (a) = (if (a) < ((10)
+         (then) (a) + (a) * (a) + ((a)
+         (else) ((a) + (a)) * ((a) + (a))))))
 ))
\ No newline at end of file
diff --git a/test/src/layout.hs.sexps b/test/src/layout.hs.sexps
index fa4bddc..95d7726 100644
--- a/test/src/layout.hs.sexps
+++ b/test/src/layout.hs.sexps
@@ -13,7 +13,7 @@
 
 ))))(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
+  = ((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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]