Skip to content

Commit 2b96f55

Browse files
committed
Decypher regexp at purescript-indentation-peek-token
The 204 characters line full of backslashes and parentheses isn't the most readable code. Replace it with `rx` expression instead, which makes author's intentions much clearer. As can be checked by evaluation, the resulting regexp is exactly the same, barring the "'_" part was moved to the left of [:alnum:].
1 parent 09327cb commit 2b96f55

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

purescript-indentation.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,13 @@ indent the current line. This has to be fixed elsewhere."
998998

999999
(defun purescript-indentation-peek-token ()
10001000
"Return token starting at point."
1001-
(cond ((looking-at "\\(if\\|then\\|else\\|let\\|in\\|ado\\|mdo\\|rec\\|\\(?:[[:word:]]+\\.\\)*do\\|proc\\|case\\|of\\|where\\|module\\|data\\|type\\|newtype\\|class\\|instance\\)\\([^[:alnum:]'_]\\|$\\)")
1001+
(cond ((looking-at
1002+
(rx (group
1003+
(or "if" "then" "else" "let" "in" "ado" "mdo" "rec"
1004+
(seq (0+ (seq (1+ word) ".")) "do")
1005+
"proc" "case" "of" "where" "module" "data" "type" "newtype"
1006+
"class" "instance"))
1007+
(group (or (not (any alnum "'_")) eol))))
10021008
(match-string-no-properties 1))
10031009
((looking-at "[][(){}[,;]")
10041010
(match-string-no-properties 0))

0 commit comments

Comments
 (0)