Skip to content

Pr implement gap rule #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions haskell-font-lock.el
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,6 @@ that should be commented under LaTeX-style literate scripts."
;; might be inside a comment or a string.
;; This still gets fooled with "'"'"'"'"'"', but ... oh well.
("\\Sw\\('\\)\\([^\\'\n]\\|\\\\.[^\\'\n \"}]*\\)\\('\\)" (1 "|") (3 "|"))
;; The \ is not escaping in \(x,y) -> x + y.
("\\(\\\\\\)(" (1 "."))
;; The second \ in a gap does not quote the subsequent char.
;; It's probably not worth the trouble, tho.
;; ("^[ \t]*\\(\\\\\\)" (1 "."))
;; Deal with instances of `--' which don't form a comment
("\\s.\\{3,\\}" (0 (cond ((numberp (nth 4 (syntax-ppss)))
;; There are no such instances inside nestable comments
Expand All @@ -463,6 +458,22 @@ that should be commented under LaTeX-style literate scripts."
;; case of things like `{---'.
nil)
(t ".")))) ; other symbol sequence

;; Implement Haskell Report 'escape' and 'gap' rules. Backslash
;; inside of a string is escaping unless it is preceeded by
;; another escaping backslash. There can be whitespace between
;; those two.
;;
;; Backslashes outside of string never escape.
;;
;; Note that (> 0 (skip-syntax-backward ".")) this skips over *escaping*
;; backslashes only.
("\\\\" (0 (when (save-excursion (and (nth 3 (syntax-ppss))
(goto-char (match-beginning 0))
(skip-syntax-backward "->")
(or (not (eq ?\\ (char-before)))
(> 0 (skip-syntax-backward ".")))))
"\\")))
))

(defconst haskell-bird-syntactic-keywords
Expand Down
4 changes: 2 additions & 2 deletions haskell-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ Run M-x describe-variable haskell-mode-hook for a list of such modes."))
(modify-syntax-entry ?\n ">" table)

(modify-syntax-entry ?\` "$`" table)
(modify-syntax-entry ?\\ "\\" table)

(mapc (lambda (x)
(modify-syntax-entry x "." table))
"!#$%&*+./:<=>?@^|~,;")
"!#$%&*+./:<=>?@^|~,;\\")

;; Haskell symbol characters are treated as punctuation because
;; they are not able to form identifiers with word constituent 'w'
Expand Down