Fixed problem parsing char-selector and invalid entity name.

git-svn-id: svn://svn.code.sf.net/p/ctags/code/trunk@290 c5d04d22-be80-434c-894e-aa346cc9e8e8
This commit is contained in:
darren 2003-03-05 04:36:07 +00:00
parent 2d52b0ebaf
commit 90b21a432b
3 changed files with 48 additions and 4 deletions

16
Test/char-selector.f90 Normal file
View File

@ -0,0 +1,16 @@
! Test for bug in parsing of char-selector
MODULE OUT_RD5
USE inmdmx
IMPLICIT NONE
SAVE
CHARACTER*(MXPATHLNGTH) temp
PRIVATE :: temp
INTEGER(4), PRIVATE, PARAMETER :: MXDDI=45
CHARACTER*40 titles(MXDDI)
PRIVATE :: titles
CHARACTER*12 units(MXDDI)
PRIVATE :: units
INTEGER(4), PRIVATE, DIMENSION (MXDDI+1) :: list
INTEGER(4), PRIVATE :: nout
END MODULE OUT_RD5

12
Test/invalid_name.f90 Normal file
View File

@ -0,0 +1,12 @@
! Test of parsing type with invalid name
Module TR_DetectionRecording
Implicit None
Save
Integer :: DR_Lun
Character*1024 DR_Filename
Type Detection_Record
Integer(2) :: Activity
Integer(2) :: Type ! "Type" not valid entity name
Integer(2) :: Face
End Type Detection_Record
End Module TR_DetectionRecording

View File

@ -1018,10 +1018,24 @@ static void parseTypeSpec (tokenInfo *const token)
Assert (isTypeSpec (token));
switch (token->keyword)
{
case KEYWORD_character:
readToken (token);
if (isType (token, TOKEN_OPERATOR) &&
strcmp (vStringValue (token->string), "*") == 0)
{
/* skip char-selector */
readToken (token);
if (isType (token, TOKEN_PAREN_OPEN))
skipOverParens (token);
else
readToken (token);
}
break;
case KEYWORD_integer:
case KEYWORD_real:
case KEYWORD_complex:
case KEYWORD_character:
case KEYWORD_logical:
readToken (token);
if (isType (token, TOKEN_PAREN_OPEN))
@ -1161,7 +1175,11 @@ static void parseEntityDecl (tokenInfo *const token)
{
while (! isType (token, TOKEN_COMMA) &&
! isType (token, TOKEN_STATEMENT_END))
{
readToken (token);
if (isType (token, TOKEN_PAREN_OPEN))
skipOverParens (token);
}
}
/* token left at either comma or statement end */
}
@ -1174,11 +1192,9 @@ static void parseEntityDeclList (tokenInfo *const token)
if (isType (token, TOKEN_COMMA))
readToken (token);
else if (isType (token, TOKEN_STATEMENT_END))
{
skipToNextStatement (token);
break;
}
}
skipToNextStatement (token);
}
/* type-declaration-stmt is