emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99463: Handle F2003 named interfaces


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99463: Handle F2003 named interfaces.
Date: Sat, 06 Feb 2010 17:41:45 -0800
User-agent: Bazaar (2.0.2)

------------------------------------------------------------
revno: 99463
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sat 2010-02-06 17:41:45 -0800
message:
  Handle F2003 named interfaces.
  
  * progmodes/f90.el (f90-font-lock-keywords-2)
  (f90-looking-at-type-like, f90-looking-at-program-block-end):
  Handle F2003 named interfaces.
modified:
  lisp/ChangeLog
  lisp/progmodes/f90.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-02-06 13:01:43 +0000
+++ b/lisp/ChangeLog    2010-02-07 01:41:45 +0000
@@ -1,3 +1,9 @@
+2010-02-07  Glenn Morris  <address@hidden>
+
+       * progmodes/f90.el (f90-font-lock-keywords-2)
+       (f90-looking-at-type-like, f90-looking-at-program-block-end):
+       Handle F2003 named interfaces.
+
 2010-02-06  Chong Yidong  <address@hidden>
 
        * progmodes/cc-mode.el (c-common-init): Bind temporary variables

=== modified file 'lisp/progmodes/f90.el'
--- a/lisp/progmodes/f90.el     2010-02-05 08:12:08 +0000
+++ b/lisp/progmodes/f90.el     2010-02-07 01:41:45 +0000
@@ -560,6 +560,12 @@
       (5 font-lock-function-name-face t) (6 'default t))
     ;; enum (F2003; must be followed by ", bind(C)").
     '("\\<\\(enum\\)[ \t]*," (1 font-lock-keyword-face))
+    ;; F2003.  Prevent operators being highlighted as constants.
+    '("\\<\\(\\(?:end[ \t]*\\)?interface[ \t]*\\(?:assignment\\|operator\\|\
+read\\|write\\)\\)[ \t]*(" (1 font-lock-keyword-face t))
+    ;; Interface blocks can be named in F2003.
+    '("\\<\\(\\(?:end[ \t]*\\)?interface\\)[ \t]*\\(\\sw+\\)?\\>"
+      (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
     ;; end do, enum (F2003), if, select, where, and forall constructs.
     '("\\<\\(end[ \t]*\\(do\\|if\\|enum\\|select\\|forall\\|where\\)\\)\\>\
 \\([ \t]+\\(\\sw+\\)\\)?"
@@ -1229,7 +1235,7 @@
 
 (defsubst f90-looking-at-type-like ()
   "Return (KIND NAME) if a type/enum/interface/block-data starts after point.
-NAME is non-nil only for type."
+NAME is non-nil only for type and certain interfaces."
   (cond
    ((save-excursion
       (and (looking-at "\\<type\\>[ \t]*")
@@ -1242,7 +1248,15 @@
 ;;;    ((and (not (looking-at f90-typeis-re))
 ;;;          (looking-at f90-type-def-re))
 ;;;     (list (match-string 1) (match-string 2)))
-   ((looking-at "\\(enum\\|interface\\|block[ \t]*data\\)\\>")
+   ((looking-at "\\<\\(interface\\)\\>[ \t]*")
+    (list (match-string 1)
+          (save-excursion
+            (goto-char (match-end 0))
+            (if (or (looking-at "\\(operator\\|assignment\\|read\\|\
+write\\)[ \t]*([^)\n]*)")
+                    (looking-at "\\sw+"))
+                (match-string 0)))))
+   ((looking-at "\\(enum\\|block[ \t]*data\\)\\>")
     (list (match-string 1) nil))
    ((looking-at "abstract[ \t]*\\(interface\\)\\>")
     (list (match-string 1) nil))))
@@ -1270,9 +1284,12 @@
 
 (defsubst f90-looking-at-program-block-end ()
   "Return (KIND NAME) if a block with name NAME ends after point."
-  (if (looking-at (concat "end[ \t]*" f90-blocks-re
-                          "?\\([ \t]+\\(\\sw+\\)\\)?\\>"))
-      (list (match-string 1) (match-string 3))))
+  (cond ((looking-at "end[ \t]*\\(interface\\)[ \t]*\\(\
+\\(?:assignment\\|operator\\|read\\|write\\)[ \t]*([^)\n]*)\\)")
+         (list (match-string 1) (match-string 2)))
+        ((looking-at (concat "end[ \t]*" f90-blocks-re
+                             "?\\([ \t]+\\(\\sw+\\)\\)?\\>"))
+        (list (match-string 1) (match-string 3)))))
 
 (defsubst f90-comment-indent ()
   "Return the indentation to be used for a comment starting at point.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]