Commit 772046d4 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Merge pull request #257 from albert-github/feature/bug_fortran_inline

Support for INLINE_SOURCES in Fortran
parents 03f779ae 940a802a
...@@ -472,6 +472,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* ...@@ -472,6 +472,7 @@ SCOPENAME ({ID}{BS}"::"{BS})*
} }
^{BS}interface{BS_}{ID}{ARGS}? { ifType = IF_GENERIC; ^{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); yy_push_state(InterfaceBody);
// extract generic name // extract generic name
...@@ -484,6 +485,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* ...@@ -484,6 +485,7 @@ SCOPENAME ({ID}{BS}"::"{BS})*
<InterfaceBody>^{BS}end{BS}interface({BS_}{ID})? { <InterfaceBody>^{BS}end{BS}interface({BS_}{ID})? {
// end scope only if GENERIC interface // end scope only if GENERIC interface
last_entry->parent()->endBodyLine = yyLineNr - 1;
if (ifType == IF_GENERIC && !endScope(current_root)) if (ifType == IF_GENERIC && !endScope(current_root))
yyterminate(); yyterminate();
...@@ -611,6 +613,7 @@ private { ...@@ -611,6 +613,7 @@ private {
current->name = yytext; current->name = yytext;
current->fileName = yyFileName; current->fileName = yyFileName;
current->bodyLine = yyLineNr; current->bodyLine = yyLineNr;
current->startLine = yyLineNr;
/* if type is part of a module, mod name is necessary for output */ /* if type is part of a module, mod name is necessary for output */
if ((current_root) && if ((current_root) &&
...@@ -651,6 +654,7 @@ private { ...@@ -651,6 +654,7 @@ private {
current->name = name; current->name = name;
current->fileName = yyFileName; current->fileName = yyFileName;
current->bodyLine = yyLineNr; current->bodyLine = yyLineNr;
current->startLine = yyLineNr;
addCurrentEntry(1); addCurrentEntry(1);
} }
{BS}"=>"[^(\n|\!)]* { /* Specific bindings come after the ID. */ {BS}"=>"[^(\n|\!)]* { /* Specific bindings come after the ID. */
...@@ -666,6 +670,7 @@ private { ...@@ -666,6 +670,7 @@ private {
<TypedefBody,TypedefBodyContains>{ <TypedefBody,TypedefBodyContains>{
^{BS}"end"{BS}"type"({BS_}{ID})?{BS}/(\n|!) { /* end type definition */ ^{BS}"end"{BS}"type"({BS_}{ID})?{BS}/(\n|!) { /* end type definition */
last_entry->parent()->endBodyLine = yyLineNr;
if (!endScope(current_root)) if (!endScope(current_root))
yyterminate(); yyterminate();
typeMode = false; typeMode = false;
...@@ -681,6 +686,7 @@ private { ...@@ -681,6 +686,7 @@ private {
// in a scope of their own, even if multiple // in a scope of their own, even if multiple
// are group in one INTERFACE/END INTERFACE block. // are group in one INTERFACE/END INTERFACE block.
// //
last_entry->endBodyLine = yyLineNr - 1;
if (ifType == IF_ABSTRACT || ifType == IF_SPECIFIC) if (ifType == IF_ABSTRACT || ifType == IF_SPECIFIC)
endScope(current_root); endScope(current_root);
...@@ -695,6 +701,8 @@ private { ...@@ -695,6 +701,8 @@ private {
} }
<Start,ModuleBody,TypedefBody,SubprogBody>{ <Start,ModuleBody,TypedefBody,SubprogBody>{
^{BS}{TYPE_SPEC}/{SEPARATE} { ^{BS}{TYPE_SPEC}/{SEPARATE} {
current->bodyLine = yyLineNr + 1;
current->endBodyLine = yyLineNr + lineCountPrepass;
/* variable declaration starts */ /* variable declaration starts */
if(YY_START == Start) if(YY_START == Start)
{ {
...@@ -806,6 +814,7 @@ private { ...@@ -806,6 +814,7 @@ private {
current->type = argType; current->type = argType;
current->fileName = yyFileName; current->fileName = yyFileName;
current->bodyLine = yyLineNr; // used for source reference current->bodyLine = yyLineNr; // used for source reference
current->startLine = yyLineNr;
addCurrentEntry(1); addCurrentEntry(1);
} }
else if (!argType.isEmpty()) else if (!argType.isEmpty())
...@@ -885,7 +894,8 @@ private { ...@@ -885,7 +894,8 @@ private {
// locate !< comment // locate !< comment
updateVariablePrepassComment(yyColNr-(int)yyleng, yyColNr); updateVariablePrepassComment(yyColNr-(int)yyleng, yyColNr);
} }
<Variable>{BS}"=" { yy_push_state(YY_START); <Variable>{BS}"=" {
yy_push_state(YY_START);
initializer="="; initializer="=";
initializerScope = initializerArrayScope = 0; initializerScope = initializerArrayScope = 0;
BEGIN(Initialization); BEGIN(Initialization);
...@@ -986,6 +996,8 @@ private { ...@@ -986,6 +996,8 @@ private {
result = QCString(yytext).stripWhiteSpace(); result = QCString(yytext).stripWhiteSpace();
addSubprogram(result); addSubprogram(result);
yy_push_state(Subprog); 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 */ } <Subprog>{BS} { /* ignore white space */ }
...@@ -1493,7 +1505,9 @@ static void copyEntry(Entry *dest, Entry *src) ...@@ -1493,7 +1505,9 @@ static void copyEntry(Entry *dest, Entry *src)
{ {
dest->type = src->type; dest->type = src->type;
dest->fileName = src->fileName; dest->fileName = src->fileName;
dest->startLine = src->startLine;
dest->bodyLine = src->bodyLine; dest->bodyLine = src->bodyLine;
dest->endBodyLine = src->endBodyLine;
dest->args = src->args; dest->args = src->args;
dest->argList = new ArgumentList(*src->argList); dest->argList = new ArgumentList(*src->argList);
dest->doc = src->doc; dest->doc = src->doc;
...@@ -2048,6 +2062,7 @@ static void addModule(const char *name, bool isModule) ...@@ -2048,6 +2062,7 @@ static void addModule(const char *name, bool isModule)
current->type = "program"; current->type = "program";
current->fileName = yyFileName; current->fileName = yyFileName;
current->bodyLine = yyLineNr; // used for source reference current->bodyLine = yyLineNr; // used for source reference
current->startLine = yyLineNr;
current->protection = Public ; current->protection = Public ;
addCurrentEntry(1); addCurrentEntry(1);
startScope(last_entry); startScope(last_entry);
...@@ -2064,8 +2079,8 @@ static void addSubprogram(const char *text) ...@@ -2064,8 +2079,8 @@ static void addSubprogram(const char *text)
current->type += " " + subtype; current->type += " " + subtype;
current->type = current->type.stripWhiteSpace(); current->type = current->type.stripWhiteSpace();
current->fileName = yyFileName; current->fileName = yyFileName;
current->bodyLine = yyLineNr; // used for source reference current->bodyLine = yyLineNr; // used for source reference start of body of routine
current->startLine = -1; // ??? what is startLine for? current->startLine = yyLineNr; // used for source reference start of definition
current->args.resize(0); current->args.resize(0);
current->argList->clear(); current->argList->clear();
docBlock.resize(0); docBlock.resize(0);
...@@ -2113,6 +2128,7 @@ static void addInterface(QCString name, InterfaceType type) ...@@ -2113,6 +2128,7 @@ static void addInterface(QCString name, InterfaceType type)
current->fileName = yyFileName; current->fileName = yyFileName;
current->bodyLine = yyLineNr; current->bodyLine = yyLineNr;
current->startLine = yyLineNr;
addCurrentEntry(1); addCurrentEntry(1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment