diff options
author | Oleg Batrashev <ogbash@gmail.com> | 2013-05-21 06:31:53 (GMT) |
---|---|---|
committer | Oleg Batrashev <ogbash@gmail.com> | 2013-05-21 07:41:48 (GMT) |
commit | f138b8f35df95e5b7ab1525b9c1349fbc315aa2e (patch) | |
tree | c74bf7fe257d0cd35e778cb8683159ef715d852f /src/fortranscanner.l | |
parent | 3e8a7fbd38ae8d49cd34b812288ab5e4fcbf2515 (diff) | |
download | Doxygen-f138b8f35df95e5b7ab1525b9c1349fbc315aa2e.zip Doxygen-f138b8f35df95e5b7ab1525b9c1349fbc315aa2e.tar.gz Doxygen-f138b8f35df95e5b7ab1525b9c1349fbc315aa2e.tar.bz2 |
Prototype scan for function, does not yet catch parameter types.
Diffstat (limited to 'src/fortranscanner.l')
-rw-r--r-- | src/fortranscanner.l | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/fortranscanner.l b/src/fortranscanner.l index eae6d6e..66a6f6e 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; @@ -307,6 +308,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 +1106,23 @@ private { yy_pop_state(); } + /*-----Prototype parsing -------------------------------------------------------------------------*/ +<Prototype>{BS}{SUBPROG}{BS_} { + BEGIN(PrototypeSubprog); + } +<PrototypeSubprog>{ID}{BS} { current->name = yytext; + current->name.stripWhiteSpace(); + BEGIN(PrototypeArgs); + } +<PrototypeArgs>{ +"("|")"|","|{BS_} { current->args += yytext; } +{ID} { current->args += yytext; + Argument *a = new Argument; + a->name = yytext; + current->argList->append(a); + } +} + /*------------------------------------------------------------------------------------------------*/ <*>"\n" { @@ -1111,7 +1135,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 +2331,13 @@ void FortranLanguageScanner::resetCodeParserState() void FortranLanguageScanner::parsePrototype(const char *text) { - current->name = QCString(text).lower(); + QCString buffer = QCString(text).lower(); + pushBuffer(buffer); + parsingPrototype = TRUE; + BEGIN(Prototype); + fscanYYlex(); + parsingPrototype = FALSE; + popBuffer(); } static void scanner_abort() |