Skip to content
Browse files

Fortran: add support for "len" and "kind" qualifiers

Test cases contributed by Adam Hirst, thanks.
  • Loading branch information...
1 parent ed1dc50 commit d8954bbf67d575883a3fb3687e776cb92793d88c @b4n b4n committed Feb 22, 2014
View
6 tagmanager/ctags/fortran.c
@@ -100,6 +100,8 @@ typedef enum eKeywordId {
KEYWORD_intent,
KEYWORD_interface,
KEYWORD_intrinsic,
+ KEYWORD_kind,
+ KEYWORD_len,
KEYWORD_logical,
KEYWORD_map,
KEYWORD_module,
@@ -280,6 +282,8 @@ static const keywordDesc FortranKeywordTable [] = {
{ "intent", KEYWORD_intent },
{ "interface", KEYWORD_interface },
{ "intrinsic", KEYWORD_intrinsic },
+ { "kind", KEYWORD_kind },
+ { "len", KEYWORD_len },
{ "logical", KEYWORD_logical },
{ "map", KEYWORD_map },
{ "module", KEYWORD_module },
@@ -1331,6 +1335,8 @@ static void parseQualifierSpecList (tokenInfo *const token)
case KEYWORD_allocatable:
case KEYWORD_external:
case KEYWORD_intrinsic:
+ case KEYWORD_kind:
+ case KEYWORD_len:
case KEYWORD_optional:
case KEYWORD_private:
case KEYWORD_pointer:
View
2 tests/ctags/Makefile.am
@@ -179,6 +179,7 @@ test_sources = \
matlab_backtracking.m \
matlab_test.m \
maze.erl \
+ members.f90 \
misc_types.f90 \
misc_types.f \
mode.php \
@@ -202,6 +203,7 @@ test_sources = \
prototype.h \
pure_elem.f95 \
py_constructor_arglist.py \
+ qualified_types.f90 \
random.sql \
readlob.sql \
readlong.sql \
View
19 tests/ctags/members.f90
@@ -0,0 +1,19 @@
+module Members
+ implicit none
+
+ type HasMembers
+ ! a "derived type" in Fortran is analagous to a "class" in other languages
+ integer, kind :: kind_member
+ integer, len :: len_member
+ integer :: member
+ contains
+ procedure :: MyMethod
+ end type HasMembers
+
+contains
+
+ subroutine MySubroutine(arg)
+ ! ...
+ end subroutine MySubroutine
+
+end module Members
View
8 tests/ctags/members.f90.tags
@@ -0,0 +1,8 @@
+# format=tagmanager
+HasMembers1Members0
+Members2560
+MyMethod64HasMembers0
+MySubroutine128Members0
+kind_member64HasMembers0
+len_member64HasMembers0
+member64HasMembers0
View
12 tests/ctags/qualified_types.f90
@@ -0,0 +1,12 @@
+module test
+ implicit none
+ type goodtype(p1, p2, p3, p4) ! the stuff in brackets after the name of the type shouldn't appear in the type's name
+ ! this is already correctly handled, so that's fine
+ integer, kind :: p1, p3
+ integer, len :: p2, p4 ! the question is whether or not these "kind" and "len"s should be shown as members
+ real(kind=p1) :: c1
+ character(len=p2) :: c2
+ complex :: c3(p3)
+ integer :: c4 = p1
+contains
+end module test
View
11 tests/ctags/qualified_types.f90.tags
@@ -0,0 +1,11 @@
+# format=tagmanager
+c164goodtype0
+c264goodtype0
+c364goodtype0
+c464goodtype0
+goodtype1test0
+p164goodtype0
+p264goodtype0
+p364goodtype0
+p464goodtype0
+test2560

0 comments on commit d8954bb

Please sign in to comment.
Something went wrong with that request. Please try again.