diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2013-05-22 20:25:10 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2013-05-22 20:25:10 (GMT) |
commit | 38059b8ba618218c07aa092507e9370fe6c4ee10 (patch) | |
tree | 3d7c3a24c0fe54fac1413a4502f9919474bfcb32 /src | |
parent | 9bfa0dd11ca387c0c937b253d0aff4c2225ec7b2 (diff) | |
parent | be4c107ab25c862469bab23897df2d7a7445c4a4 (diff) | |
download | Doxygen-38059b8ba618218c07aa092507e9370fe6c4ee10.zip Doxygen-38059b8ba618218c07aa092507e9370fe6c4ee10.tar.gz Doxygen-38059b8ba618218c07aa092507e9370fe6c4ee10.tar.bz2 |
Merge pull request #7 from ogbash/experimental/prototype
Fortran: parse prototype in out-of-place documentation
Diffstat (limited to 'src')
-rw-r--r-- | src/fortranscanner.l | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/fortranscanner.l b/src/fortranscanner.l index eae6d6e..278367c 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -187,6 +187,7 @@ static InterfaceType ifType = IF_NONE; static bool functionLine = FALSE; static char stringStartSymbol; // single or double quote +static bool parsingPrototype = FALSE; // see parsePrototype() //! Accumulated modifiers of current statement, eg variable declaration. static SymbolModifiers currentModifiers; @@ -265,6 +266,7 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} CONTAINS CONTAINS PREFIX (RECURSIVE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,2}(RECURSIVE|PURE|ELEMENTAL)? +SCOPENAME ({ID}{BS}"::"{BS})* %option noyywrap %option stack @@ -307,6 +309,12 @@ PREFIX (RECURSIVE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,2}(RECURSIVE|PURE|ELEMENTA %x EndDoc %x BlockData + +/** prototype parsing */ +%x Prototype +%x PrototypeSubprog +%x PrototypeArgs + %% /*-----------------------------------------------------------------------------------*/ @@ -1099,6 +1107,24 @@ private { yy_pop_state(); } + /*-----Prototype parsing -------------------------------------------------------------------------*/ +<Prototype>{BS}{SUBPROG}{BS_} { + BEGIN(PrototypeSubprog); + } +<Prototype,PrototypeSubprog>{BS}{SCOPENAME}?{BS}{ID} { + current->name = QCString(yytext).lower(); + current->name.stripWhiteSpace(); + BEGIN(PrototypeArgs); + } +<PrototypeArgs>{ +"("|")"|","|{BS_} { current->args += yytext; } +{ID} { current->args += yytext; + Argument *a = new Argument; + a->name = QCString(yytext).lower(); + current->argList->append(a); + } +} + /*------------------------------------------------------------------------------------------------*/ <*>"\n" { @@ -1111,7 +1137,10 @@ private { /*---- error: EOF in wrong state --------------------------------------------------------------------*/ <*><<EOF>> { - if ( include_stack_ptr <= 0 ) { + if (parsingPrototype) { + yyterminate(); + + } else if ( include_stack_ptr <= 0 ) { if (YY_START!=INITIAL && YY_START!=Start) { DBG_CTX((stderr,"==== Error: EOF reached in wrong state (end missing)")); scanner_abort(); @@ -2304,7 +2333,13 @@ void FortranLanguageScanner::resetCodeParserState() void FortranLanguageScanner::parsePrototype(const char *text) { - current->name = QCString(text).lower(); + QCString buffer = QCString(text); + pushBuffer(buffer); + parsingPrototype = TRUE; + BEGIN(Prototype); + fscanYYlex(); + parsingPrototype = FALSE; + popBuffer(); } static void scanner_abort() |