summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/fortranscanner.l22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index 8415e43..835e07d 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -472,6 +472,7 @@ SCOPENAME ({ID}{BS}"::"{BS})*
}
^{BS}interface{BS_}{ID}{ARGS}? { ifType = IF_GENERIC;
+ current->bodyLine = yyLineNr + lineCountPrepass + 1; // we have to be at the line after the definition and we have to take continuation lines into account.
yy_push_state(InterfaceBody);
// extract generic name
@@ -484,6 +485,7 @@ SCOPENAME ({ID}{BS}"::"{BS})*
<InterfaceBody>^{BS}end{BS}interface({BS_}{ID})? {
// end scope only if GENERIC interface
+ last_entry->parent()->endBodyLine = yyLineNr - 1;
if (ifType == IF_GENERIC && !endScope(current_root))
yyterminate();
@@ -611,6 +613,7 @@ private {
current->name = yytext;
current->fileName = yyFileName;
current->bodyLine = yyLineNr;
+ current->startLine = yyLineNr;
/* if type is part of a module, mod name is necessary for output */
if ((current_root) &&
@@ -651,6 +654,7 @@ private {
current->name = name;
current->fileName = yyFileName;
current->bodyLine = yyLineNr;
+ current->startLine = yyLineNr;
addCurrentEntry(1);
}
{BS}"=>"[^(\n|\!)]* { /* Specific bindings come after the ID. */
@@ -666,6 +670,7 @@ private {
<TypedefBody,TypedefBodyContains>{
^{BS}"end"{BS}"type"({BS_}{ID})?{BS}/(\n|!) { /* end type definition */
+ last_entry->parent()->endBodyLine = yyLineNr;
if (!endScope(current_root))
yyterminate();
typeMode = false;
@@ -681,6 +686,7 @@ private {
// in a scope of their own, even if multiple
// are group in one INTERFACE/END INTERFACE block.
//
+ last_entry->endBodyLine = yyLineNr - 1;
if (ifType == IF_ABSTRACT || ifType == IF_SPECIFIC)
endScope(current_root);
@@ -695,6 +701,8 @@ private {
}
<Start,ModuleBody,TypedefBody,SubprogBody>{
^{BS}{TYPE_SPEC}/{SEPARATE} {
+ current->bodyLine = yyLineNr + 1;
+ current->endBodyLine = yyLineNr + lineCountPrepass;
/* variable declaration starts */
if(YY_START == Start)
{
@@ -806,6 +814,7 @@ private {
current->type = argType;
current->fileName = yyFileName;
current->bodyLine = yyLineNr; // used for source reference
+ current->startLine = yyLineNr;
addCurrentEntry(1);
}
else if (!argType.isEmpty())
@@ -885,7 +894,8 @@ private {
// locate !< comment
updateVariablePrepassComment(yyColNr-(int)yyleng, yyColNr);
}
-<Variable>{BS}"=" { yy_push_state(YY_START);
+<Variable>{BS}"=" {
+ yy_push_state(YY_START);
initializer="=";
initializerScope = initializerArrayScope = 0;
BEGIN(Initialization);
@@ -986,6 +996,8 @@ private {
result = QCString(yytext).stripWhiteSpace();
addSubprogram(result);
yy_push_state(Subprog);
+ current->bodyLine = yyLineNr + lineCountPrepass + 1; // we have to be at the line after the definition and we have to take continuation lines into account.
+ current->startLine = yyLineNr;
}
<Subprog>{BS} { /* ignore white space */ }
@@ -1493,7 +1505,9 @@ static void copyEntry(Entry *dest, Entry *src)
{
dest->type = src->type;
dest->fileName = src->fileName;
+ dest->startLine = src->startLine;
dest->bodyLine = src->bodyLine;
+ dest->endBodyLine = src->endBodyLine;
dest->args = src->args;
dest->argList = new ArgumentList(*src->argList);
dest->doc = src->doc;
@@ -2048,6 +2062,7 @@ static void addModule(const char *name, bool isModule)
current->type = "program";
current->fileName = yyFileName;
current->bodyLine = yyLineNr; // used for source reference
+ current->startLine = yyLineNr;
current->protection = Public ;
addCurrentEntry(1);
startScope(last_entry);
@@ -2064,8 +2079,8 @@ static void addSubprogram(const char *text)
current->type += " " + subtype;
current->type = current->type.stripWhiteSpace();
current->fileName = yyFileName;
- current->bodyLine = yyLineNr; // used for source reference
- current->startLine = -1; // ??? what is startLine for?
+ current->bodyLine = yyLineNr; // used for source reference start of body of routine
+ current->startLine = yyLineNr; // used for source reference start of definition
current->args.resize(0);
current->argList->clear();
docBlock.resize(0);
@@ -2113,6 +2128,7 @@ static void addInterface(QCString name, InterfaceType type)
current->fileName = yyFileName;
current->bodyLine = yyLineNr;
+ current->startLine = yyLineNr;
addCurrentEntry(1);
}