Commit 3c0a246b authored by Albert's avatar Albert
Browse files

Debug output for lexical analyzer

In case of error messages like:
    input buffer overflow, can't enlarge buffer because scanner uses REJECT
it is not always directly clear from which lexical analyzer (.l file) this problem comes.
This patch helps to find these problems and does the following things:
- when using the option -d lex with doxygen each time a lexical analyzer is called at the start a line like the following line will be given:
    Entering lexical analyzer: pre.l (for: ..../file.c)
  and at the end:
    Finished lexical analyzer: pre.l (for: ..../file.c)
- in case the lexical analyzer has been translated with the -d option of lex / flex the above mentioned lines will be given as part of the lexical analyzer output (to stderr) and look like:
    --entering lexical analyzer: pre.l (for: ..../file.c)
    --finished lexical analyzer: pre.l (for: ..../file.c)
parent e4b819d6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3546,7 +3546,11 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s,
{
  //printf("***parseCode() exBlock=%d exName=%s fd=%p className=%s searchCtx=%s\n",
  //      exBlock,exName,fd,className,searchCtx?searchCtx->name().data():"<none>");

  if (s.isEmpty()) return;

  printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL);

  TooltipManager::instance()->clearTooltips();
  if (g_codeClassSDict==0)
  {
@@ -3637,6 +3641,8 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s,
    delete g_sourceFileDef;
    g_sourceFileDef=0;
  }

  printlex(yy_flex_debug, FALSE, __FILE__, fd ? fd->fileName().data(): NULL);
  return;
}

+2 −0
Original line number Diff line number Diff line
@@ -952,6 +952,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
  g_condStack.clear();
  g_condStack.setAutoDelete(TRUE);

  printlex(yy_flex_debug, TRUE, __FILE__, fileName);
  isFixedForm = FALSE;
  if (g_lang==SrcLangExt_Fortran)
  {
@@ -981,6 +982,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
    g_outBuf->at(g_outBuf->curPos())='\0';
    msg("-------------\n%s\n-------------\n",g_outBuf->data());
  }
  printlex(yy_flex_debug, FALSE, __FILE__, fileName);
}


+2 −0
Original line number Diff line number Diff line
@@ -2818,6 +2818,7 @@ bool parseCommentBlock(/* in */ ParserInterface *parser,
  g_spaceBeforeCmd.resize(0);
  g_spaceBeforeIf.resize(0);

  printlex(yy_flex_debug, TRUE, __FILE__, fileName ? fileName.data(): NULL);
  if (!current->inbodyDocs.isEmpty() && isInbody) // separate in body fragments
  {
    current->inbodyDocs+="\n\n";
@@ -2894,6 +2895,7 @@ bool parseCommentBlock(/* in */ ParserInterface *parser,
  //printf("position=%d parseMore=%d newEntryNeeded=%d\n",
  //  position,parseMore,newEntryNeeded);

  printlex(yy_flex_debug, FALSE, __FILE__, fileName ? fileName.data(): NULL);
  return parseMore;
}

+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include "constexp.h"  
#include "cppvalue.h"
#include "ce_parse.h" // generated header file
#include "message.h"

#define YY_NEVER_INTERACTIVE 1
#define YY_NO_INPUT 1
@@ -105,6 +106,7 @@ CONSTSUFFIX ([uU][lL]?[lL]?)|([lL][lL]?[uU]?)

bool parseconstexp(const char *fileName,int lineNr,const QCString &s)
{
  printlex(yy_flex_debug, TRUE, __FILE__, fileName);
  //printf("Expression: `%s'\n",s.data());
  g_constExpFileName = fileName;
  g_constExpLineNr = lineNr;
@@ -113,6 +115,7 @@ bool parseconstexp(const char *fileName,int lineNr,const QCString &s)
  constexpYYrestart( constexpYYin );
  constexpYYparse();
  //printf("Result: %ld\n",(long)g_resultValue);
  printlex(yy_flex_debug, FALSE, __FILE__, fileName);
  return (long)g_resultValue!=0;
}

+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ static LabelMap s_labels[] =
  { "extcmd",       Debug::ExtCmd       },
  { "markdown",     Debug::Markdown     },
  { "filteroutput", Debug::FilterOutput },
  { "lex",          Debug::Lex },
  { 0,             (Debug::DebugMask)0  }
};

Loading