summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschinz <schinz@epfl.ch>2003-03-18 11:56:52 +0000
committerschinz <schinz@epfl.ch>2003-03-18 11:56:52 +0000
commit955981999cafeab0584fc3d40936b8cd483bc8aa (patch)
tree8eda1f0310226a4b8dce21551600303935a95ea8
parented86cb4106c5aa628f6f24877ca468bb81a8ba2f (diff)
downloadscala-955981999cafeab0584fc3d40936b8cd483bc8aa.tar.gz
scala-955981999cafeab0584fc3d40936b8cd483bc8aa.tar.bz2
scala-955981999cafeab0584fc3d40936b8cd483bc8aa.zip
- fixed highlighting for function types
-rw-r--r--support/emacs/scala-mode.el44
1 files changed, 33 insertions, 11 deletions
diff --git a/support/emacs/scala-mode.el b/support/emacs/scala-mode.el
index b29f22051e..0df24d5a40 100644
--- a/support/emacs/scala-mode.el
+++ b/support/emacs/scala-mode.el
@@ -200,22 +200,26 @@ reserved keywords when used alone.")
;; Works only when point is at the beginning of a simple type
;; (modulo initial spaces/comments).
(cond ((eobp) nil)
- ((= (char-syntax (char-after)) ?\()
- ;; Tuple or function type.
+ ((= (char-after) ?\()
+ ;; Parenthesized type
(forward-sexp)
- (scala-forward-spaces)
- (when (looking-at "\\sw\\|(") (scala-forward-type)))
+ t)
(t
;; Type designator
(scala-forward-qual-ident)
(scala-forward-spaces)
- (when (and (not (eobp)) (= (char-after) ?\[))
- ;; Type arguments
- (forward-sexp))))
- t)
-
-(defun scala-forward-type ()
- ;; Move forward over a type.
+ (cond ((eobp) nil)
+ ((= (char-after) ?\[)
+ ;; Type arguments
+ (forward-sexp))
+ ((= (char-after) ?\#)
+ ;; Type selection
+ (forward-char)
+ (scala-forward-ident)))
+ t)))
+
+(defun scala-forward-type1 ()
+ ;; Move forward over a type1 (as defined by the grammar).
;; Works only when point is at the beginning of a type (modulo
;; initial spaces/comments).
(scala-forward-spaces)
@@ -228,6 +232,24 @@ reserved keywords when used alone.")
(scala-forward-simple-type)))
t)
+(defun scala-forward-type ()
+ ;; Move forward over a type.
+ (cond ((eobp) nil)
+ ((= (char-after) ?\()
+ ;; Function type (several arguments)
+ (forward-sexp)
+ (when (looking-at "\\s *=>\\s *")
+ (goto-char (match-end 0))
+ (scala-forward-type))
+ t)
+ (t
+ ;; Type1 or function type with one argument
+ (scala-forward-type1)
+ (when (looking-at "\\s *=>\\s *")
+ (goto-char (match-end 0))
+ (scala-forward-type))
+ t)))
+
(defun scala-forward-literal ()
;; Move forward over an integer, float, character or string literal.
(scala-forward-spaces)