Fortran: fix handling of pointer association operator

Test case contributed by Adam Hirst, thanks.

Closes #1030.
This commit is contained in:
Colomban Wendling 2014-02-17 23:17:35 +01:00
parent 1c0fa99e1d
commit 7d76063282
4 changed files with 48 additions and 1 deletions

View File

@ -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))

View File

@ -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 \

32
tests/ctags/procpoint.f90 Normal file
View File

@ -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

View File

@ -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