Skip to content

Commit

Permalink
Support for INLINE_SOURCES in Fortran
Browse files Browse the repository at this point in the history
Fortran does not yet support the INLINE_SOURCES, with this patch (part of) this omission is solved.
  • Loading branch information
albert-github committed Dec 7, 2014
1 parent 540f0b6 commit 940a802
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/fortranscanner.l
Expand Up @@ -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
Expand All @@ -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();

Expand Down Expand Up @@ -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) &&
Expand Down Expand Up @@ -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. */
Expand All @@ -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;
Expand All @@ -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);

Expand All @@ -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)
{
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */ }
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -2113,6 +2128,7 @@ static void addInterface(QCString name, InterfaceType type)

current->fileName = yyFileName;
current->bodyLine = yyLineNr;
current->startLine = yyLineNr;
addCurrentEntry(1);
}

Expand Down

0 comments on commit 940a802

Please sign in to comment.