Imported Upstream version 1.9.1
[platform/upstream/doxygen.git] / src / commentcnv.l
1 /*****************************************************************************
2  *
3  * 
4  *
5  * Copyright (C) 1997-2015 by Dimitri van Heesch.
6  *
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 
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.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17 %option never-interactive
18 %option prefix="commentcnvYY"
19 %option reentrant
20 %option extra-type="struct commentcnvYY_state *"
21 %top{
22 #include <stdint.h>
23 }
24
25 %{
26
27   
28 #include <stdio.h>
29 #include <stdlib.h>
30
31 #include <qstack.h>
32 #include <qregexp.h>
33 #include <qtextstream.h>
34 #include <qglobal.h>
35
36 #include "bufstr.h"
37 #include "debug.h"
38 #include "message.h"
39 #include "config.h"
40 #include "doxygen.h"
41 #include "util.h"
42 #include "condparser.h"
43
44 #include <assert.h>
45
46 #define YY_NO_INPUT 1
47 #define YY_NO_UNISTD_H 1
48
49 #define ADDCHAR(c)    yyextra->outBuf->addChar(c)
50 #define ADDARRAY(a,s) yyextra->outBuf->addArray(a,s)
51
52 #define USE_STATE2STRING 0
53   
54 struct CondCtx
55 {
56   CondCtx(int line,QCString id,bool b) 
57     : lineNr(line),sectionId(id), skip(b) {}
58   int lineNr;
59   QCString sectionId;
60   bool skip;
61 };
62   
63 struct CommentCtx
64 {
65   CommentCtx(int line) 
66     : lineNr(line) {}
67   int lineNr;
68 };
69   
70 struct commentcnvYY_state
71 {
72   BufStr * inBuf = 0;
73   BufStr * outBuf = 0;
74   yy_size_t inBufPos = 0;
75   int      col = 0;
76   int      blockHeadCol = 0;
77   bool     mlBrief = FALSE;
78   int      readLineCtx = 0;
79   bool     skip = FALSE;
80   QCString fileName;
81   int      lineNr = 0;
82   int      condCtx = 0;
83   QStack<CondCtx> condStack;
84   QStack<CommentCtx> commentStack;
85   QCString blockName;
86   int      lastCommentContext = 0;
87   bool     inSpecialComment = FALSE;
88   bool     inRoseComment= FALSE;
89   int      stringContext = 0;
90   int      charContext = 0;
91   int      javaBlock = 0;
92   bool     specialComment = FALSE;
93
94   QCString aliasString;
95   int      blockCount = 0;
96   bool     lastEscaped = FALSE;
97   int      lastBlockContext= 0;
98   bool     pythonDocString = FALSE;
99   int      nestingCount= 0;
100
101   bool     vhdl = FALSE; // for VHDL old style --! comment
102
103   SrcLangExt lang = SrcLangExt_Unknown;
104   bool       isFixedForm = FALSE; // For Fortran
105 };
106
107 #if USE_STATE2STRING
108 static const char *stateToString(int state);
109 #endif
110 static inline int computeIndent(const char *s);
111
112 static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len);
113 static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len);
114 static void startCondSection(yyscan_t yyscanner,const char *sectId);
115 static void endCondSection(yyscan_t yyscanner);
116 static void handleCondSectionId(yyscan_t yyscanner,const char *expression);
117 static void replaceAliases(yyscan_t yyscanner,const char *s);
118 static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
119 static void replaceComment(yyscan_t yyscanner,int offset);
120
121
122
123
124 #undef  YY_INPUT
125 #define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
126
127
128 %}
129
130 MAILADR   ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+
131
132 %option noyywrap
133
134 %x Scan
135 %x SkipString
136 %x SkipChar
137 %x SComment
138 %x CComment
139 %x Verbatim
140 %x VerbatimCode
141 %x ReadLine
142 %x CondLine
143 %x ReadAliasArgs
144
145   //- start: NUMBER -------------------------------------------------------------------------
146   // Note same defines in code.l: keep in sync
147 DECIMAL_INTEGER  [1-9][0-9']*[0-9]?[uU]?[lL]?[lL]?
148 HEXADECIMAL_INTEGER  "0"[xX][0-9a-zA-Z']+[0-9a-zA-Z]?
149 OCTAL_INTEGER  "0"[0-7][0-7']+[0-7]?
150 BINARY_INTEGER  "0"[bB][01][01']*[01]?
151 INTEGER_NUMBER {DECIMAL_INTEGER}|{HEXADECIMAL_INTEGER}|{OCTAL_INTEGER}|{BINARY_INTEGER}
152
153 FP_SUF [fFlL]
154
155 DIGIT_SEQ [0-9][0-9']*[0-9]?
156 FRAC_CONST {DIGIT_SEQ}"."|{DIGIT_SEQ}?"."{DIGIT_SEQ}
157 FP_EXP [eE][+-]?{DIGIT_SEQ}
158 DEC_FP1 {FRAC_CONST}{FP_EXP}?{FP_SUF}?
159 DEC_FP2 {DIGIT_SEQ}{FP_EXP}{FP_SUF}
160
161 HEX_DIGIT_SEQ [0-9a-fA-F][0-9a-fA-F']*[0-9a-fA-F]?
162 HEX_FRAC_CONST {HEX_DIGIT_SEQ}"."|{HEX_DIGIT_SEQ}?"."{HEX_DIGIT_SEQ}
163 BIN_EXP [pP][+-]?{DIGIT_SEQ}
164 HEX_FP1 "0"[xX]{HEX_FRAC_CONST}{BIN_EXP}{FP_SUF}?
165 HEX_FP2 "0"[xX]{HEX_DIGIT_SEQ}{BIN_EXP}{FP_SUF}?
166
167 FLOAT_DECIMAL {DEC_FP1}|{DEC_FP2}
168 FLOAT_HEXADECIMAL {HEX_FP1}|{HEX_FP2}
169 FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL}
170 NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
171   //- end: NUMBER ---------------------------------------------------------------------------
172
173 %%
174
175 <Scan>{NUMBER}                      { //Note similar code in code.l
176                                       if (yyextra->lang!=SrcLangExt_Cpp) REJECT;
177                                       copyToOutput(yyscanner,yytext,(int)yyleng); 
178                                     }
179 <Scan>[^"'!\/\n\\#,\-=; \t]*        { /* eat anything that is not " / , or \n */
180                                        copyToOutput(yyscanner,yytext,(int)yyleng);
181                                     }
182 <Scan>[,= ;\t]                      { /* eat , so we have a nice separator in long initialization lines */ 
183                                        copyToOutput(yyscanner,yytext,(int)yyleng);
184                                     }
185 <Scan>"\"\"\""!                     { /* start of python long comment */
186                                      if (yyextra->lang!=SrcLangExt_Python)
187                                      {
188                                        REJECT;
189                                      }
190                                      else
191                                      {
192                                        yyextra->pythonDocString = TRUE;
193                                        yyextra->nestingCount=1;
194                                        yyextra->commentStack.clear(); /*  to be on the save side */
195                                        copyToOutput(yyscanner,yytext,(int)yyleng);
196                                        BEGIN(CComment);
197                                        yyextra->commentStack.push(new CommentCtx(yyextra->lineNr));
198                                      }
199                                    }
200 <Scan>![><!]/.*\n          {
201                                      if (yyextra->lang!=SrcLangExt_Fortran)
202                                      {
203                                        REJECT;
204                                      }
205                                      else
206                                      {
207                                        copyToOutput(yyscanner,yytext,(int)yyleng); 
208                                        yyextra->nestingCount=0; // Fortran doesn't have an end comment
209                                        yyextra->commentStack.clear(); /*  to be on the save side */
210                                        BEGIN(CComment);
211                                        yyextra->commentStack.push(new CommentCtx(yyextra->lineNr));
212                                      }
213                                    }
214 <Scan>[Cc\*][><!]/.*\n     {
215                                      if (yyextra->lang!=SrcLangExt_Fortran)
216                                      {
217                                        REJECT;
218                                      }
219                                      else
220                                      {
221                                        /* check for fixed format; we might have some conditional as part of multiline if like C<5 .and. & */
222                                        if (yyextra->isFixedForm && (yyextra->col == 0))
223                                        {
224                                          copyToOutput(yyscanner,yytext,(int)yyleng); 
225                                          yyextra->nestingCount=0; // Fortran doesn't have an end comment
226                                          yyextra->commentStack.clear(); /* to be on the safe side */
227                                          BEGIN(CComment);
228                                          yyextra->commentStack.push(new CommentCtx(yyextra->lineNr));
229                                        }
230                                        else
231                                        {
232                                          REJECT;
233                                        }
234                                      }
235                                    }
236 <Scan>!.*\n                {
237                                      if (yyextra->lang!=SrcLangExt_Fortran)
238                                      {
239                                        REJECT;
240                                      }
241                                      else
242                                      {
243                                        copyToOutput(yyscanner,yytext,(int)yyleng); 
244                                      }
245                                    }
246 <Scan>[Cc\*].*\n                   {
247                                      if (yyextra->lang!=SrcLangExt_Fortran)
248                                      {
249                                        REJECT;
250                                      }
251                                      else
252                                      {
253                                        if (yyextra->col == 0)
254                                        {
255                                          copyToOutput(yyscanner,yytext,(int)yyleng); 
256                                        }
257                                        else
258                                        {
259                                          REJECT;
260                                        }
261                                      }
262                                    }
263 <Scan>"\""                         { /* start of a string */ 
264                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
265                                      yyextra->stringContext = YY_START;
266                                      BEGIN(SkipString); 
267                                    }
268 <Scan>'                            {
269                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
270                                      yyextra->charContext = YY_START;
271                                      if (yyextra->lang!=SrcLangExt_VHDL)
272                                      {
273                                        BEGIN(SkipChar);
274                                      }
275                                    }
276 <Scan>\n                           { /* new line */ 
277                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
278                                    }
279 <Scan>"//!"/.*\n[ \t]*"//"[\/!][^\/] | /* start C++ style special comment block */
280 <Scan>("///"[/]*)/[^/].*\n[ \t]*"//"[\/!][^\/] { /* start C++ style special comment block */
281                                      if (yyextra->mlBrief) 
282                                      {
283                                        REJECT; // bail out if we do not need to convert
284                                      }
285                                      else
286                                      {
287                                        int i=3;
288                                        if (yytext[2]=='/')
289                                        {
290                                          while (i<(int)yyleng && yytext[i]=='/') i++;
291                                        }
292                                        yyextra->blockHeadCol=yyextra->col;
293                                        copyToOutput(yyscanner,"/**",3); 
294                                        replaceAliases(yyscanner,yytext+i);
295                                        yyextra->inSpecialComment=TRUE;
296                                        //BEGIN(SComment); 
297                                        yyextra->readLineCtx=SComment;
298                                        BEGIN(ReadLine);
299                                      }
300                                    }
301 <Scan>"//##Documentation".*/\n     { /* Start of Rational Rose ANSI C++ comment block */
302                                      if (yyextra->mlBrief) REJECT;
303                                      int i=17; //=strlen("//##Documentation");
304                                      yyextra->blockHeadCol=yyextra->col;
305                                      copyToOutput(yyscanner,"/**",3);
306                                      replaceAliases(yyscanner,yytext+i);
307                                      yyextra->inRoseComment=TRUE;
308                                      BEGIN(SComment);
309                                    }
310 <Scan>"//"[!\/]/.*\n[ \t]*"//"[|\/][ \t]*[@\\]"}" { // next line contains an end marker, see bug 752712
311                                      yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!';
312                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
313                                      yyextra->readLineCtx=YY_START;
314                                      BEGIN(ReadLine);
315                                    }
316 <Scan>"//"/.*\n                    { /* one line C++ comment */ 
317                                      yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!';
318                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
319                                      yyextra->readLineCtx=YY_START;
320                                      BEGIN(ReadLine);
321                                    }
322 <Scan>"/**/"                       { /* avoid matching next rule for empty C comment, see bug 711723 */
323                                      copyToOutput(yyscanner,yytext,(int)yyleng);
324                                    }
325 <Scan>"/*"[*!]?                    { /* start of a C comment */
326                                      if (yyextra->lang==SrcLangExt_Python)
327                                      {
328                                        REJECT;
329                                      }
330                                      yyextra->specialComment=(int)yyleng==3;
331                                      yyextra->nestingCount=1;
332                                      yyextra->commentStack.clear(); /*  to be on the save side */
333                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
334                                      BEGIN(CComment); 
335                                      yyextra->commentStack.push(new CommentCtx(yyextra->lineNr));
336                                    }
337 <Scan>"#"("#")?                    {
338                                      if (yyextra->lang!=SrcLangExt_Python)
339                                      {
340                                        REJECT;
341                                      }
342                                      else
343                                      {
344                                        copyToOutput(yyscanner,yytext,(int)yyleng); 
345                                        yyextra->nestingCount=0; // Python doesn't have an end comment for #
346                                        yyextra->commentStack.clear(); /*  to be on the save side */
347                                        BEGIN(CComment);
348                                        yyextra->commentStack.push(new CommentCtx(yyextra->lineNr));
349                                      }
350                                    }
351 <Scan>"--"[^!][^\n]*               {
352                                      if (yyextra->lang!=SrcLangExt_VHDL)
353                                      {
354                                        REJECT;
355                                      }
356                                      else
357                                      {
358                                        copyToOutput(yyscanner,yytext,(int)yyleng); 
359                                      }
360                                    }
361 <Scan>"--!"                        {
362                                      if (yyextra->lang!=SrcLangExt_VHDL)
363                                      {
364                                        REJECT;
365                                      }
366                                      else
367                                      {
368                                        yyextra->vhdl = TRUE;
369                                        copyToOutput(yyscanner,yytext,(int)yyleng); 
370                                        yyextra->nestingCount=0;  // VHDL doesn't have an end comment
371                                        yyextra->commentStack.clear(); /*  to be on the save side */
372                                        BEGIN(CComment);
373                                        yyextra->commentStack.push(new CommentCtx(yyextra->lineNr));
374                                      }
375                                    }
376 <Scan>![><!]                       {
377                                      if (yyextra->lang!=SrcLangExt_Fortran)
378                                      {
379                                        REJECT;
380                                      }
381                                      else
382                                      {
383                                        copyToOutput(yyscanner,yytext,(int)yyleng); 
384                                        yyextra->nestingCount=0;  // Fortran doesn't have an end comment
385                                        yyextra->commentStack.clear(); /*  to be on the save side */
386                                        BEGIN(CComment);
387                                        yyextra->commentStack.push(new CommentCtx(yyextra->lineNr));
388                                      }
389                                    }
390 <CComment,ReadLine>{MAILADR}      |
391 <CComment,ReadLine>"<"{MAILADR}">" { // Mail address, to prevent seeing e.g x@code-factory.org as start of a code block
392                                      copyToOutput(yyscanner,yytext,(int)yyleng);
393                                    }
394 <CComment>"{@code"/[ \t\n]         {
395                                      copyToOutput(yyscanner,"@code",5); 
396                                      yyextra->lastCommentContext = YY_START;
397                                      yyextra->javaBlock=1;
398                                      yyextra->blockName=&yytext[1];
399                                      BEGIN(VerbatimCode);
400                                    }
401 <CComment,ReadLine>^[ \t]*("```"[`]*|"~~~"[~]*) { /* start of markdown code block */
402                                      if (!Config_getBool(MARKDOWN_SUPPORT))
403                                      {
404                                        REJECT;
405                                      }
406                                      copyToOutput(yyscanner,yytext,(int)yyleng);
407                                      yyextra->lastCommentContext = YY_START;
408                                      yyextra->javaBlock=0;
409                                      yyextra->blockName=QCString(yytext).stripWhiteSpace().left(3);
410                                      BEGIN(VerbatimCode);
411                                    }
412 <CComment,ReadLine>[\\@]("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */
413                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
414                                      yyextra->lastCommentContext = YY_START;
415                                      yyextra->javaBlock=0;
416                                      if (qstrcmp(&yytext[1],"startuml")==0)
417                                      {
418                                        yyextra->blockName="uml";
419                                      }
420                                      else
421                                      {
422                                        yyextra->blockName=&yytext[1];
423                                      }
424                                      BEGIN(VerbatimCode);
425                                    }
426 <CComment,ReadLine>[\\@]("f$"|"f["|"f{") {
427                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
428                                      yyextra->blockName=&yytext[1];
429                                      if (yyextra->blockName.at(1)=='[')
430                                      {
431                                        yyextra->blockName.at(1)=']';
432                                      }
433                                      else if (yyextra->blockName.at(1)=='{')
434                                      {
435                                        yyextra->blockName.at(1)='}';
436                                      }
437                                      yyextra->lastCommentContext = YY_START;
438                                      BEGIN(Verbatim);
439                                    }
440 <CComment,ReadLine>[\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly")/[^a-z_A-Z0-9] { /* start of a verbatim block */
441                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
442                                      yyextra->blockName=&yytext[1];
443                                      yyextra->lastCommentContext = YY_START;
444                                      BEGIN(Verbatim);
445                                    }
446 <Scan>.                            { /* any other character */
447                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
448                                    }
449 <Verbatim>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}") { /* end of verbatim block */
450                                      copyToOutput(yyscanner,yytext,(int)yyleng);
451                                      if (&yytext[1]==yyextra->blockName) // end of formula
452                                      {
453                                        BEGIN(yyextra->lastCommentContext);
454                                      }
455                                      else if (&yytext[4]==yyextra->blockName)
456                                      {
457                                        BEGIN(yyextra->lastCommentContext);
458                                      }
459                                    }
460 <VerbatimCode>"{"                  {
461                                      if (yyextra->javaBlock==0)
462                                      {
463                                        REJECT;
464                                      }
465                                      else
466                                      {
467                                        yyextra->javaBlock++;
468                                        copyToOutput(yyscanner,yytext,(int)yyleng);
469                                      }
470                                    }
471 <VerbatimCode>"}"                  {
472                                      if (yyextra->javaBlock==0)
473                                      {
474                                        REJECT;
475                                      }
476                                      else
477                                      {
478                                        yyextra->javaBlock--;
479                                        if (yyextra->javaBlock==0)
480                                        {
481                                          copyToOutput(yyscanner," @endcode ",10);
482                                          BEGIN(yyextra->lastCommentContext);
483                                        }
484                                        else
485                                        {
486                                          copyToOutput(yyscanner,yytext,(int)yyleng);
487                                        }
488                                      }
489                                    }
490 <VerbatimCode>("```"[`]*|"~~~"[~]*) { /* end of markdown code block */
491                                      copyToOutput(yyscanner,yytext,(int)yyleng);
492                                      if (yytext[0]==yyextra->blockName[0])
493                                      {
494                                        BEGIN(yyextra->lastCommentContext);
495                                      }
496                                    }
497 <VerbatimCode>[\\@]("enddot"|"endcode"|"endmsc"|"enduml") { /* end of verbatim block */
498                                      copyToOutput(yyscanner,yytext,(int)yyleng);
499                                      if (&yytext[4]==yyextra->blockName)
500                                      {
501                                        BEGIN(yyextra->lastCommentContext);
502                                      }
503                                    }
504 <VerbatimCode>^[ \t]*"//"[\!\/]?   { /* skip leading comments */
505                                      if (!yyextra->inSpecialComment)
506                                      {
507                                        copyToOutput(yyscanner,yytext,(int)yyleng); 
508                                      }
509                                      else
510                                      {
511                                        int l=0;
512                                        while (yytext[l]==' ' || yytext[l]=='\t')
513                                        {
514                                          l++;
515                                        }
516                                        copyToOutput(yyscanner,yytext,l);
517                                        if (yyleng-l==3) // ends with //! or ///
518                                        {
519                                          copyToOutput(yyscanner," * ",3);
520                                        }
521                                        else // ends with //
522                                        {
523                                          copyToOutput(yyscanner,"//",2);
524                                        }
525                                      }
526                                    }
527 <Verbatim,VerbatimCode>[^`~@\/\\\n{}]* { /* any character not a backslash or new line or } */
528                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
529                                    }
530 <Verbatim,VerbatimCode>\n          { /* new line in verbatim block */
531                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
532                                    }
533 <Verbatim>^[ \t]*"//"[/!]          {
534                                      if (yyextra->blockName=="dot" || yyextra->blockName=="msc" || yyextra->blockName=="uml" || yyextra->blockName.at(0)=='f')
535                                      {
536                                        // see bug 487871, strip /// from dot images and formulas.
537                                        int l=0;
538                                        while (yytext[l]==' ' || yytext[l]=='\t')
539                                        {
540                                          l++;
541                                        }
542                                        copyToOutput(yyscanner,yytext,l);
543                                        copyToOutput(yyscanner,"   ",3);
544                                      }
545                                      else // even slashes are verbatim (e.g. \verbatim, \code)
546                                      {
547                                        REJECT;
548                                      }
549                                    }
550 <Verbatim,VerbatimCode>.           { /* any other character */
551                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
552                                    }
553 <SkipString>\\.                    { /* escaped character in string */
554                                      if (yyextra->lang==SrcLangExt_Fortran || yyextra->lang==SrcLangExt_VHDL)
555                                      {
556                                        unput(yytext[1]);
557                                        copyToOutput(yyscanner,yytext,1);
558                                      }
559                                      else
560                                      {
561                                        copyToOutput(yyscanner,yytext,(int)yyleng);
562                                      }
563                                    }
564 <SkipString>"\""                   { /* end of string */ 
565                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
566                                      BEGIN(yyextra->stringContext); 
567                                    }
568 <SkipString>.                      { /* any other string character */ 
569                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
570                                    }
571 <SkipString>\n                     { /* new line inside string (illegal for some compilers) */ 
572                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
573                                    }
574 <SkipChar>\\.                      { /* escaped character */
575                                      if (yyextra->lang==SrcLangExt_Fortran || yyextra->lang==SrcLangExt_VHDL)
576                                      {
577                                        unput(yytext[1]);
578                                        copyToOutput(yyscanner,yytext,1);
579                                      }
580                                      else
581                                      {
582                                        copyToOutput(yyscanner,yytext,(int)yyleng);
583                                      }
584                                    }
585 <SkipChar>'                        { /* end of character literal */ 
586                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
587                                      BEGIN(yyextra->charContext);
588                                    }
589 <SkipChar>.                        { /* any other string character */ 
590                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
591                                    }
592 <SkipChar>\n                       { /* new line character */
593                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
594                                    }
595
596 <CComment>[^ `~<\\!@*\n{\"\/]*     { /* anything that is not a '*' or command */ 
597                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
598                                    }
599 <CComment>"*"+[^*/\\@\n{\"]*       { /* stars without slashes */
600                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
601                                    }
602 <CComment>"\"\"\""                 { /* end of Python docstring */
603                                      if (yyextra->lang!=SrcLangExt_Python)
604                                      {
605                                        REJECT;
606                                      }
607                                      else
608                                      {
609                                        yyextra->nestingCount--;
610                                        yyextra->pythonDocString = FALSE;
611                                        copyToOutput(yyscanner,yytext,(int)yyleng);
612                                        BEGIN(Scan);
613                                      }
614                                    }
615 <CComment>\n                       { /* new line in comment */
616                                      copyToOutput(yyscanner,yytext,(int)yyleng);
617                                      /* in case of Fortran always end of comment */
618                                      if (yyextra->lang==SrcLangExt_Fortran)
619                                      {
620                                        BEGIN(Scan);
621                                      }
622                                    }
623 <CComment>"/"+"*"                  { /* nested C comment */
624                                      if (yyextra->lang==SrcLangExt_Python ||
625                                          yyextra->lang==SrcLangExt_Markdown)
626                                      {
627                                        REJECT;
628                                      }
629                                      yyextra->nestingCount++;
630                                      yyextra->commentStack.push(new CommentCtx(yyextra->lineNr));
631                                      copyToOutput(yyscanner,yytext,(int)yyleng);
632                                    }
633 <CComment>"*"+"/"                  { /* end of C comment */
634                                      if (yyextra->lang==SrcLangExt_Python ||
635                                          yyextra->lang==SrcLangExt_Markdown)
636                                      {
637                                        REJECT;
638                                      }
639                                      else
640                                      {
641                                        copyToOutput(yyscanner,yytext,(int)yyleng);
642                                        yyextra->nestingCount--;
643                                        if (yyextra->nestingCount<=0)
644                                        {
645                                          BEGIN(Scan);
646                                        }
647                                        else
648                                        {
649                                          //yyextra->nestingCount--;
650                                          delete yyextra->commentStack.pop();
651                                        }
652                                      }
653                                    }
654   /* Python an VHDL share CComment, so special attention for ending comments is required */
655 <CComment>"\n"/[ \t]*"#"           {
656                                      if (yyextra->lang!=SrcLangExt_VHDL)
657                                      {
658                                        REJECT;
659                                      }
660                                      else
661                                      {
662                                        if (yyextra->vhdl) // inside --! comment
663                                        {
664                                          yyextra->vhdl = FALSE;
665                                          copyToOutput(yyscanner,yytext,(int)yyleng);
666                                          BEGIN(Scan);
667                                        }
668                                        else // C-type comment
669                                        {
670                                          REJECT;
671                                        }
672                                      }
673                                    }
674 <CComment>"\n"/[ \t]*"-"           {
675                                      if (yyextra->lang!=SrcLangExt_Python || yyextra->pythonDocString)
676                                      {
677                                        REJECT;
678                                      }
679                                      else
680                                      {
681                                        copyToOutput(yyscanner,yytext,(int)yyleng);
682                                        BEGIN(Scan);
683                                      }
684                                    }
685 <CComment>"\n"/[ \t]*[^ \t#\-]     {
686                                      if (yyextra->lang==SrcLangExt_Python)
687                                      {
688                                        if (yyextra->pythonDocString)
689                                        {
690                                          REJECT;
691                                        }
692                                        else
693                                        {
694                                          copyToOutput(yyscanner,yytext,(int)yyleng);
695                                          BEGIN(Scan);
696                                        }
697                                      }
698                                      else if (yyextra->lang==SrcLangExt_VHDL)
699                                      {
700                                        if (yyextra->vhdl) // inside --! comment
701                                        {
702                                          yyextra->vhdl = FALSE;
703                                          copyToOutput(yyscanner,yytext,(int)yyleng);
704                                          BEGIN(Scan);
705                                        }
706                                        else // C-type comment
707                                        {
708                                          REJECT;
709                                        }
710                                      }
711                                      else
712                                      {
713                                        REJECT;
714                                      }
715                                    }
716    /* removed for bug 674842 (bug was introduced in rev 768)
717 <CComment>"'"                      {
718                                      yyextra->charContext = YY_START;
719                                      copyToOutput(yyscanner,yytext,(int)yyleng);
720                                      BEGIN(SkipChar);
721                                    }
722 <CComment>"\""                     {
723                                      yyextra->stringContext = YY_START;
724                                      copyToOutput(yyscanner,yytext,(int)yyleng);
725                                      BEGIN(SkipString);
726                                    }
727    */
728 <CComment>.                        {
729                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
730                                    }
731 <SComment>^[ \t]*"///"[\/]*/\n     {
732                                      replaceComment(yyscanner,0);
733                                    }
734 <SComment>\n[ \t]*"///"[\/]*/\n    {
735                                      replaceComment(yyscanner,1); 
736                                    }
737 <SComment>^[ \t]*"///"[^\/\n]/.*\n { 
738                                      replaceComment(yyscanner,0);
739                                      yyextra->readLineCtx=YY_START;
740                                      BEGIN(ReadLine);
741                                    }
742 <SComment>\n[ \t]*"//"[\/!]("<")?[ \t]*[\\@]"}".*\n {   
743                                      /* See Bug 752712: end the multiline comment when finding a @} or \} command */
744                                      copyToOutput(yyscanner," */",3); 
745                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
746                                      yyextra->inSpecialComment=FALSE;
747                                      yyextra->inRoseComment=FALSE;
748                                      BEGIN(Scan); 
749                                    }
750 <SComment>\n[ \t]*"///"[^\/\n]/.*\n  { 
751                                      replaceComment(yyscanner,1); 
752                                      yyextra->readLineCtx=YY_START;
753                                      BEGIN(ReadLine);
754                                    }
755 <SComment>^[ \t]*"//!"             |    // just //!
756 <SComment>^[ \t]*"//!<"/.*\n       |    // or   //!< something
757 <SComment>^[ \t]*"//!"[^<]/.*\n    {    // or   //!something
758                                      replaceComment(yyscanner,0);
759                                      yyextra->readLineCtx=YY_START;
760                                      BEGIN(ReadLine);
761                                    }
762 <SComment>\n[ \t]*"//!"            |
763 <SComment>\n[ \t]*"//!<"/.*\n      |
764 <SComment>\n[ \t]*"//!"[^<\n]/.*\n { 
765                                      replaceComment(yyscanner,1); 
766                                      yyextra->readLineCtx=YY_START;
767                                      BEGIN(ReadLine);
768                                    }
769 <SComment>^[ \t]*"//##"/.*\n       {
770                                      if (!yyextra->inRoseComment)
771                                      {
772                                        REJECT;
773                                      }
774                                      else
775                                      {
776                                        replaceComment(yyscanner,0);
777                                        yyextra->readLineCtx=YY_START;
778                                        BEGIN(ReadLine);
779                                      }
780                                    }
781 <SComment>\n[ \t]*"//##"/.*\n      {
782                                      if (!yyextra->inRoseComment)
783                                      {
784                                        REJECT;
785                                      }
786                                      else
787                                      {
788                                        replaceComment(yyscanner,1); 
789                                        yyextra->readLineCtx=YY_START;
790                                        BEGIN(ReadLine);
791                                      }
792                                    }
793 <SComment>\n                       { /* end of special comment */
794                                      copyToOutput(yyscanner," */",3); 
795                                      copyToOutput(yyscanner,yytext,(int)yyleng); 
796                                      yyextra->inSpecialComment=FALSE;
797                                      yyextra->inRoseComment=FALSE;
798                                      BEGIN(Scan); 
799                                    }
800 <ReadLine>"/**"                    {
801                                      copyToOutput(yyscanner,"/&zwj;**",8);
802                                    }
803 <ReadLine>"*/"                     {
804                                      copyToOutput(yyscanner,"*&zwj;/",7);
805                                    }
806 <ReadLine>"*"                      {
807                                      copyToOutput(yyscanner,yytext,(int)yyleng);
808                                    }
809 <ReadLine>[^\\@\n\*/]*             {
810                                      copyToOutput(yyscanner,yytext,(int)yyleng);
811                                    }
812 <ReadLine>[^\\@\n\*/]*/\n          {
813                                      copyToOutput(yyscanner,yytext,(int)yyleng);
814                                      BEGIN(yyextra->readLineCtx);
815                                    }
816 <CComment,ReadLine>[\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command
817                                      copyToOutput(yyscanner,yytext,(int)yyleng);
818                                    }
819 <CComment,ReadLine>[\\@]"cond"/[^a-z_A-Z0-9]       { // conditional section
820                                      yyextra->condCtx = YY_START; 
821                                      BEGIN(CondLine);
822                                    }
823 <CComment,ReadLine>[\\@]"endcond"/[^a-z_A-Z0-9] { // end of conditional section
824                                      bool oldSkip=yyextra->skip;
825                                      endCondSection(yyscanner);
826                                      if (YY_START==CComment && oldSkip && !yyextra->skip) 
827                                      {
828                                        //printf("** Adding start of comment!\n");
829                                        if (yyextra->lang!=SrcLangExt_Python &&
830                                            yyextra->lang!=SrcLangExt_VHDL &&
831                                            yyextra->lang!=SrcLangExt_Markdown &&
832                                            yyextra->lang!=SrcLangExt_Fortran)
833                                        {
834                                          ADDCHAR('/');
835                                          ADDCHAR('*');
836                                          if (yyextra->specialComment)
837                                          {
838                                            ADDCHAR('*');
839                                          }
840                                        }
841                                      }
842                                     }
843 <CondLine>[!()&| \ta-z_A-Z0-9.\-]+ {
844                                      handleCondSectionId(yyscanner,yytext);
845                                    }
846 <CComment,ReadLine>[\\@]"cond"[ \t\r]*/\n {
847                                      yyextra->condCtx=YY_START;
848                                      handleCondSectionId(yyscanner," "); // fake section id causing the section to be hidden unconditionally
849                                    }
850 <CondLine>.                        { // forgot section id?
851                                      handleCondSectionId(yyscanner," "); // fake section id causing the section to be hidden unconditionally
852                                      if (*yytext=='\n') yyextra->lineNr++;
853                                    }
854 <CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]*  { // expand alias without arguments
855                                      replaceAliases(yyscanner,yytext);
856                                    }
857 <CComment,ReadLine>[\\@][a-z_A-Z][a-z_A-Z0-9]*"{" { // expand alias with arguments
858                                      yyextra->lastBlockContext=YY_START;
859                                      yyextra->blockCount=1;
860                                      yyextra->aliasString=yytext;
861                                      yyextra->lastEscaped=0;
862                                      BEGIN( ReadAliasArgs );
863                                    }
864 <ReadAliasArgs>^[ \t]*"//"[/!]/[^\n]+   { // skip leading special comments (see bug 618079)
865                                    }
866 <ReadAliasArgs>"*/"                { // oops, end of comment in the middle of an alias?
867                                      if (yyextra->lang==SrcLangExt_Python)
868                                      {
869                                        REJECT;
870                                      }
871                                      else // abort the alias, restart scanning
872                                      {
873                                        copyToOutput(yyscanner,yyextra->aliasString,yyextra->aliasString.length());
874                                        copyToOutput(yyscanner,yytext,(int)yyleng);
875                                        BEGIN(Scan);
876                                      }
877                                    }
878 <ReadAliasArgs>[^{}\n\\\*]+        {
879                                      yyextra->aliasString+=yytext;
880                                      yyextra->lastEscaped=FALSE;
881                                    }
882 <ReadAliasArgs>"\\"                {
883                                      if (yyextra->lastEscaped)  yyextra->lastEscaped=FALSE;
884                                      else                yyextra->lastEscaped=TRUE;
885                                      yyextra->aliasString+=yytext;
886                                    }
887 <ReadAliasArgs>\n                  {
888                                      yyextra->aliasString+=yytext;
889                                      yyextra->lineNr++;
890                                      yyextra->lastEscaped=FALSE;
891                                    }
892 <ReadAliasArgs>"{"                 {
893                                      yyextra->aliasString+=yytext;
894                                      if (!yyextra->lastEscaped) yyextra->blockCount++;
895                                      yyextra->lastEscaped=FALSE;
896                                    }
897 <ReadAliasArgs>"}"                 {
898                                      yyextra->aliasString+=yytext;
899                                      if (!yyextra->lastEscaped) yyextra->blockCount--;
900                                      if (yyextra->blockCount==0)
901                                      {
902                                        replaceAliases(yyscanner,yyextra->aliasString);
903                                        BEGIN( yyextra->lastBlockContext );
904                                      }
905                                      yyextra->lastEscaped=FALSE;
906                                    }
907 <ReadAliasArgs>.                   {
908                                      yyextra->aliasString+=yytext;
909                                      yyextra->lastEscaped=FALSE;
910                                    }
911 <ReadLine>.                        {
912                                      copyToOutput(yyscanner,yytext,(int)yyleng);
913                                    }
914
915 <*>.                               {
916                                      copyToOutput(yyscanner,yytext,(int)yyleng);
917                                    }
918 %%
919
920 static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len)
921 {
922   struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
923   const char *p=s;
924   char c;
925   // copy leading blanks
926   while ((c=*p) && (c==' ' || c=='\t' || c=='\n')) 
927   {
928     ADDCHAR(c);
929     yyextra->lineNr += c=='\n';
930     p++;
931   }
932   // replace start of comment marker by blanks and the last character by a *
933   int blanks=0;
934   while ((c=*p) && (c=='/' || c=='!' || c=='#')) 
935   {
936     blanks++;
937     p++;
938     if (*p=='<') // comment-after-item marker 
939     { 
940       blanks++;
941       p++; 
942     }
943     if (c=='!') // end after first !
944     {
945       break;
946     }
947   }
948   if (blanks>0)
949   {
950     while (blanks>2)
951     {
952       ADDCHAR(' ');
953       blanks--;
954     }
955     if (blanks>1) ADDCHAR('*');
956     ADDCHAR(' ');
957   }
958   // copy comment line to output
959   ADDARRAY(p,len-(int)(p-s));
960 }
961
962 static inline int computeIndent(const char *s)
963 {
964   int col=0;
965   static int tabSize=Config_getInt(TAB_SIZE);
966   const char *p=s;
967   char c;
968   while ((c=*p++))
969   {
970     if (c==' ') col++;
971     else if (c=='\t') col+=tabSize-(col%tabSize); 
972     else break;
973   }
974   return col;
975 }
976
977 static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len)
978 {
979   int tabSize=Config_getInt(TAB_SIZE);
980   struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
981   int i;
982   if (yyextra->skip) // only add newlines.
983   {
984     for (i=0;i<len;i++)
985     {
986       switch(s[i])
987       {
988         case '\n':
989           ADDCHAR('\n');
990           yyextra->lineNr++;
991           yyextra->col=0;
992           break;
993         case '\t':
994           yyextra->col+=tabSize-(yyextra->col%tabSize);
995           break;
996         default:
997           yyextra->col++;
998           break;
999       }
1000     }
1001   }
1002   else if (len>0)
1003   {
1004     ADDARRAY(s,len);
1005     for (i=0;i<len;i++) 
1006     {
1007       switch (s[i])
1008       {
1009         case '\n': yyextra->col=0; 
1010                    //fprintf(stderr,"---> copy %d\n",g_lineNr);
1011                    yyextra->lineNr++; break;
1012         case '\t': yyextra->col+=tabSize-(yyextra->col%tabSize); break;
1013         default:   yyextra->col++; break;
1014       }
1015     }
1016   }
1017 }
1018
1019 static void startCondSection(yyscan_t yyscanner,const char *sectId)
1020 {
1021   struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1022   //printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count());
1023   CondParser prs;
1024   bool expResult = prs.parse(yyextra->fileName,yyextra->lineNr,sectId);
1025   yyextra->condStack.push(new CondCtx(yyextra->lineNr,sectId,yyextra->skip));
1026   if (!expResult) // not enabled
1027   {
1028     yyextra->skip=TRUE;
1029   }
1030 }
1031
1032 static void endCondSection(yyscan_t yyscanner)
1033 {
1034   struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1035   if (yyextra->condStack.isEmpty())
1036   {
1037     warn(yyextra->fileName,yyextra->lineNr,"Found \\endcond command without matching \\cond");
1038     yyextra->skip=FALSE;
1039   }
1040   else
1041   {
1042     CondCtx *ctx = yyextra->condStack.pop();
1043     yyextra->skip=ctx->skip;
1044   }
1045   //printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count());
1046 }
1047
1048 static void handleCondSectionId(yyscan_t yyscanner,const char *expression)
1049 {
1050   struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1051   bool oldSkip=yyextra->skip;
1052   startCondSection(yyscanner,expression);
1053   if ((yyextra->condCtx==CComment || yyextra->readLineCtx==SComment) && 
1054       !oldSkip && yyextra->skip) 
1055   {
1056     if (yyextra->lang!=SrcLangExt_Python &&
1057         yyextra->lang!=SrcLangExt_VHDL &&
1058         yyextra->lang!=SrcLangExt_Markdown &&
1059         yyextra->lang!=SrcLangExt_Fortran)
1060     {
1061       ADDCHAR('*');
1062       ADDCHAR('/');
1063     }
1064   }
1065   if (yyextra->readLineCtx==SComment)
1066   {
1067     BEGIN(SComment);
1068   }
1069   else
1070   {
1071     BEGIN(yyextra->condCtx);
1072   }
1073 }
1074
1075 /** copies string \a s with length \a len to the output, while 
1076  *  replacing any alias commands found in the string.
1077  */
1078 static void replaceAliases(yyscan_t yyscanner,const char *s)
1079 {
1080   QCString result = resolveAliasCmd(s);
1081   //printf("replaceAliases(%s)->'%s'\n",s,result.data());
1082   copyToOutput(yyscanner,result,result.length());
1083 }
1084
1085
1086 static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size)
1087 {
1088   struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1089   yy_size_t bytesInBuf = yyextra->inBuf->curPos()-yyextra->inBufPos;
1090   yy_size_t bytesToCopy = QMIN(max_size,bytesInBuf);
1091   memcpy(buf,yyextra->inBuf->data()+yyextra->inBufPos,bytesToCopy);
1092   yyextra->inBufPos+=bytesToCopy;
1093   return bytesToCopy;
1094 }
1095
1096 static void replaceComment(yyscan_t yyscanner,int offset)
1097 {
1098   struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1099   if (yyextra->mlBrief || yyextra->skip)
1100   {
1101     copyToOutput(yyscanner,yytext,(int)yyleng);
1102   }
1103   else
1104   {
1105     //printf("replaceComment(%s)\n",yytext);
1106     int i=computeIndent(&yytext[offset]);
1107     if (i==yyextra->blockHeadCol)
1108     {
1109       replaceCommentMarker(yyscanner,yytext,(int)yyleng);
1110     }
1111     else
1112     {
1113       copyToOutput(yyscanner," */",3);
1114       for (i=(int)yyleng-1;i>=0;i--) unput(yytext[i]);
1115       yyextra->inSpecialComment=FALSE;
1116       BEGIN(Scan);
1117     }
1118   }
1119 }
1120
1121 /*! This function does three things:
1122  *  -# It converts multi-line C++ style comment blocks (that are aligned)
1123  *     to C style comment blocks (if MULTILINE_CPP_IS_BRIEF is set to NO).
1124  *  -# It replaces aliases with their definition (see ALIASES)
1125  *  -# It handles conditional sections (cond...endcond blocks)
1126  */
1127 void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName)
1128 {
1129   yyscan_t yyscanner;
1130   commentcnvYY_state extra;
1131   commentcnvYYlex_init_extra(&extra,&yyscanner);
1132 #ifdef FLEX_DEBUG
1133   commentcnvYYset_debug(1,yyscanner);
1134 #endif
1135   struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1136   //printf("convertCppComments(%s)\n",fileName);
1137   yyextra->inBuf    = inBuf;
1138   yyextra->outBuf   = outBuf;
1139   yyextra->inBufPos = 0;
1140   yyextra->col      = 0;
1141   yyextra->mlBrief = Config_getBool(MULTILINE_CPP_IS_BRIEF);
1142   yyextra->skip     = FALSE;
1143   yyextra->fileName = fileName;
1144   yyextra->lang = getLanguageFromFileName(fileName);
1145   yyextra->pythonDocString = FALSE;
1146   yyextra->lineNr   = 1;
1147   yyextra->condStack.clear();
1148   yyextra->condStack.setAutoDelete(TRUE);
1149   yyextra->commentStack.clear();
1150   yyextra->commentStack.setAutoDelete(TRUE);
1151   yyextra->vhdl = FALSE;
1152
1153   printlex(yy_flex_debug, TRUE, __FILE__, fileName);
1154   yyextra->isFixedForm = FALSE;
1155   if (yyextra->lang==SrcLangExt_Fortran)
1156   {
1157     FortranFormat fmt = convertFileNameFortranParserCode(fileName);
1158     yyextra->isFixedForm = recognizeFixedForm(inBuf->data(),fmt);
1159   }
1160
1161   if (yyextra->lang==SrcLangExt_Markdown)
1162   {
1163     yyextra->nestingCount=0;
1164     BEGIN(CComment);
1165     yyextra->commentStack.push(new CommentCtx(yyextra->lineNr));
1166   }
1167   else
1168   {
1169     BEGIN(Scan);
1170   }
1171   yylex(yyscanner);
1172   while (!yyextra->condStack.isEmpty())
1173   {
1174     CondCtx *ctx = yyextra->condStack.pop();
1175     QCString sectionInfo = " ";
1176     if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label '%s' ",ctx->sectionId.stripWhiteSpace().data());
1177     warn(yyextra->fileName,ctx->lineNr,"Conditional section%sdoes not have "
1178         "a corresponding \\endcond command within this file.",sectionInfo.data());
1179   }
1180   if (yyextra->nestingCount>0 && yyextra->lang!=SrcLangExt_Markdown && yyextra->lang!=SrcLangExt_Fortran)
1181   {
1182     QCString tmp= "(probable line reference: ";
1183     bool first = TRUE;
1184     while (!yyextra->commentStack.isEmpty())
1185     {
1186       CommentCtx *ctx = yyextra->commentStack.pop();
1187       if (!first) tmp += ", ";
1188       tmp += QCString().setNum(ctx->lineNr);
1189       first = FALSE;
1190       delete ctx;
1191     }
1192     tmp += ")";
1193     warn(yyextra->fileName,yyextra->lineNr,"Reached end of file while still inside a (nested) comment. "
1194         "Nesting level %d %s",yyextra->nestingCount,tmp.data());
1195   }
1196   yyextra->commentStack.clear();
1197   yyextra->nestingCount = 0;
1198   if (Debug::isFlagSet(Debug::CommentCnv))
1199   {
1200     yyextra->outBuf->at(yyextra->outBuf->curPos())='\0';
1201     Debug::print(Debug::CommentCnv,0,"-----------\nCommentCnv: %s\n"
1202                  "output=[\n%s]\n-----------\n",fileName,yyextra->outBuf->data()
1203                 );
1204   }
1205   printlex(yy_flex_debug, FALSE, __FILE__, fileName);
1206   commentcnvYYlex_destroy(yyscanner);
1207 }
1208
1209
1210 //----------------------------------------------------------------------------
1211
1212 #if USE_STATE2STRING
1213 #include "commentcnv.l.h"
1214 #endif