Orb/Doxygen/src/code.l
changeset 4 468f4c8d3d5b
parent 0 42188c7ea2d9
equal deleted inserted replaced
3:d8fccb2cd802 4:468f4c8d3d5b
     1 /******************************************************************************
     1 /******************************************************************************
     2  *
     2  *
     3  * 
     3  * 
     4  *
     4  *
     5  * Copyright (C) 1997-2008 by Dimitri van Heesch.
     5  * Copyright (C) 1997-2010 by Dimitri van Heesch.
     6  *
     6  *
     7  * Permission to use, copy, modify, and distribute this software and its
     7  * Permission to use, copy, modify, and distribute this software and its
     8  * documentation under the terms of the GNU General Public License is hereby 
     8  * documentation under the terms of the GNU General Public License is hereby 
     9  * granted. No representations are made about the suitability of this software 
     9  * granted. No representations are made about the suitability of this software 
    10  * for any purpose. It is provided "as is" without express or implied warranty.
    10  * for any purpose. It is provided "as is" without express or implied warranty.
  1936   					  BEGIN( SkipCPP ) ; 
  1936   					  BEGIN( SkipCPP ) ; 
  1937 					}
  1937 					}
  1938 <SkipCPP>.				{ 
  1938 <SkipCPP>.				{ 
  1939   					  g_code->codify(yytext);
  1939   					  g_code->codify(yytext);
  1940 					}
  1940 					}
       
  1941 <SkipCPP>[^\n\/\\]+			{
       
  1942   					  g_code->codify(yytext);
       
  1943   					}
  1941 <SkipCPP>\\[\r]?\n			{ 
  1944 <SkipCPP>\\[\r]?\n			{ 
  1942   					  codifyLines(yytext);
  1945   					  codifyLines(yytext);
  1943 					}
  1946 					}
  1944 <SkipCPP>"//"				{ 
  1947 <SkipCPP>"//"				{ 
  1945   					  g_code->codify(yytext);
  1948   					  g_code->codify(yytext);
  3041     					  g_type.resize(0);
  3044     					  g_type.resize(0);
  3042 					  g_name.resize(0);
  3045 					  g_name.resize(0);
  3043 					  BEGIN(g_memCallContext); 
  3046 					  BEGIN(g_memCallContext); 
  3044 					}
  3047 					}
  3045 <*>\n({B}*"//"[!/][^\n]*\n)+		{ // remove special one-line comment
  3048 <*>\n({B}*"//"[!/][^\n]*\n)+		{ // remove special one-line comment
       
  3049 					  if (YY_START==SkipCPP) REJECT;
  3046   					  if (Config_getBool("STRIP_CODE_COMMENTS"))
  3050   					  if (Config_getBool("STRIP_CODE_COMMENTS"))
  3047 					  {
  3051 					  {
  3048 					    g_yyLineNr+=((QCString)yytext).contains('\n');
  3052 					    g_yyLineNr+=((QCString)yytext).contains('\n');
  3049 					    nextCodeLine();
  3053 					    nextCodeLine();
  3050 					  }
  3054 					  }
  3145 					    codifyLines(yytext);
  3149 					    codifyLines(yytext);
  3146 					    endFontClass();
  3150 					    endFontClass();
  3147 					  }
  3151 					  }
  3148   					}
  3152   					}
  3149 <*>"//"[!/][^\n]*\n			{ // strip special one-line comment
  3153 <*>"//"[!/][^\n]*\n			{ // strip special one-line comment
  3150                                           if (YY_START==SkipComment || YY_START==SkipString) REJECT;
  3154                                           if (YY_START==SkipComment || YY_START==SkipString || YY_START==SkipCPP) REJECT;
  3151   					  if (Config_getBool("STRIP_CODE_COMMENTS"))
  3155   					  if (Config_getBool("STRIP_CODE_COMMENTS"))
  3152 					  {
  3156 					  {
  3153 					    char c[2]; c[0]='\n'; c[1]=0;
  3157 					    char c[2]; c[0]='\n'; c[1]=0;
  3154 					    codifyLines(c);
  3158 					    codifyLines(c);
  3155 					  }
  3159 					  }
  3337 }
  3341 }
  3338 
  3342 
  3339 void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, 
  3343 void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, 
  3340                   bool exBlock, const char *exName,FileDef *fd,
  3344                   bool exBlock, const char *exName,FileDef *fd,
  3341 		  int startLine,int endLine,bool inlineFragment,
  3345 		  int startLine,int endLine,bool inlineFragment,
  3342 		  MemberDef *memberDef)
  3346 		  MemberDef *memberDef,bool showLineNumbers)
  3343 {
  3347 {
  3344   //printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd);
  3348   //printf("***parseCode() exBlock=%d exName=%s fd=%p\n",exBlock,exName,fd);
  3345   if (s.isEmpty()) return;
  3349   if (s.isEmpty()) return;
  3346   if (g_codeClassSDict==0)
  3350   if (g_codeClassSDict==0)
  3347   {
  3351   {
  3372   g_scopeStack.clear();
  3376   g_scopeStack.clear();
  3373   g_classScope    = className;
  3377   g_classScope    = className;
  3374   g_exampleBlock  = exBlock; 
  3378   g_exampleBlock  = exBlock; 
  3375   g_exampleName   = exName;
  3379   g_exampleName   = exName;
  3376   g_sourceFileDef = fd;
  3380   g_sourceFileDef = fd;
  3377   g_lineNumbers   = fd!=0;
  3381   g_lineNumbers   = fd!=0 && showLineNumbers;
  3378   if (exBlock && fd==0)
  3382   if (exBlock && fd==0)
  3379   {
  3383   {
  3380     // create a dummy filedef for the example
  3384     // create a dummy filedef for the example
  3381     g_sourceFileDef = new FileDef("",exName);
  3385     g_sourceFileDef = new FileDef("",exName);
  3382   }
  3386   }