From 7d760632824efacd44231f89d46de3a1deac64ec Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Mon, 17 Feb 2014 23:17:35 +0100 Subject: [PATCH] Fortran: fix handling of pointer association operator Test case contributed by Adam Hirst, thanks. Closes #1030. --- tagmanager/ctags/fortran.c | 3 ++- tests/ctags/Makefile.am | 1 + tests/ctags/procpoint.f90 | 32 ++++++++++++++++++++++++++++++++ tests/ctags/procpoint.f90.tags | 13 +++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/ctags/procpoint.f90 create mode 100644 tests/ctags/procpoint.f90.tags diff --git a/tagmanager/ctags/fortran.c b/tagmanager/ctags/fortran.c index b3c17eb4..1eb1a1c5 100644 --- a/tagmanager/ctags/fortran.c +++ b/tagmanager/ctags/fortran.c @@ -1371,7 +1371,8 @@ static void parseEntityDecl (tokenInfo *const token) readToken (token); skipPast (token, TOKEN_OPERATOR); } - else if (strcmp (vStringValue (token->string), "=") == 0) + else if (strcmp (vStringValue (token->string), "=") == 0 || + strcmp (vStringValue (token->string), "=>") == 0) { while (! isType (token, TOKEN_COMMA) && ! isType (token, TOKEN_STATEMENT_END)) diff --git a/tests/ctags/Makefile.am b/tests/ctags/Makefile.am index 40c33810..d0382fdf 100644 --- a/tests/ctags/Makefile.am +++ b/tests/ctags/Makefile.am @@ -193,6 +193,7 @@ test_sources = \ Package.pm \ php5_5_class_kw.php \ procedure_pointer_module.f90 \ + procpoint.f90 \ property.cs \ prototype.h \ pure_elem.f95 \ diff --git a/tests/ctags/procpoint.f90 b/tests/ctags/procpoint.f90 new file mode 100644 index 00000000..896b60d0 --- /dev/null +++ b/tests/ctags/procpoint.f90 @@ -0,0 +1,32 @@ +module Test + implicit none + + procedure(ProcOne), pointer :: MyProc => null(), & + MyOtherProc => ProcTwo + real, parameter :: myparameter + +contains + + function ProcOne(arg1, optformat) + ! not relevant + end function ProcOne + + function ProcTwo(arg1, optformat) + ! not relevant + end function ProcTwo + +end module Test + +program Main + implicit none + + ! deliberately break up the line to make sure the tagparser doesn't choke on awkward cases + procedure(:), pointer :: ProcPointOne & + => null(), ProcPointTwo => & + null() + real :: variable, variable_two + integer :: variable_three + + ProcPointOne => ProcTwo + +end program Main diff --git a/tests/ctags/procpoint.f90.tags b/tests/ctags/procpoint.f90.tags new file mode 100644 index 00000000..852e8a8a --- /dev/null +++ b/tests/ctags/procpoint.f90.tags @@ -0,0 +1,13 @@ +# format=tagmanager +MainÌ512Ö0 +MyOtherProcÌ16384ÎTestÖ0 +MyProcÌ16384ÎTestÖ0 +ProcOneÌ16ÎTestÖ0 +ProcPointOneÌ16384ÎMainÖ0 +ProcPointTwoÌ16384ÎMainÖ0 +ProcTwoÌ16ÎTestÖ0 +TestÌ256Ö0 +myparameterÌ16384ÎTestÖ0 +variableÌ16384ÎMainÖ0 +variable_threeÌ16384ÎMainÖ0 +variable_twoÌ16384ÎMainÖ0