I am attempting to set up Haskell style comments using ELisp Syntax-Table-Comments but I can't quite get it.
In Haskell, there are 2 basic types of comments
-- denotes a single line comment ending with \n
{- denotes a multi line comment ending with -} It should be noted that these can be nested
Multiline comments can be done this way:
(defvar my-syntax-table
(let ((st (make-syntax-table)))
(modify-syntax-entry ?{ ". 1n" st)
(modify-syntax-entry ?- ". 23n" st)
(modify-syntax-entry ?} ". 4n" st)
st))
Single line comments can be done this way:
(defvar my-syntax-table
(let ((st (make-syntax-table)))
(modify-syntax-entry ?- ". 12" st)
(modify-syntax-entry ?\n ">" st)
st))
Based on the documentation, I can set up an alternative using b. However, b applies to the second character of the sequence which in both cases is -. So, when I try to combine these using alternatives, it becomes impossible to do multiline and single line comments.
I have seen this done so I know it is possible. However, I'm not sure how to do it. Any help is appreciated.
Haskell-mode uses
(modify-syntax-entry ?\{ "(}1nb" table)
(modify-syntax-entry ?\} "){4nb" table)
(modify-syntax-entry ?- "_ 123" table)))
(modify-syntax-entry ?\n ">" table)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With