Skip to content

Commit

Permalink
Allow non-ASCII names.
Browse files Browse the repository at this point in the history
Ignore-this: f46f407a19ae2a597f44317e4915e5ba
The code already used char-classes unconditionally, though I didn't
think they're supported in XEmacs.

darcs-hash:20091105212057-d4134-79b583d7b7c153e3a44ab2a676c18f94c0fa06c2.gz
  • Loading branch information
loveshack committed Nov 5, 2009
1 parent 748ee94 commit 1d2f932
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 21 deletions.
15 changes: 2 additions & 13 deletions haskell-font-lock.el
Expand Up @@ -269,21 +269,10 @@ Returns keywords suitable for `font-lock-keywords'."

;; (ASCsymbol "-!#$%&*+./<=>?@\\\\^|~")
;; Put the minus first to make it work in ranges.
;; (ISOsymbol "\241-\277\327\367")
(ISOlarge "\300-\326\330-\337")
(ISOsmall "\340-\366\370-\377")
(small
(if haskell-emacs21-features "[:lower:]" (concat "a-z" ISOsmall)))
(large
(if haskell-emacs21-features "[:upper:]" (concat "A-Z" ISOlarge)))
(alnum
(if haskell-emacs21-features "[:alnum:]" (concat small large "0-9")))
;; (symbol
;; (concat ASCsymbol ISOsymbol))

;; We allow _ as the first char to fit GHC
(varid (concat "\\b[" small "_][" alnum "'_]*\\b"))
(conid (concat "\\b[" large "][" alnum "'_]*\\b"))
(varid "\\b[[:lower:]_][[:alnum:]'_]*\\b")
(conid "\\b[[:upper:]][[:alnum:]'_]*\\b")
(modid (concat "\\b" conid "\\(\\." conid "\\)*\\b"))
(qvarid (concat modid "\\." varid))
(qconid (concat modid "\\." conid))
Expand Down
3 changes: 2 additions & 1 deletion haskell-ghci.el
Expand Up @@ -176,7 +176,8 @@ Prompt for a list of args if called with an argument."
(add-hook 'comint-input-filter-functions 'shell-directory-tracker nil 'local)

;; GHCi prompt should be of the form `ModuleName> '.
(setq comint-prompt-regexp "^\\*?[A-Z][\\._a-zA-Z0-9]*\\( \\*?[A-Z][\\._a-zA-Z0-9]*\\)*> ")
(setq comint-prompt-regexp
"^\\*?[[:upper:]][\\._[:alnum:]]*\\( \\*?[[:upper:]][\\._[:alnum:]]*\\)*> ")

;; History syntax of comint conflicts with Haskell, e.g. !!, so better
;; turn it off.
Expand Down
2 changes: 1 addition & 1 deletion haskell-hugs.el
Expand Up @@ -179,7 +179,7 @@ Prompts for a list of args if called with an argument."
(setq shell-dirtrackp t)
(add-hook 'comint-input-filter-functions 'shell-directory-tracker nil 'local)
; ? or module name in Hugs 1.4
(setq comint-prompt-regexp "^\? \\|^[A-Z][_a-zA-Z0-9\.]*> ")
(setq comint-prompt-regexp "^\? \\|^[[:upper:]][_[:alnum:]\.]*> ")
;; comint's history syntax conflicts with Hugs syntax, eg. !!
(setq comint-input-autoexpand nil)
(run-hooks 'haskell-hugs-hook)
Expand Down
3 changes: 2 additions & 1 deletion haskell-indent.el
Expand Up @@ -392,7 +392,8 @@ Returns the location of the start of the comment, nil otherwise."
(cond
((haskell-indent-empty-line-p) 'empty)
((haskell-indent-in-comment (point-min) (point)) 'comment)
((looking-at "\\(\\([a-zA-Z]\\(\\sw\\|'\\)*\\)\\|_\\)[ \t\n]*") 'ident)
((looking-at "\\(\\([[:alpha:]]\\(\\sw\\|'\\)*\\)\\|_\\)[ \t\n]*")
'ident)
((looking-at "\\(|[^|]\\)[ \t\n]*") 'guard)
((looking-at "\\(=[^>=]\\|::\\|->\\|<-\\)[ \t\n]*") 'rhs)
(t 'other)))
Expand Down
10 changes: 6 additions & 4 deletions haskell-indentation.el
Expand Up @@ -834,7 +834,7 @@ Preserves indentation and removes extra whitespace"
(t (setq current-token (haskell-indentation-peek-token))))))))

(defun haskell-indentation-peek-token ()
(cond ((looking-at "\\(if\\|then\\|else\\|let\\|in\\|mdo\\|do\\|case\\|of\\|where\\|module\\|deriving\\|data\\|type\\|newtype\\|class\\|instance\\)\\([^A-Za-z']\\|$\\)")
(cond ((looking-at "\\(if\\|then\\|else\\|let\\|in\\|do\\|case\\|of\\|where\\|module\\|deriving\\|data\\|type\\|newtype\\|class\\|instance\\)\\([^A-Za-z']\\|$\\)")
(match-string 1))
((looking-at "[][(){}[,;]")
(match-string 0))
Expand All @@ -848,12 +848,14 @@ Preserves indentation and removes extra whitespace"
"Skip to the next token."
(if (or (looking-at "'\\([^\\']\\|\\\\.\\)*'")
(looking-at "\"\\([^\\\"]\\|\\\\.\\)*\"")
(looking-at "[A-Z][A-Z_a-z0-9']*\\(\\.[A-Z_a-z][A-Z_a-z0-9']*\\)*") ; Allows hierarchical modules
(looking-at "[A-Z_a-z][A-Z_a-z0-9']*") ; Only unqualified vars can start with lowercase
(looking-at ; Allows hierarchical modules
"[[:upper:]][[:alnum:]_']]*\\(\\.[[:alpha:]_][[:alnum:]_']*\\)*")
(looking-at ; Only unqualified vars can start with lowercase
"[[:alnum:]_'][[:alnum:]_']*")
(looking-at "[0-9][0-9oOxXeE+-]*")
(looking-at "[-:!#$%&*+./<=>?@\\\\^|~]+")
(looking-at "[](){}[,;]")
(looking-at "`[A-Za-z0-9']*`"))
(looking-at "`[[:alnum:]']*`"))
(goto-char (match-end 0))
;; otherwise skip until space found
(skip-syntax-forward "^-"))
Expand Down
3 changes: 2 additions & 1 deletion inf-haskell.el
Expand Up @@ -126,7 +126,8 @@ This will either look for a Cabal file or a \"module\" statement in the file."
(define-derived-mode inferior-haskell-mode comint-mode "Inf-Haskell"
"Major mode for interacting with an inferior Haskell process."
(set (make-local-variable 'comint-prompt-regexp)
"^\\*?[A-Z][\\._a-zA-Z0-9]*\\( \\*?[A-Z][\\._a-zA-Z0-9]*\\)*> ")
;; Whay the backslash in [\\._[:alnum:]]?
"^\\*?[[:upper:]][\\._[:alnum:]]*\\(?: \\*?[[:upper:]][\\._[:alnum:]]*\\)*> ")
(set (make-local-variable 'comint-input-autoexpand) nil)
(add-hook 'comint-output-filter-functions 'inferior-haskell-spot-prompt nil t)

Expand Down

0 comments on commit 1d2f932

Please sign in to comment.