branch: elpa/haskell-tng-mode commit b8f3e3fe6f9c516a9fad5b61e4bdf5224f8feb2c Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
back out incomplete grammar rules --- haskell-tng-smie.el | 33 +++++++++++++++++++++++---------- test/src/layout.hs.sexps | 12 ++++++------ 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el index 619773f..a584b2c 100644 --- a/haskell-tng-smie.el +++ b/haskell-tng-smie.el @@ -61,19 +61,28 @@ (smie-prec2->grammar (smie-bnf->prec2 '((id) - (exp - (infixexp "::" context "=>" type) - (infixexp "::" type) - (infixexp)) + ;; We do not include rules that do not have an impact on indentation. + ;; Navigation with the more complete grammar is less than satisfactory, + ;; therefore there is no reason to maintain it. + ;; (exp + ;; (infixexp "::" context "=>" type) + ;; (infixexp "::" type) + ;; (infixexp)) + (exp (id)) + + ;; TODO => and -> may require custom indentation rules + + ;; FIXME don't give up hope yet, first see if exp is useful when type is + ;; defined properly. (context ("(" context ")") (context "," context)) - ;; TODO the lexer should provide virtual infix operators - (infixexp - (lexp "$" infixexp) - (lexp)) + ;; ;; TODO the lexer should provide virtual infix operators + ;; (infixexp + ;; (lexp "$" infixexp) + ;; (lexp)) (lexp ("if" exp "then" exp "else" exp) @@ -97,8 +106,12 @@ ) ;; operator precedences - '((left ";" "," "::" "else" "in" "of" "->" "do" "<-" "where" "=") - (left "$")) + '(;;(left ";" "," "::" "else" "in" "of" "->" "do" "<-" "where" "=") + ;;(left ";" ",") + (assoc ",") ;; TODO , and ; conflict but what's the correct ordering? + (assoc ";") +;; (left "$") + ) ))) diff --git a/test/src/layout.hs.sexps b/test/src/layout.hs.sexps index b260243..4106a8f 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) +((data) (Stack) (a) = (Empty) (|) (MkStack) (a) (((Stack) (a))) -(push) (::) (((a) (->) ((Stack) (a) (->) (Stack) (a))) +((((push) (::) (a) (->) (Stack) (a)) (->) (Stack) (a))) ((push) (x) (s) = (MkStack) (x) (s)) -(size) (::) ((((Stack) (a) (->) (Int)) +(((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) (::) (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) +(((top) (::) (Stack) (a) (->) (a)))) +((top) (((MkStack) (x) (s))) = (x)))) (--) (((top) (Empty))) (is) (an) (error) )) \ No newline at end of file