Skip to content

Commit

Permalink
Bug 738063 - Fortran attribute contiguous not identified
Browse files Browse the repository at this point in the history
Added keywords contiguous and volatile
  • Loading branch information
albert-github committed Oct 11, 2014
1 parent 4df5291 commit 6da2e3f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/fortrancode.l
Expand Up @@ -694,7 +694,7 @@ CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS}))
TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}|TYPE|CLASS|PROCEDURE)

INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")"
ATTR_SPEC (IMPLICIT|ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|RECURSIVE|PURE|IMPURE|ELEMENTAL|VALUE|NOPASS|DEFERRED)
ATTR_SPEC (IMPLICIT|ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|RECURSIVE|PURE|IMPURE|ELEMENTAL|VALUE|NOPASS|DEFERRED|CONTIGUOUS|VOLATILE)
ACCESS_SPEC (PROTECTED|PRIVATE|PUBLIC)
/* Assume that attribute statements are almost the same as attributes. */
ATTR_STMT {ATTR_SPEC}|DIMENSION
Expand Down
26 changes: 24 additions & 2 deletions src/fortranscanner.l
Expand Up @@ -99,13 +99,15 @@ struct SymbolModifiers {
bool nonoverridable;
bool nopass;
bool pass;
bool contiguous;
bool volat; /* volatile is a reserverd name */
QCString passVar;

SymbolModifiers() : type(), returnName(), protection(NONE_P), direction(NONE_D),
optional(FALSE), protect(FALSE), dimension(), allocatable(FALSE),
external(FALSE), intrinsic(FALSE), parameter(FALSE),
pointer(FALSE), target(FALSE), save(FALSE), deferred(FALSE), nonoverridable(FALSE),
nopass(FALSE), pass(FALSE), passVar() {}
nopass(FALSE), pass(FALSE), contiguous(FALSE), volat(FALSE), passVar() {}

SymbolModifiers& operator|=(const SymbolModifiers &mdfs);
SymbolModifiers& operator|=(QCString mdfrString);
Expand Down Expand Up @@ -258,7 +260,7 @@ CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS}))
TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}|TYPE{ARGS}|CLASS{ARGS}|PROCEDURE{ARGS}?)

INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")"
ATTR_SPEC (EXTERNAL|ALLOCATABLE|DIMENSION{ARGS}|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|NOPASS|PASS{ARGS}?|DEFERRED|NON_OVERRIDABLE)
ATTR_SPEC (EXTERNAL|ALLOCATABLE|DIMENSION{ARGS}|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|NOPASS|PASS{ARGS}?|DEFERRED|NON_OVERRIDABLE|CONTIGUOUS|VOLATILE)
ACCESS_SPEC (PRIVATE|PUBLIC)
LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?")"
/* Assume that attribute statements are almost the same as attributes. */
Expand Down Expand Up @@ -1572,6 +1574,8 @@ SymbolModifiers& SymbolModifiers::operator|=(const SymbolModifiers &mdfs)
nopass |= mdfs.nopass;
pass |= mdfs.pass;
passVar = mdfs.passVar;
contiguous |= mdfs.contiguous;
volat |= mdfs.volat;
return *this;
}

Expand Down Expand Up @@ -1650,6 +1654,14 @@ SymbolModifiers& SymbolModifiers::operator|=(QCString mdfString)
{
newMdf.nonoverridable = TRUE;
}
else if (mdfString=="contiguous")
{
newMdf.contiguous = TRUE;
}
else if (mdfString=="volatile")
{
newMdf.volat = TRUE;
}
else if (mdfString.contains("pass"))
{
newMdf.pass = TRUE;
Expand Down Expand Up @@ -1804,6 +1816,16 @@ static QCString applyModifiers(QCString typeName, SymbolModifiers& mdfs)
if (!typeName.isEmpty()) typeName += ", ";
typeName += "protected";
}
if (mdfs.contiguous)
{
if (!typeName.isEmpty()) typeName += ", ";
typeName += "contiguous";
}
if (mdfs.volat)
{
if (!typeName.isEmpty()) typeName += ", ";
typeName += "volatile";
}

return typeName;
}
Expand Down

0 comments on commit 6da2e3f

Please sign in to comment.