]> code.delx.au - gnu-emacs-elpa/commitdiff
Fix up precision modifiers to base types
authorLawrence Mitchell <wence@gmx.li>
Thu, 26 Jan 2012 13:10:06 +0000 (13:10 +0000)
committerLawrence Mitchell <wence@gmx.li>
Thu, 26 Jan 2012 13:10:06 +0000 (13:10 +0000)
Previously we would parse character(len=*) as different from
character(len=128) and also integer(kind=c_int) as different from
integer.  Now we just throw the modifier away entirely.  This gives us
more false positives, but fewer false negatives when matching, which
is probably worthwhile.

f90-interface-browser.el
f90-tests.el

index 17afb417081e50f0718412ac215991ac1b4e07b8..49d84b3a02e5ea86be32e1cfa807515388eff960 100644 (file)
@@ -88,8 +88,8 @@
 ;;    end subroutine bar
 
 ;; Also not handled are overloaded operators, scalar precision
-;; modifiers (integer(kind=foo_integer) and the like) and many other
-;; aspects.
+;; modifiers, like integer(kind=c_int), for which the precision is
+;; just ignored, and many other aspects.
 
 ;;; Code:
 
@@ -991,13 +991,15 @@ dealt with correctly."
 This takes the bit before the :: and returns a list of the typename
 and any modifiers."
   (let ((things (f90-split-arglist dec)))
-    (cons (car things)
+    (cons (if (string-match
+               "\\([^(]+?\\)[ \t]*([ \t]*\\(:?len\\|kind\\)[ \t]*=[^)]+)"
+               (car things))
+              (match-string 1 (car things))
+            (car things))
           (loop for thing in (cdr things)
                 if (string-match "dimension[ \t]*(\\(.+\\))" thing)
                 collect (cons "dimension"
                               (1+ (f90-count-commas (match-string 1 thing))))
-                else if (string-match "character([^)]+)" thing)
-                collect (cons "character" "*")
                 else
                 collect thing))))
 
index 30020b67a12c62bf7754b4cb4d3bb95921a0b828..d65388235677275496c0d12d13751317fcf2acd2 100644 (file)
@@ -55,6 +55,7 @@
   (test-check
    ((f90-split-declaration "integer") ("integer"))
    ((f90-split-declaration "integer, pointer") ("integer" "pointer"))
+   ((f90-split-declaration "integer (kind = c_int(8)   )") ("integer"))
    ((f90-split-declaration "character(len=*)") ("character"))
    ((f90-split-declaration "integer, dimension(:)")
     ("integer" ("dimension" . 1)))))