diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2004-11-29 19:11:02 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2004-11-29 19:11:02 (GMT) |
commit | 02aa9b678dbeb1867c68278045b28d7bc1683f7c (patch) | |
tree | ae4f833eab5f7b63e139145daee905c412ebd229 /src/scanner.l | |
parent | 05930245579c006f2b5bfca53e0a1976d682f9b8 (diff) | |
download | Doxygen-02aa9b678dbeb1867c68278045b28d7bc1683f7c.zip Doxygen-02aa9b678dbeb1867c68278045b28d7bc1683f7c.tar.gz Doxygen-02aa9b678dbeb1867c68278045b28d7bc1683f7c.tar.bz2 |
Release-1.3.9.1-20041129
Diffstat (limited to 'src/scanner.l')
-rw-r--r-- | src/scanner.l | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/src/scanner.l b/src/scanner.l index 8dbd70c..a8f552e 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -30,6 +30,7 @@ #include <qstack.h> #include <qregexp.h> #include <unistd.h> +#include <qfile.h> #include "scanner.h" #include "entry.h" @@ -54,6 +55,7 @@ */ static const char * inputString; static int inputPosition; +static QFile inputFile; static int lastContext; static int lastCContext; static int lastDocContext; @@ -169,6 +171,7 @@ static QCString g_skipBlockName; static QCString oldStyleArgType; static QCString docBackup; static QCString briefBackup; +static bool g_inputFromFile; //----------------------------------------------------------------------------- @@ -644,11 +647,21 @@ static void addKnRArgInfo(const QCString &type,const QCString &name, static int yyread(char *buf,int max_size) { int c=0; - while( c < max_size && inputString[inputPosition] ) +#ifdef USE_TMP_FILE + if (g_inputFromFile) { + c = inputFile.readBlock(buf,max_size); + if (c==-1) yy_fatal_error("input in flex scanner failed"); + } + else +#endif + { + while( c < max_size && inputString[inputPosition] ) + { *buf = inputString[inputPosition++] ; //printf("%d (%c)\n",*buf,*buf); c++; buf++; + } } return c; } @@ -5925,6 +5938,7 @@ static void newDocState() static void parseCompounds(Entry *rt) { //printf("parseCompounds(%s)\n",rt->name.data()); + g_inputFromFile = FALSE; EntryListIterator eli(*rt->sublist); Entry *ce; for (;(ce=eli.current());++eli) @@ -6019,10 +6033,55 @@ static void parseCompounds(Entry *rt) } //---------------------------------------------------------------------------- +#ifdef USE_TMP_FILE + +void parseMain(Entry *rt,const char *fileName) +{ + initParser(); + g_inputFromFile = TRUE; + anonCount = 0; + depthIf = 0; + protection = Public; + mtype = Method; + gstat = FALSE; + virt = Normal; + current_root = rt; + global_root = rt; + inputFile.setName(fileName); + if (inputFile.open(IO_ReadOnly)) + { + current = new Entry; + inputPosition = 0; + scanYYrestart( scanYYin ); + BEGIN( FindMembers ); + scanYYlex(); + if (YY_START==Comment) + { + warn(yyFileName,yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?"); + } + + forceEndGroup(); + + if (depthIf>0) + { + warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!"); + } + + rt->program.resize(0); + delete current; current=0; + + parseCompounds(rt); + + inputFile.close(); + } +} + +#else void parseMain(Entry *rt) { initParser(); + g_inputFromFile = FALSE; anonCount = 0; depthIf = 0; protection = Public; @@ -6054,6 +6113,10 @@ void parseMain(Entry *rt) parseCompounds(rt); } +#endif + +//---------------------------------------------------------------------------- + #if !defined(YY_FLEX_SUBMINOR_VERSION) //---------------------------------------------------------------------------- extern "C" { // some bogus code to keep the compiler happy |