Doxygen
doctokenizer.l
浏览该文件的文档.
1 /******************************************************************************
2  *
3  * $Id: $
4  *
5  *
6  * Copyright (C) 1997-2015 by Dimitri van Heesch.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby
10  * granted. No representations are made about the suitability of this software
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18 
19 %option never-interactive
20 %option prefix="doctokenizerYY"
21 %option reentrant
22 %option extra-type="struct doctokenizerYY_state *"
23 %top{
24 #include <stdint.h>
25 // forward declare yyscan_t to improve type safety
26 #define YY_TYPEDEF_YY_SCANNER_T
27 struct yyguts_t;
28 typedef yyguts_t *yyscan_t;
29 }
30 
31 %{
32 
33 #include <ctype.h>
34 #include <stack>
35 #include <string>
36 #include <cassert>
37 
38 #include "doctokenizer.h"
39 #include "cmdmapper.h"
40 #include "config.h"
41 #include "message.h"
42 #include "section.h"
43 #include "membergroup.h"
44 #include "definition.h"
45 #include "doxygen.h"
46 #include "portable.h"
47 #include "cite.h"
48 #include "regex.h"
49 
50 #define YY_NO_INPUT 1
51 #define YY_NO_UNISTD_H 1
52 
53 #define USE_STATE2STRING 0
54 
55 #define TK_COMMAND_SEL() (yytext[0] == '@' ? TK_COMMAND_AT : TK_COMMAND_BS)
56 
57 //--------------------------------------------------------------------------
58 
59 struct DocLexerContext
60 {
61  DocLexerContext(TokenInfo *tk,int r,int lvl,yy_size_t pos,const char *s,YY_BUFFER_STATE bs)
62  : token(tk), rule(r), autoListLevel(lvl), inputPos(pos), inputString(s), state(bs) {}
63  TokenInfo *token;
64  int rule;
65  int autoListLevel;
66  yy_size_t inputPos;
67  const char *inputString;
68  YY_BUFFER_STATE state;
69 };
70 
71 struct doctokenizerYY_state
72 {
73 
74  // context for tokenizer phase
75  int commentState;
76  TokenInfo *token = 0;
77  yy_size_t inputPos = 0;
78  const char *inputString = 0;
79  QCString fileName;
80  bool insidePre = false;
81  int sharpCount=0;
82  bool markdownSupport=TRUE;
83 
84  // context for section finding phase
85  const Definition *definition = 0;
86  QCString secLabel;
87  QCString secTitle;
88  SectionType secType;
89  QCString endMarker;
90  int autoListLevel;
91  std::stack< std::unique_ptr<DocLexerContext> > lexerStack;
92 
93  int yyLineNr = 0;
94 };
95 
96 #define lineCount(s,len) do { for(int i=0;i<(int)len;i++) if (s[i]=='\n') yyextra->yyLineNr++; } while(0)
97 
98 
99 #if USE_STATE2STRING
100 static const char *stateToString(int state);
101 #endif
102 
103 
104 static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
105 static void handleHtmlTag(yyscan_t yyscanner,const char *text);
106 static void processSection(yyscan_t yyscanner);
107 
108 //--------------------------------------------------------------------------
109 
110 QCString extractPartAfterNewLine(const QCString &text)
111 {
112  int nl1 = text.find('\n');
113  int nl2 = text.find("\\ilinebr");
114  if (nl1!=-1 && nl1<nl2)
115  {
116  return text.mid(nl1+1);
117  }
118  if (nl2!=-1)
119  {
120  if (text.at(nl2+8)==' ') nl2++; // skip space after \\ilinebr
121  return text.mid(nl2+8);
122  }
123  return text;
124 }
125 
126 //--------------------------------------------------------------------------
127 
128 const char *DocTokenizer::tokToString(int token)
129 {
130  switch (token)
131  {
132  case 0: return "TK_EOF";
133  case TK_WORD: return "TK_WORD";
134  case TK_LNKWORD: return "TK_LNKWORD";
135  case TK_WHITESPACE: return "TK_WHITESPACE";
136  case TK_LISTITEM: return "TK_LISTITEM";
137  case TK_ENDLIST: return "TK_ENDLIST";
138  case TK_COMMAND_AT: return "TK_COMMAND_AT";
139  case TK_HTMLTAG: return "TK_HTMLTAG";
140  case TK_SYMBOL: return "TK_SYMBOL";
141  case TK_NEWPARA: return "TK_NEWPARA";
142  case TK_RCSTAG: return "TK_RCSTAG";
143  case TK_URL: return "TK_URL";
144  case TK_COMMAND_BS: return "TK_COMMAND_BS";
145  }
146  return "ERROR";
147 }
148 
149 const char *DocTokenizer::retvalToString(int retval)
150 {
151  switch (retval)
152  {
153  case RetVal_OK: return "RetVal_OK";
154  case RetVal_SimpleSec: return "RetVal_SimpleSec";
155  case RetVal_ListItem: return "RetVal_ListItem";
156  case RetVal_Section: return "RetVal_Section";
157  case RetVal_Subsection: return "RetVal_Subsection";
158  case RetVal_Subsubsection: return "RetVal_Subsubsection";
159  case RetVal_Paragraph: return "RetVal_Paragraph";
160  case RetVal_SubParagraph: return "RetVal_SubParagraph";
161  case RetVal_EndList: return "RetVal_EndList";
162  case RetVal_EndPre: return "RetVal_EndPre";
163  case RetVal_DescData: return "RetVal_DescData";
164  case RetVal_DescTitle : return "RetVal_DescTitle";
165  case RetVal_EndDesc: return "RetVal_EndDesc";
166  case RetVal_TableRow: return "RetVal_TableRow";
167  case RetVal_TableCell: return "RetVal_TableCell";
168  case RetVal_TableHCell: return "RetVal_TableHCell";
169  case RetVal_EndTable: return "RetVal_EndTable";
170  case RetVal_Internal: return "RetVal_Internal";
171  }
172  return "ERROR";
173 }
174 
175 static int computeIndent(const char *str,size_t length)
176 {
177  if (str==0 || length==std::string::npos) return 0;
178  size_t i;
179  int indent=0;
180  static int tabSize=Config_getInt(TAB_SIZE);
181  for (i=0;i<length;i++)
182  {
183  if (str[i]=='\t')
184  {
185  indent+=tabSize - (indent%tabSize);
186  }
187  else if (str[i]=='\n')
188  {
189  indent=0;
190  }
191  else
192  {
193  indent++;
194  }
195  }
196  return indent;
197 }
198 
199 //--------------------------------------------------------------------------
200 
201 static QCString stripEmptyLines(const QCString &s)
202 {
203  if (s.isEmpty()) return QCString();
204  int end=s.length();
205  int start=0,p=0;
206  // skip leading empty lines
207  for (;;)
208  {
209  int c;
210  while ((c=s[p]) && (c==' ' || c=='\t')) p++;
211  if (s[p]=='\n')
212  {
213  start=++p;
214  }
215  else
216  {
217  break;
218  }
219  }
220  // skip trailing empty lines
221  p=end-1;
222  if (p>=start && s.at(p)=='\n') p--;
223  while (p>=start)
224  {
225  int c;
226  while ((c=s[p]) && (c==' ' || c=='\t')) p--;
227  if (s[p]=='\n')
228  {
229  end=p;
230  }
231  else
232  {
233  break;
234  }
235  p--;
236  }
237  //printf("stripEmptyLines(%d-%d)\n",start,end);
238  return s.mid(start,end-start);
239 }
240 
241 #define unput_string(yytext,yyleng) do { for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); } while(0)
242 //--------------------------------------------------------------------------
243 
244 #undef YY_INPUT
245 #define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
246 
247 //--------------------------------------------------------------------------
248 //#define REAL_YY_DECL int doctokenizerYYlex (void)
249 //#define YY_DECL static int local_doctokenizer(void)
250 //#define LOCAL_YY_DECL local_doctokenizer()
251 
252 %}
253 
254 CMD ("\\"|"@")
255 WS [ \t\r\n]
256 NONWS [^ \t\r\n]
257 BLANK [ \t\r]
258 BLANKopt {BLANK}*
259 ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
260 LABELID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF\-]*
261 PHPTYPE [\\:a-z_A-Z0-9\x80-\xFF\-]+
262 CITESCHAR [a-z_A-Z0-9\x80-\xFF\-\?]
263 CITEECHAR [a-z_A-Z0-9\x80-\xFF\-\+:\/\?]
264 CITEID {CITESCHAR}{CITEECHAR}*("."{CITESCHAR}{CITEECHAR}*)*|"\""{CITESCHAR}{CITEECHAR}*("."{CITESCHAR}{CITEECHAR}*)*"\""
265 MAILADDR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+
266 MAILWS [\t a-z_A-Z0-9+-]
267 MAILADDR2 {MAILWS}+{BLANK}+("at"|"AT"|"_at_"|"_AT_"){BLANK}+{MAILWS}+("dot"|"DOT"|"_dot_"|"_DOT_"){BLANK}+{MAILWS}+
268 OPTSTARS ("/""/"{BLANK}*)?"*"*{BLANK}*
269 LISTITEM {BLANK}*[-]("#")?{WS}
270 MLISTITEM {BLANK}*[+*]{WS}
271 OLISTITEM {BLANK}*[1-9][0-9]*"."{BLANK}
272 ENDLIST {BLANK}*"."{BLANK}*\n
273 ATTRNAME [a-z_A-Z\x80-\xFF][:a-z_A-Z0-9\x80-\xFF\-]*
274 ATTRIB {ATTRNAME}{WS}*("="{WS}*(("\""[^\"]*"\"")|("'"[^\']*"'")|[^ \t\r\n'"><]+))?
275 URLCHAR [a-z_A-Z0-9\!\~\,\:\;\'\$\?\@\&\%\#\.\-\+\/\=\x80-\xFF]
276 URLMASK ({URLCHAR}+([({]{URLCHAR}*[)}])?)+
277 URLPROTOCOL ("http:"|"https:"|"ftp:"|"ftps:"|"sftp:"|"file:"|"news:"|"irc:"|"ircs:")
278 FILEICHAR [a-z_A-Z0-9\\:\\\/\-\+&#@]
279 FILEECHAR [a-z_A-Z0-9\-\+&#@]
280 FILECHARS {FILEICHAR}*{FILEECHAR}+
281 HFILEMASK {FILEICHAR}*("."{FILEICHAR}+)+{FILECHARS}*
282 VFILEMASK {FILECHARS}("."{FILECHARS})*
283 FILEMASK {VFILEMASK}|{HFILEMASK}
284 LINKMASK [^ \t\n\r\\@<&${}]+("("[^\n)]*")")?({BLANK}*("const"|"volatile"){BLANK}+)?
285 VERBATIM "verbatim"{BLANK}*
286 SPCMD1 {CMD}([a-z_A-Z][a-z_A-Z0-9]*|{VERBATIM}|"--"|"---")
287 SPCMD2 {CMD}[\\@<>&$#%~".+=|-]
288 SPCMD3 {CMD}_form#[0-9]+
289 SPCMD4 {CMD}"::"
290 SPCMD5 {CMD}":"
291 INOUT "in"|"out"|("in"{BLANK}*","?{BLANK}*"out")|("out"{BLANK}*","?{BLANK}*"in")
292 PARAMIO {CMD}param{BLANK}*"["{BLANK}*{INOUT}{BLANK}*"]"
293 VARARGS "..."
294 TEMPCHAR [a-z_A-Z0-9.,: \t\*\&\(\)\[\]]
295 FUNCCHAR [a-z_A-Z0-9,:<> \t\^\*\&\[\]]|{VARARGS}
296 FUNCPART {FUNCCHAR}*("("{FUNCCHAR}*")"{FUNCCHAR}*)?
297 SCOPESEP "::"|"#"|"."
298 TEMPLPART "<"{TEMPCHAR}*("<"{TEMPCHAR}*("<"{TEMPCHAR}*">")?">")?">"
299 ANONNS "anonymous_namespace{"[^}]*"}"
300 SCOPEPRE (({ID}{TEMPLPART}?)|{ANONNS}){SCOPESEP}
301 SCOPEKEYS ":"({ID}":")*
302 SCOPECPP {SCOPEPRE}*(~)?{ID}{TEMPLPART}?
303 SCOPEOBJC {SCOPEPRE}?{ID}{SCOPEKEYS}?
304 SCOPEMASK {SCOPECPP}|{SCOPEOBJC}
305 FUNCARG "("{FUNCPART}")"({BLANK}*("volatile"|"const"){BLANK})?
306 FUNCARG2 "("{FUNCPART}")"({BLANK}*("volatile"|"const"))?
307 OPNEW {BLANK}+"new"({BLANK}*"[]")?
308 OPDEL {BLANK}+"delete"({BLANK}*"[]")?
309 OPNORM {OPNEW}|{OPDEL}|"+"|"-"|"*"|"/"|"%"|"^"|"&"|"|"|"~"|"!"|"="|"<"|">"|"+="|"-="|"*="|"/="|"%="|"^="|"&="|"|="|"<<"|">>"|"<<="|">>="|"=="|"!="|"<="|">="|"&&"|"||"|"++"|"--"|","|"->*"|"->"|"[]"|"()"|"<=>"
310 OPCAST {BLANK}+[^<(\r\n.,][^(\r\n.,]*
311 OPMASK ({BLANK}*{OPNORM}{FUNCARG})
312 OPMASKOPT ({BLANK}*{OPNORM}{FUNCARG}?)|({OPCAST}{FUNCARG})
313 OPMASKOP2 ({BLANK}*{OPNORM}{FUNCARG2}?)|({OPCAST}{FUNCARG2})
314 LNKWORD1 ("::"|"#")?{SCOPEMASK}
315 CVSPEC {BLANK}*("const"|"volatile")
316 LNKWORD2 (({SCOPEPRE}*"operator"{OPMASK})|({SCOPEPRE}"operator"{OPMASKOPT})|(("::"|"#"){SCOPEPRE}*"operator"{OPMASKOPT})){CVSPEC}?
317 LNKWORD3 ([0-9a-z_A-Z\-]+("/"|"\\"))*[0-9a-z_A-Z\-]+("."[0-9a-z_A-Z]+)+
318 CHARWORDQ [^ \t\n\r\\@<>()\[\]:;\?{}&%$#,."=']
319 ESCWORD ("%"{ID}(("::"|"."){ID})*)|("%'")
320 CHARWORDQ1 [^ \-+0-9\t\n\r\\@<>()\[\]:;\?{}&%$#,."=']
321 WORD1 {ESCWORD}|{CHARWORDQ1}{CHARWORDQ}*|"{"|"}"|"'\"'"|("\""([^"\n]*\n?)*[^"\n]*"\"")
322 WORD2 "."|","|"("|")"|"["|"]"|"::"|":"|";"|"\?"|"="|"'"
323 WORD1NQ {ESCWORD}|{CHARWORDQ}+|"{"|"}"
324 WORD2NQ "."|","|"("|")"|"["|"]"|"::"|":"|";"|"\?"|"="|"'"
325 CAPTION [cC][aA][pP][tT][iI][oO][nN]
326 HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*{WS}*(("/")?)">"
327 HTMLKEYL "strong"|"center"|"table"|"caption"|"small"|"code"|"dfn"|"var"|"img"|"pre"|"sub"|"sup"|"tr"|"td"|"th"|"ol"|"ul"|"li"|"tt"|"kbd"|"em"|"hr"|"dl"|"dt"|"dd"|"br"|"i"|"a"|"b"|"p"|"strike"|"u"|"del"|"ins"|"s"
328 HTMLKEYU "STRONG"|"CENTER"|"TABLE"|"CAPTION"|"SMALL"|"CODE"|"DFN"|"VAR"|"IMG"|"PRE"|"SUB"|"SUP"|"TR"|"TD"|"TH"|"OL"|"UL"|"LI"|"TT"|"KBD"|"EM"|"HR"|"DL"|"DT"|"DD"|"BR"|"I"|"A"|"B"|"P"|"STRIKE"|"U"|"DEL"|"INS"|"S"
329 HTMLKEYW {HTMLKEYL}|{HTMLKEYU}
330 REFWORD2_PRE ("#"|"::")?((({ID}{TEMPLPART}?)|{ANONNS})("."|"#"|"::"|"-"|"/"))*({ID}{TEMPLPART}?(":")?)
331 REFWORD2 {REFWORD2_PRE}{FUNCARG2}?
332 REFWORD2_NOCV {REFWORD2_PRE}("("{FUNCPART}")")?
333 REFWORD3 ({ID}":")*{ID}":"?
334 REFWORD4_NOCV (({SCOPEPRE}*"operator"{OPMASKOP2})|(("::"|"#"){SCOPEPRE}*"operator"{OPMASKOP2}))
335 REFWORD4 {REFWORD4_NOCV}{CVSPEC}?
336 REFWORD {FILEMASK}|{LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4}
337 REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV}
338 RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revision"|"Source"|"State")":"[^:\n$][^\n$]*"$"
339 LINENR {BLANK}*[1-9][0-9]*
340 
341 %option noyywrap
342 
343 %x St_Para
344 %x St_Comment
345 %x St_Title
346 %x St_TitleN
347 %x St_TitleQ
348 %x St_TitleA
349 %x St_TitleV
350 %x St_Code
351 %x St_CodeOpt
352 %x St_XmlCode
353 %x St_HtmlOnly
354 %x St_HtmlOnlyOption
355 %x St_ManOnly
356 %x St_LatexOnly
357 %x St_RtfOnly
358 %x St_XmlOnly
359 %x St_DbOnly
360 %x St_Verbatim
361 %x St_Dot
362 %x St_Msc
363 %x St_PlantUMLOpt
364 %x St_PlantUML
365 %x St_Param
366 %x St_XRefItem
367 %x St_XRefItem2
368 %x St_File
369 %x St_Pattern
370 %x St_Link
371 %x St_Cite
372 %x St_Ref
373 %x St_Ref2
374 %x St_IntRef
375 %x St_Text
376 %x St_SkipTitle
377 %x St_Anchor
378 %x St_Snippet
379 %x St_SetScope
380 %x St_SetScopeEnd
381 %x St_Options
382 %x St_Block
383 %x St_Emoji
384 %x St_Iline
385 
386 %x St_Sections
387 %s St_SecLabel1
388 %s St_SecLabel2
389 %s St_SecTitle
390 %x St_SecSkip
391 
392 %%
393 <St_Para>\r /* skip carriage return */
394 <St_Para>^{LISTITEM} { /* list item */
395  lineCount(yytext,yyleng);
396  QCString text(yytext);
397  uint dashPos = static_cast<uint>(text.findRev('-'));
398  assert(dashPos!=static_cast<uint>(-1));
399  yyextra->token->isEnumList = text.at(dashPos+1)=='#';
400  yyextra->token->id = -1;
401  yyextra->token->indent = computeIndent(yytext,dashPos);
402  return TK_LISTITEM;
403  }
404 <St_Para>^{MLISTITEM} { /* list item */
405  if (!yyextra->markdownSupport || yyextra->insidePre)
406  {
407  REJECT;
408  }
409  else
410  {
411  lineCount(yytext,yyleng);
412  std::string text(yytext);
413  static const reg::Ex re(R"([*+][^*+]*$)"); // find last + or *
414  reg::Match match;
415  reg::search(text,match,re);
416  size_t listPos = match.position();
417  assert(listPos!=std::string::npos);
418  yyextra->token->isEnumList = FALSE;
419  yyextra->token->id = -1;
420  yyextra->token->indent = computeIndent(yytext,listPos);
421  return TK_LISTITEM;
422  }
423  }
424 <St_Para>^{OLISTITEM} { /* numbered list item */
425  if (!yyextra->markdownSupport || yyextra->insidePre)
426  {
427  REJECT;
428  }
429  else
430  {
431  std::string text(yytext);
432  static const reg::Ex re(R"(\d+)");
433  reg::Match match;
434  reg::search(text,match,re);
435  size_t markPos = match.position();
436  assert(markPos!=std::string::npos);
437  yyextra->token->isEnumList = true;
438  bool ok = false;
439  int id = QCString(match.str()).toInt(&ok);
440  yyextra->token->id = ok ? id : -1;
441  if (!ok)
442  {
443  warn(yyextra->fileName,yyextra->yyLineNr,"Invalid number for list item '%s' ",match.str().c_str());
444  }
445  yyextra->token->indent = computeIndent(yytext,markPos);
446  return TK_LISTITEM;
447  }
448  }
449 <St_Para>{BLANK}*(\n|"\\ilinebr"){LISTITEM} { /* list item on next line */
450  lineCount(yytext,yyleng);
451  QCString text=extractPartAfterNewLine(QCString(yytext));
452  uint dashPos = static_cast<uint>(text.findRev('-'));
453  assert(dashPos!=static_cast<uint>(-1));
454  yyextra->token->isEnumList = text.at(dashPos+1)=='#';
455  yyextra->token->id = -1;
456  yyextra->token->indent = computeIndent(text.data(),dashPos);
457  return TK_LISTITEM;
458  }
459 <St_Para>{BLANK}*(\n|"\\ilinebr"){MLISTITEM} { /* list item on next line */
460  if (!yyextra->markdownSupport || yyextra->insidePre)
461  {
462  REJECT;
463  }
464  else
465  {
466  lineCount(yytext,yyleng);
467  std::string text=extractPartAfterNewLine(QCString(yytext)).str();
468  static const reg::Ex re(R"([*+][^*+]*$)"); // find last + or *
469  reg::Match match;
470  reg::search(text,match,re);
471  size_t markPos = match.position();
472  assert(markPos!=std::string::npos);
473  yyextra->token->isEnumList = FALSE;
474  yyextra->token->id = -1;
475  yyextra->token->indent = computeIndent(text.c_str(),markPos);
476  return TK_LISTITEM;
477  }
478  }
479 <St_Para>{BLANK}*(\n|"\\ilinebr"){OLISTITEM} { /* list item on next line */
480  if (!yyextra->markdownSupport || yyextra->insidePre)
481  {
482  REJECT;
483  }
484  else
485  {
486  lineCount(yytext,yyleng);
487  std::string text=extractPartAfterNewLine(QCString(yytext)).str();
488  static const reg::Ex re(R"(\d+)");
489  reg::Match match;
490  reg::search(text,match,re);
491  size_t markPos = match.position();
492  assert(markPos!=std::string::npos);
493  yyextra->token->isEnumList = true;
494  bool ok = false;
495  int id = QCString(match.str()).toInt(&ok);
496  yyextra->token->id = ok ? id : -1;
497  if (!ok)
498  {
499  warn(yyextra->fileName,yyextra->yyLineNr,"Invalid number for list item '%s' ",match.str().c_str());
500  }
501  yyextra->token->indent = computeIndent(text.c_str(),markPos);
502  return TK_LISTITEM;
503  }
504  }
505 <St_Para>^{ENDLIST} { /* end list */
506  lineCount(yytext,yyleng);
507  size_t dotPos = static_cast<size_t>(QCString(yytext).findRev('.'));
508  yyextra->token->indent = computeIndent(yytext,dotPos);
509  return TK_ENDLIST;
510  }
511 <St_Para>{BLANK}*(\n|"\\ilinebr"){ENDLIST} { /* end list on next line */
512  lineCount(yytext,yyleng);
513  QCString text=extractPartAfterNewLine(QCString(yytext));
514  size_t dotPos = static_cast<size_t>(text.findRev('.'));
515  yyextra->token->indent = computeIndent(text.data(),dotPos);
516  return TK_ENDLIST;
517  }
518 <St_Para>"{"{BLANK}*"@link"/{WS}+ {
519  yyextra->token->name = "javalink";
520  return TK_COMMAND_AT;
521  }
522 <St_Para>"{"{BLANK}*"@inheritDoc"{BLANK}*"}" {
523  yyextra->token->name = "inheritdoc";
524  return TK_COMMAND_AT;
525  }
526 <St_Para>"@_fakenl" { // artificial new line
527  //yyextra->yyLineNr++;
528  }
529 <St_Para>{SPCMD3} {
530  yyextra->token->name = "_form";
531  bool ok;
532  yyextra->token->id = QCString(yytext).right((int)yyleng-7).toInt(&ok);
533  ASSERT(ok);
534  return TK_COMMAND_SEL();
535  }
536 <St_Para>{CMD}"n"\n { /* \n followed by real newline */
537  lineCount(yytext,yyleng);
538  //yyextra->yyLineNr++;
539  yyextra->token->name = yytext+1;
540  yyextra->token->name = yyextra->token->name.stripWhiteSpace();
541  yyextra->token->paramDir=TokenInfo::Unspecified;
542  return TK_COMMAND_SEL();
543  }
544 <St_Para>"\\ilinebr" {
545  }
546 <St_Para>{SPCMD1} |
547 <St_Para>{SPCMD2} |
548 <St_Para>{SPCMD5} |
549 <St_Para>{SPCMD4} { /* special command */
550  yyextra->token->name = yytext+1;
551  yyextra->token->name = yyextra->token->name.stripWhiteSpace();
552  yyextra->token->paramDir=TokenInfo::Unspecified;
553  return TK_COMMAND_SEL();
554  }
555 <St_Para>{PARAMIO} { /* param [in,out] command */
556  yyextra->token->name = "param";
557  QCString s(yytext);
558  bool isIn = s.find("in")!=-1;
559  bool isOut = s.find("out")!=-1;
560  if (isIn)
561  {
562  if (isOut)
563  {
564  yyextra->token->paramDir=TokenInfo::InOut;
565  }
566  else
567  {
568  yyextra->token->paramDir=TokenInfo::In;
569  }
570  }
571  else if (isOut)
572  {
573  yyextra->token->paramDir=TokenInfo::Out;
574  }
575  else
576  {
577  yyextra->token->paramDir=TokenInfo::Unspecified;
578  }
579  return TK_COMMAND_SEL();
580  }
581 <St_Para>{URLPROTOCOL}{URLMASK}/[,\.] { // URL, or URL.
582  yyextra->token->name=yytext;
583  yyextra->token->isEMailAddr=FALSE;
584  return TK_URL;
585  }
586 <St_Para>{URLPROTOCOL}{URLMASK} { // URL
587  yyextra->token->name=yytext;
588  yyextra->token->isEMailAddr=FALSE;
589  return TK_URL;
590  }
591 <St_Para>"<"{URLPROTOCOL}{URLMASK}">" { // URL
592  yyextra->token->name=yytext;
593  yyextra->token->name = yyextra->token->name.mid(1,yyextra->token->name.length()-2);
594  yyextra->token->isEMailAddr=FALSE;
595  return TK_URL;
596  }
597 <St_Para>{MAILADDR} { // Mail address
598  yyextra->token->name=yytext;
599  yyextra->token->name.stripPrefix("mailto:");
600  yyextra->token->isEMailAddr=TRUE;
601  return TK_URL;
602  }
603 <St_Para>"<"{MAILADDR}">" { // Mail address
604  yyextra->token->name=yytext;
605  yyextra->token->name = yyextra->token->name.mid(1,yyextra->token->name.length()-2);
606  yyextra->token->name.stripPrefix("mailto:");
607  yyextra->token->isEMailAddr=TRUE;
608  return TK_URL;
609  }
610 <St_Para>"<"{MAILADDR2}">" { // anti spam mail address
611  yyextra->token->name=yytext;
612  return TK_WORD;
613  }
614 <St_Para>{RCSID} { /* RCS tag */
615  QCString tagName(yytext+1);
616  int index=tagName.find(':');
617  if (index<0) index=0; // should never happen
618  yyextra->token->name = tagName.left(index);
619  int text_begin = index+2;
620  int text_end = tagName.length()-1;
621  if (tagName[text_begin-1]==':') /* check for Subversion fixed-length keyword */
622  {
623  ++text_begin;
624  if (tagName[text_end-1]=='#')
625  --text_end;
626  }
627  yyextra->token->text = tagName.mid(text_begin,text_end-text_begin);
628  return TK_RCSTAG;
629  }
630 <St_Para,St_HtmlOnly,St_ManOnly,St_LatexOnly,St_RtfOnly,St_XmlOnly,St_DbOnly>"$("{ID}")" | /* environment variable */
631 <St_Para,St_HtmlOnly,St_ManOnly,St_LatexOnly,St_RtfOnly,St_XmlOnly,St_DbOnly>"$("{ID}"("{ID}"))" { /* environment variable */
632  QCString name(&yytext[2]);
633  name = name.left(name.length()-1);
634  QCString value = Portable::getenv(name);
635  for (int i=value.length()-1;i>=0;i--) unput(value.at(i));
636  }
637 <St_Para>{HTMLTAG} { /* html tag */
638  lineCount(yytext,yyleng);
639  handleHtmlTag(yyscanner,yytext);
640  return TK_HTMLTAG;
641  }
642 <St_Para,St_Text>"&"{ID}";" { /* special symbol */
643  yyextra->token->name = yytext;
644  return TK_SYMBOL;
645  }
646 
647  /********* patterns for linkable words ******************/
648 
649 <St_Para>{ID}/"<"{HTMLKEYW}">" { /* this rule is to prevent opening html
650  * tag to be recognized as a templated classes
651  */
652  yyextra->token->name = yytext;
653  return TK_LNKWORD;
654  }
655 <St_Para>{LNKWORD1}/"<br>" | // prevent <br> html tag to be parsed as template arguments
656 <St_Para>{LNKWORD1} |
657 <St_Para>{LNKWORD1}{FUNCARG} |
658 <St_Para>{LNKWORD2} |
659 <St_Para>{LNKWORD3} {
660  yyextra->token->name = yytext;
661  return TK_LNKWORD;
662  }
663 <St_Para>{LNKWORD1}{FUNCARG}{CVSPEC}[^a-z_A-Z0-9] {
664  yyextra->token->name = yytext;
665  yyextra->token->name = yyextra->token->name.left(yyextra->token->name.length()-1);
666  unput(yytext[(int)yyleng-1]);
667  return TK_LNKWORD;
668  }
669  /********* patterns for normal words ******************/
670 
671 <St_Para,St_Text>[\-+0-9] |
672 <St_Para,St_Text>{WORD1} |
673 <St_Para,St_Text>{WORD2} { /* function call */
674  if (QCString(yytext).find("\\ilinebr")!=-1) REJECT; // see issue #8311
675  lineCount(yytext,yyleng);
676  if (yytext[0]=='%') // strip % if present
677  yyextra->token->name = &yytext[1];
678  else
679  yyextra->token->name = yytext;
680  return TK_WORD;
681  }
682 <St_Text>({ID}".")+{ID} {
683  yyextra->token->name = yytext;
684  return TK_WORD;
685  }
686 <St_Para,St_Text>"operator"/{BLANK}*"<"[a-zA-Z_0-9]+">" { // Special case: word "operator" followed by a HTML command
687  // avoid interpretation as "operator <"
688  yyextra->token->name = yytext;
689  return TK_WORD;
690  }
691 
692  /*******************************************************/
693 
694 <St_Para,St_Text>{BLANK}+ |
695 <St_Para,St_Text>{BLANK}*\n{BLANK}* { /* white space */
696  lineCount(yytext,yyleng);
697  yyextra->token->chars=yytext;
698  return TK_WHITESPACE;
699  }
700 <St_Text>[\\@<>&$#%~] {
701  yyextra->token->name = yytext;
702  return TK_COMMAND_SEL();
703  }
704 <St_Para>({BLANK}*\n)+{BLANK}*\n/{LISTITEM} { /* skip trailing paragraph followed by new list item */
705  if (yyextra->insidePre || yyextra->autoListLevel==0)
706  {
707  REJECT;
708  }
709  lineCount(yytext,yyleng);
710  }
711 <St_Para>({BLANK}*\n)+{BLANK}*\n/{MLISTITEM} { /* skip trailing paragraph followed by new list item */
712  if (!yyextra->markdownSupport || yyextra->insidePre || yyextra->autoListLevel==0)
713  {
714  REJECT;
715  }
716  lineCount(yytext,yyleng);
717  }
718 <St_Para>({BLANK}*\n)+{BLANK}*\n/{OLISTITEM} { /* skip trailing paragraph followed by new list item */
719  if (!yyextra->markdownSupport || yyextra->insidePre || yyextra->autoListLevel==0)
720  {
721  REJECT;
722  }
723  lineCount(yytext,yyleng);
724  }
725 <St_Para,St_Param>({BLANK}*(\n|"\\ilinebr"))+{BLANK}*(\n|"\\ilinebr"){BLANK}* {
726  lineCount(yytext,yyleng);
727  if (yyextra->insidePre)
728  {
729  yyextra->token->chars=yytext;
730  return TK_WHITESPACE;
731  }
732  else
733  {
734  yyextra->token->indent=computeIndent(yytext,yyleng);
735  int i;
736  // put back the indentation (needed for list items)
737  for (i=0;i<yyextra->token->indent;i++)
738  {
739  unput(' ');
740  }
741  // tell flex that after putting the last indent
742  // back we are at the beginning of the line
743  YY_CURRENT_BUFFER->yy_at_bol=1;
744  // start of a new paragraph
745  return TK_NEWPARA;
746  }
747  }
748 <St_CodeOpt>{BLANK}*"{"(".")?{LABELID}"}" {
749  yyextra->token->name = yytext;
750  int i=yyextra->token->name.find('{'); /* } to keep vi happy */
751  yyextra->token->name = yyextra->token->name.mid(i+1,yyextra->token->name.length()-i-2);
752  BEGIN(St_Code);
753  }
754 <St_CodeOpt>"\\ilinebr" |
755 <St_CodeOpt>\n |
756 <St_CodeOpt>. {
757  unput_string(yytext,yyleng);
758  BEGIN(St_Code);
759  }
760 <St_Code>{WS}*{CMD}"endcode" {
761  lineCount(yytext,yyleng);
762  return RetVal_OK;
763  }
764 <St_XmlCode>{WS}*"</code>" {
765  lineCount(yytext,yyleng);
766  return RetVal_OK;
767  }
768 <St_Code,St_XmlCode>[^\\@\n<]+ |
769 <St_Code,St_XmlCode>\n |
770 <St_Code,St_XmlCode>. {
771  lineCount(yytext,yyleng);
772  yyextra->token->verb+=yytext;
773  }
774 <St_HtmlOnlyOption>" [block]" { // the space is added in commentscan.l
775  yyextra->token->name="block";
776  BEGIN(St_HtmlOnly);
777  }
778 <St_HtmlOnlyOption>.|\n {
779  unput(*yytext);
780  BEGIN(St_HtmlOnly);
781  }
782 <St_HtmlOnlyOption>"\\ilinebr" {
783  unput_string(yytext,yyleng);
784  BEGIN(St_HtmlOnly);
785  }
786 <St_HtmlOnly>{CMD}"endhtmlonly" {
787  return RetVal_OK;
788  }
789 <St_HtmlOnly>[^\\@\n$]+ |
790 <St_HtmlOnly>\n |
791 <St_HtmlOnly>. {
792  lineCount(yytext,yyleng);
793  yyextra->token->verb+=yytext;
794  }
795 <St_ManOnly>{CMD}"endmanonly" {
796  return RetVal_OK;
797  }
798 <St_ManOnly>[^\\@\n$]+ |
799 <St_ManOnly>\n |
800 <St_ManOnly>. {
801  lineCount(yytext,yyleng);
802  yyextra->token->verb+=yytext;
803  }
804 <St_RtfOnly>{CMD}"endrtfonly" {
805  return RetVal_OK;
806  }
807 <St_RtfOnly>[^\\@\n$]+ |
808 <St_RtfOnly>\n |
809 <St_RtfOnly>. {
810  lineCount(yytext,yyleng);
811  yyextra->token->verb+=yytext;
812  }
813 <St_LatexOnly>{CMD}"endlatexonly" {
814  return RetVal_OK;
815  }
816 <St_LatexOnly>[^\\@\n]+ |
817 <St_LatexOnly>\n |
818 <St_LatexOnly>. {
819  lineCount(yytext,yyleng);
820  yyextra->token->verb+=yytext;
821  }
822 <St_XmlOnly>{CMD}"endxmlonly" {
823  return RetVal_OK;
824  }
825 <St_XmlOnly>[^\\@\n]+ |
826 <St_XmlOnly>\n |
827 <St_XmlOnly>. {
828  lineCount(yytext,yyleng);
829  yyextra->token->verb+=yytext;
830  }
831 <St_DbOnly>{CMD}"enddocbookonly" {
832  return RetVal_OK;
833  }
834 <St_DbOnly>[^\\@\n]+ |
835 <St_DbOnly>\n |
836 <St_DbOnly>. {
837  lineCount(yytext,yyleng);
838  yyextra->token->verb+=yytext;
839  }
840 <St_Verbatim>{CMD}"endverbatim" {
841  yyextra->token->verb=stripEmptyLines(yyextra->token->verb);
842  return RetVal_OK;
843  }
844 <St_Verbatim>[^\\@\n]+ |
845 <St_Verbatim>\n |
846 <St_Verbatim>. { /* Verbatim text */
847  lineCount(yytext,yyleng);
848  yyextra->token->verb+=yytext;
849  }
850 <St_Dot>{CMD}"enddot" {
851  return RetVal_OK;
852  }
853 <St_Dot>[^\\@\n]+ |
854 <St_Dot>\n |
855 <St_Dot>. { /* dot text */
856  lineCount(yytext,yyleng);
857  yyextra->token->verb+=yytext;
858  }
859 <St_Msc>{CMD}("endmsc") {
860  return RetVal_OK;
861  }
862 <St_Msc>[^\\@\n]+ |
863 <St_Msc>\n |
864 <St_Msc>. { /* msc text */
865  lineCount(yytext,yyleng);
866  yyextra->token->verb+=yytext;
867  }
868 <St_PlantUMLOpt>{BLANK}*"{"[a-zA-Z_,:0-9\. ]*"}" { // case 1: options present
869  yyextra->token->sectionId = QCString(yytext).stripWhiteSpace();
870  return RetVal_OK;
871  }
872 <St_PlantUMLOpt>{BLANK}*{FILEMASK}{BLANK}+/{ID}"=" { // case 2: plain file name specified followed by an attribute
873  yyextra->token->sectionId = QCString(yytext).stripWhiteSpace();
874  return RetVal_OK;
875  }
876 <St_PlantUMLOpt>{BLANK}*{FILEMASK}{BLANK}+/"\"" { // case 3: plain file name specified followed by a quoted title
877  yyextra->token->sectionId = QCString(yytext).stripWhiteSpace();
878  return RetVal_OK;
879  }
880 <St_PlantUMLOpt>{BLANK}*{FILEMASK}{BLANKopt}/\n { // case 4: plain file name specified without title or attributes
881  yyextra->token->sectionId = QCString(yytext).stripWhiteSpace();
882  return RetVal_OK;
883  }
884 <St_PlantUMLOpt>{BLANK}*{FILEMASK}{BLANKopt}/"\\ilinebr" { // case 5: plain file name specified without title or attributes
885  yyextra->token->sectionId = QCString(yytext).stripWhiteSpace();
886  return RetVal_OK;
887  }
888 <St_PlantUMLOpt>"\\ilinebr" |
889 <St_PlantUMLOpt>"\n" |
890 <St_PlantUMLOpt>. {
891  yyextra->token->sectionId = "";
892  unput_string(yytext,yyleng);
893  return RetVal_OK;
894  }
895 <St_PlantUML>{CMD}"enduml" {
896  return RetVal_OK;
897  }
898 <St_PlantUML>[^\\@\n]+ |
899 <St_PlantUML>\n |
900 <St_PlantUML>. { /* plantuml text */
901  lineCount(yytext,yyleng);
902  yyextra->token->verb+=yytext;
903  }
904 <St_Title>"\"" { // quoted title
905  BEGIN(St_TitleQ);
906  }
907 <St_Title>[ \t]+ {
908  yyextra->token->chars=yytext;
909  return TK_WHITESPACE;
910  }
911 <St_Title>. { // non-quoted title
912  unput(*yytext);
913  BEGIN(St_TitleN);
914  }
915 <St_Title>\n {
916  unput(*yytext);
917  return 0;
918  }
919 <St_Title>"\\ilinebr" {
920  unput_string(yytext,yyleng);
921  return 0;
922  }
923 <St_TitleN>"&"{ID}";" { /* symbol */
924  yyextra->token->name = yytext;
925  return TK_SYMBOL;
926  }
927 <St_TitleN>{HTMLTAG} {
928  lineCount(yytext,yyleng);
929  }
930 <St_TitleN>\n { /* new line => end of title */
931  unput(*yytext);
932  return 0;
933  }
934 <St_TitleN>"\\ilinebr" { /* new line => end of title */
935  unput_string(yytext,yyleng);
936  return 0;
937  }
938 <St_TitleN>{SPCMD1} |
939 <St_TitleN>{SPCMD2} { /* special command */
940  yyextra->token->name = yytext+1;
941  yyextra->token->paramDir=TokenInfo::Unspecified;
942  return TK_COMMAND_SEL();
943  }
944 <St_TitleN>{ID}"=" { /* attribute */
945  if (yytext[0]=='%') // strip % if present
946  yyextra->token->name = &yytext[1];
947  else
948  yyextra->token->name = yytext;
949  return TK_WORD;
950  }
951 <St_TitleN>[\-+0-9] |
952 <St_TitleN>{WORD1} |
953 <St_TitleN>{WORD2} { /* word */
954  if (QCString(yytext).find("\\ilinebr")!=-1) REJECT; // see issue #8311
955  lineCount(yytext,yyleng);
956  if (yytext[0]=='%') // strip % if present
957  yyextra->token->name = &yytext[1];
958  else
959  yyextra->token->name = yytext;
960  return TK_WORD;
961  }
962 <St_TitleN>[ \t]+ {
963  yyextra->token->chars=yytext;
964  return TK_WHITESPACE;
965  }
966 <St_TitleQ>"&"{ID}";" { /* symbol */
967  yyextra->token->name = yytext;
968  return TK_SYMBOL;
969  }
970 <St_TitleQ>(\n|"\\ilinebr") { /* new line => end of title */
971  unput_string(yytext,yyleng);
972  return 0;
973  }
974 <St_TitleQ>{SPCMD1} |
975 <St_TitleQ>{SPCMD2} { /* special command */
976  yyextra->token->name = yytext+1;
977  yyextra->token->paramDir=TokenInfo::Unspecified;
978  return TK_COMMAND_SEL();
979  }
980 <St_TitleQ>{WORD1NQ} |
981 <St_TitleQ>{WORD2NQ} { /* word */
982  yyextra->token->name = yytext;
983  return TK_WORD;
984  }
985 <St_TitleQ>[ \t]+ {
986  yyextra->token->chars=yytext;
987  return TK_WHITESPACE;
988  }
989 <St_TitleQ>"\"" { /* closing quote => end of title */
990  BEGIN(St_TitleA);
991  return 0;
992  }
993 <St_TitleA>{BLANK}*{ID}{BLANK}*"="{BLANK}* { // title attribute
994  yyextra->token->name = yytext;
995  int pos = yyextra->token->name.find('=');
996  if (pos<0) pos=0; // should never happen
997  yyextra->token->name = yyextra->token->name.left(pos).stripWhiteSpace();
998  BEGIN(St_TitleV);
999  }
1000 <St_TitleV>[^ \t\r\n]+ { // attribute value
1001  lineCount(yytext,yyleng);
1002  yyextra->token->chars = yytext;
1003  BEGIN(St_TitleN);
1004  return TK_WORD;
1005  }
1006 <St_TitleV,St_TitleA>. {
1007  unput(*yytext);
1008  return 0;
1009  }
1010 <St_TitleV,St_TitleA>(\n|"\\ilinebr") {
1011  unput_string(yytext,yyleng);
1012  return 0;
1013  }
1014 
1015 <St_Anchor>{LABELID}{WS}? { // anchor
1016  lineCount(yytext,yyleng);
1017  yyextra->token->name = QCString(yytext).stripWhiteSpace();
1018  return TK_WORD;
1019  }
1020 <St_Anchor>. {
1021  unput(*yytext);
1022  return 0;
1023  }
1024 <St_Cite>{CITEID} { // label to cite
1025  if (yytext[0] =='"')
1026  {
1027  yyextra->token->name=yytext+1;
1028  yyextra->token->name=yyextra->token->name.left(static_cast<uint>(yyleng)-2);
1029  }
1030  else
1031  {
1032  yyextra->token->name=yytext;
1033  }
1034  return TK_WORD;
1035  }
1036 <St_Cite>{BLANK} { // white space
1037  unput(' ');
1038  return 0;
1039  }
1040 <St_Cite>(\n|"\\ilinebr") { // new line
1041  unput_string(yytext,yyleng);
1042  return 0;
1043  }
1044 <St_Cite>. { // any other character
1045  unput(*yytext);
1046  return 0;
1047  }
1048 <St_Ref>{REFWORD_NOCV}/{BLANK}("const")[a-z_A-Z0-9] { // see bug776988
1049  yyextra->token->name=yytext;
1050  return TK_WORD;
1051  }
1052 <St_Ref>{REFWORD_NOCV}/{BLANK}("volatile")[a-z_A-Z0-9] { // see bug776988
1053  yyextra->token->name=yytext;
1054  return TK_WORD;
1055  }
1056 <St_Ref>{REFWORD} { // label to refer to
1057  yyextra->token->name=yytext;
1058  return TK_WORD;
1059  }
1060 <St_Ref>{BLANK} { // white space
1061  unput(' ');
1062  return 0;
1063  }
1064 <St_Ref>{WS}+"\""{WS}* { // white space following by quoted string
1065  lineCount(yytext,yyleng);
1066  BEGIN(St_Ref2);
1067  }
1068 <St_Ref>(\n|"\\ilinebr") { // new line
1069  unput_string(yytext,yyleng);
1070  return 0;
1071  }
1072 <St_Ref>. { // any other character
1073  unput(*yytext);
1074  return 0;
1075  }
1076 <St_IntRef>[A-Z_a-z0-9.:/#\-\+\(\)]+ {
1077  yyextra->token->name = yytext;
1078  return TK_WORD;
1079  }
1080 <St_IntRef>{BLANK}+"\"" {
1081  BEGIN(St_Ref2);
1082  }
1083 <St_SetScope>({SCOPEMASK}|{ANONNS}){BLANK}|{FILEMASK} {
1084  yyextra->token->name = yytext;
1085  yyextra->token->name = yyextra->token->name.stripWhiteSpace();
1086  return TK_WORD;
1087  }
1088 <St_SetScope>{SCOPEMASK}"<" {
1089  yyextra->token->name = yytext;
1090  yyextra->token->name = yyextra->token->name.stripWhiteSpace();
1091  yyextra->sharpCount=1;
1092  BEGIN(St_SetScopeEnd);
1093  }
1094 <St_SetScope>{BLANK} {
1095  }
1096 <St_SetScopeEnd>"<" {
1097  yyextra->token->name += yytext;
1098  yyextra->sharpCount++;
1099  }
1100 <St_SetScopeEnd>">" {
1101  yyextra->token->name += yytext;
1102  yyextra->sharpCount--;
1103  if (yyextra->sharpCount<=0)
1104  {
1105  return TK_WORD;
1106  }
1107  }
1108 <St_SetScopeEnd>. {
1109  yyextra->token->name += yytext;
1110  }
1111 <St_Ref2>"&"{ID}";" { /* symbol */
1112  yyextra->token->name = yytext;
1113  return TK_SYMBOL;
1114  }
1115 <St_Ref2>"\""|\n|"\\ilinebr" { /* " or \n => end of title */
1116  lineCount(yytext,yyleng);
1117  return 0;
1118  }
1119 <St_Ref2>{SPCMD1} |
1120 <St_Ref2>{SPCMD2} { /* special command */
1121  yyextra->token->name = yytext+1;
1122  yyextra->token->paramDir=TokenInfo::Unspecified;
1123  return TK_COMMAND_SEL();
1124  }
1125 <St_Ref2>{WORD1NQ} |
1126 <St_Ref2>{WORD2NQ} {
1127  /* word */
1128  yyextra->token->name = yytext;
1129  return TK_WORD;
1130  }
1131 <St_Ref2>[ \t]+ {
1132  yyextra->token->chars=yytext;
1133  return TK_WHITESPACE;
1134  }
1135 <St_XRefItem>{LABELID} {
1136  yyextra->token->name=yytext;
1137  }
1138 <St_XRefItem>" " {
1139  BEGIN(St_XRefItem2);
1140  }
1141 <St_XRefItem2>[0-9]+"." {
1142  QCString numStr(yytext);
1143  numStr=numStr.left((int)yyleng-1);
1144  yyextra->token->id=numStr.toInt();
1145  return RetVal_OK;
1146  }
1147 <St_Para,St_Title,St_Ref2>"<!--" { /* html style comment block */
1148  yyextra->commentState = YY_START;
1149  BEGIN(St_Comment);
1150  }
1151 <St_Param>"\""[^\n\"]+"\"" {
1152  yyextra->token->name = yytext+1;
1153  yyextra->token->name = yyextra->token->name.left((int)yyleng-2);
1154  return TK_WORD;
1155  }
1156 <St_Param>({PHPTYPE}{BLANK}*("["{BLANK}*"]")*{BLANK}*"|"{BLANK}*)*{PHPTYPE}{BLANK}*("["{BLANK}*"]")*{WS}+("&")?"$"{LABELID} {
1157  lineCount(yytext,yyleng);
1158  QCString params(yytext);
1159  int j = params.find('&');
1160  int i = params.find('$');
1161  if (i<0) i=0; // should never happen
1162  if (j<i && j>=0) i=j;
1163  QCString types = params.left(i).stripWhiteSpace();
1164  yyextra->token->name = types+"#"+params.mid(i);
1165  return TK_WORD;
1166  }
1167 <St_Param>[^ \t\n,@\\]+ {
1168  yyextra->token->name = yytext;
1169  if (yyextra->token->name.at(static_cast<uint>(yyleng)-1)==':')
1170  {
1171  yyextra->token->name=yyextra->token->name.left(static_cast<uint>(yyleng)-1);
1172  }
1173  return TK_WORD;
1174  }
1175 <St_Param>{WS}*","{WS}* /* param separator */
1176 <St_Param>{WS} {
1177  lineCount(yytext,yyleng);
1178  yyextra->token->chars=yytext;
1179  return TK_WHITESPACE;
1180  }
1181 <St_Options>{ID} {
1182  yyextra->token->name+=yytext;
1183  }
1184 <St_Options>{WS}*":"{WS}* {
1185  lineCount(yytext,yyleng);
1186  yyextra->token->name+=":";
1187  }
1188 <St_Options>{WS}*","{WS}* |
1189 <St_Options>{WS} { /* option separator */
1190  lineCount(yytext,yyleng);
1191  yyextra->token->name+=",";
1192  }
1193 <St_Options>"}" {
1194  return TK_WORD;
1195  }
1196 <St_Block>{ID} {
1197  yyextra->token->name+=yytext;
1198  }
1199 <St_Block>"]" {
1200  return TK_WORD;
1201  }
1202 <St_Emoji>[:0-9_a-z+-]+ {
1203  yyextra->token->name=yytext;
1204  return TK_WORD;
1205  }
1206 <St_Emoji>. {
1207  return 0;
1208  }
1209 <St_Iline>{LINENR}/[\n\.] |
1210 <St_Iline>{LINENR}{BLANK} {
1211  bool ok = false;
1212  int nr = QCString(yytext).toInt(&ok);
1213  if (!ok)
1214  {
1215  warn(yyextra->fileName,yyextra->yyLineNr,"Invalid line number '%s' for iline command",yytext);
1216  }
1217  else
1218  {
1219  yyextra->yyLineNr = nr;
1220  }
1221  return TK_WORD;
1222  }
1223 <St_Iline>. {
1224  return 0;
1225  }
1226 <St_File>{FILEMASK} {
1227  yyextra->token->name = yytext;
1228  return TK_WORD;
1229  }
1230 <St_File>"\""[^\n\"]+"\"" {
1231  QCString text(yytext);
1232  yyextra->token->name = text.mid(1,text.length()-2);
1233  return TK_WORD;
1234  }
1235 <St_Pattern>[^\\\r\n]+ {
1236  yyextra->token->name += yytext;
1237  }
1238 <St_Pattern>"\\ilinebr" {
1239  yyextra->token->name = yyextra->token->name.stripWhiteSpace();
1240  return TK_WORD;
1241  }
1242 <St_Pattern>\n {
1243  lineCount(yytext,yyleng);
1244  yyextra->token->name = yyextra->token->name.stripWhiteSpace();
1245  return TK_WORD;
1246  }
1247 <St_Pattern>. {
1248  yyextra->token->name += yytext;
1249  }
1250 <St_Link>{LINKMASK}|{REFWORD} {
1251  yyextra->token->name = yytext;
1252  return TK_WORD;
1253  }
1254 <St_Comment>"-->" { /* end of html comment */
1255  BEGIN(yyextra->commentState);
1256  }
1257 <St_Comment>[^-]+ /* inside html comment */
1258 <St_Comment>. /* inside html comment */
1259 
1260  /* State for skipping title (all chars until the end of the line) */
1261 
1262 <St_SkipTitle>.
1263 <St_SkipTitle>(\n|"\\ilinebr") {
1264  lineCount(yytext,yyleng);
1265  return 0;
1266  }
1267 
1268  /* State for the pass used to find the anchors and sections */
1269 
1270 <St_Sections>[^\n@\<]+
1271 <St_Sections>{CMD}("<"|{CMD})
1272 <St_Sections>"<"{CAPTION}({WS}+{ATTRIB})*">" {
1273  lineCount(yytext,yyleng);
1274  QCString tag(yytext);
1275  int s=tag.find("id=");
1276  if (s!=-1) // command has id attribute
1277  {
1278  char c=tag[s+3];
1279  if (c=='\'' || c=='"') // valid start
1280  {
1281  int e=tag.find(c,s+4);
1282  if (e!=-1) // found matching end
1283  {
1284  yyextra->secType = SectionType::Table;
1285  yyextra->secLabel=tag.mid(s+4,e-s-4); // extract id
1286  processSection(yyscanner);
1287  }
1288  }
1289  }
1290  }
1291 <St_Sections>{CMD}"anchor"{BLANK}+ {
1292  yyextra->secType = SectionType::Anchor;
1293  BEGIN(St_SecLabel1);
1294  }
1295 <St_Sections>{CMD}"section"{BLANK}+ {
1296  yyextra->secType = SectionType::Section;
1297  BEGIN(St_SecLabel2);
1298  }
1299 <St_Sections>{CMD}"subsection"{BLANK}+ {
1300  yyextra->secType = SectionType::Subsection;
1301  BEGIN(St_SecLabel2);
1302  }
1303 <St_Sections>{CMD}"subsubsection"{BLANK}+ {
1304  yyextra->secType = SectionType::Subsubsection;
1305  BEGIN(St_SecLabel2);
1306  }
1307 <St_Sections>{CMD}"paragraph"{BLANK}+ {
1308  yyextra->secType = SectionType::Paragraph;
1309  BEGIN(St_SecLabel2);
1310  }
1311 <St_Sections>{CMD}"verbatim"/[^a-z_A-Z0-9] {
1312  yyextra->endMarker="endverbatim";
1313  BEGIN(St_SecSkip);
1314  }
1315 <St_Sections>{CMD}"dot"/[^a-z_A-Z0-9] {
1316  yyextra->endMarker="enddot";
1317  BEGIN(St_SecSkip);
1318  }
1319 <St_Sections>{CMD}"msc"/[^a-z_A-Z0-9] {
1320  yyextra->endMarker="endmsc";
1321  BEGIN(St_SecSkip);
1322  }
1323 <St_Sections>{CMD}"startuml"/[^a-z_A-Z0-9] {
1324  yyextra->endMarker="enduml";
1325  BEGIN(St_SecSkip);
1326  }
1327 <St_Sections>{CMD}"htmlonly"/[^a-z_A-Z0-9] {
1328  yyextra->endMarker="endhtmlonly";
1329  BEGIN(St_SecSkip);
1330  }
1331 <St_Sections>{CMD}"latexonly"/[^a-z_A-Z0-9] {
1332  yyextra->endMarker="endlatexonly";
1333  BEGIN(St_SecSkip);
1334  }
1335 <St_Sections>{CMD}"manonly"/[^a-z_A-Z0-9] {
1336  yyextra->endMarker="endmanonly";
1337  BEGIN(St_SecSkip);
1338  }
1339 <St_Sections>{CMD}"rtfonly"/[^a-z_A-Z0-9] {
1340  yyextra->endMarker="endrtfonly";
1341  BEGIN(St_SecSkip);
1342  }
1343 <St_Sections>{CMD}"xmlonly"/[^a-z_A-Z0-9] {
1344  yyextra->endMarker="endxmlonly";
1345  BEGIN(St_SecSkip);
1346  }
1347 <St_Sections>{CMD}"docbookonly"/[^a-z_A-Z0-9] {
1348  yyextra->endMarker="enddocbookonly";
1349  BEGIN(St_SecSkip);
1350  }
1351 <St_Sections>{CMD}"code"/[^a-z_A-Z0-9] {
1352  yyextra->endMarker="endcode";
1353  BEGIN(St_SecSkip);
1354  }
1355 <St_Sections>"<!--" {
1356  yyextra->endMarker="-->";
1357  BEGIN(St_SecSkip);
1358  }
1359 <St_SecSkip>{CMD}{ID} {
1360  if (yyextra->endMarker==yytext+1)
1361  {
1362  BEGIN(St_Sections);
1363  }
1364  }
1365 <St_SecSkip>"-->" {
1366  if (yyextra->endMarker==yytext)
1367  {
1368  BEGIN(St_Sections);
1369  }
1370  }
1371 <St_SecSkip>[^a-z_A-Z0-9\-\\\@]+
1372 <St_SecSkip>.
1373 <St_SecSkip>(\n|"\\ilinebr")
1374 <St_Sections>.
1375 <St_Sections>(\n|"\\ilinebr")
1376 <St_SecLabel1>{LABELID} {
1377  lineCount(yytext,yyleng);
1378  yyextra->secLabel = yytext;
1379  processSection(yyscanner);
1380  BEGIN(St_Sections);
1381  }
1382 <St_SecLabel2>{LABELID}{BLANK}+ |
1383 <St_SecLabel2>{LABELID} {
1384  yyextra->secLabel = yytext;
1385  yyextra->secLabel = yyextra->secLabel.stripWhiteSpace();
1386  BEGIN(St_SecTitle);
1387  }
1388 <St_SecTitle>[^\n]+ |
1389 <St_SecTitle>[^\n]*\n {
1390  lineCount(yytext,yyleng);
1391  yyextra->secTitle = yytext;
1392  yyextra->secTitle = yyextra->secTitle.stripWhiteSpace();
1393  if (yyextra->secTitle.right(8)=="\\ilinebr")
1394  {
1395  yyextra->secTitle.left(yyextra->secTitle.length()-8);
1396  }
1397  processSection(yyscanner);
1398  BEGIN(St_Sections);
1399  }
1400 <St_SecTitle,St_SecLabel1,St_SecLabel2>. {
1401  warn(yyextra->fileName,yyextra->yyLineNr,"Unexpected character '%s' while looking for section label or title",yytext);
1402  }
1403 
1404 <St_Snippet>[^\\\n]+ {
1405  yyextra->token->name += yytext;
1406  }
1407 <St_Snippet>"\\" {
1408  yyextra->token->name += yytext;
1409  }
1410 <St_Snippet>(\n|"\\ilinebr") {
1411  unput_string(yytext,yyleng);
1412  yyextra->token->name = yyextra->token->name.stripWhiteSpace();
1413  return TK_WORD;
1414  }
1415 
1416  /* Generic rules that work for all states */
1417 <*>\n {
1418  lineCount(yytext,yyleng);
1419  warn(yyextra->fileName,yyextra->yyLineNr,"Unexpected new line character");
1420  }
1421 <*>"\\ilinebr" {
1422  }
1423 <*>[\\@<>&$#%~"=] { /* unescaped special character */
1424  //warn(yyextra->fileName,yyextra->yyLineNr,"Unexpected character '%s', assuming command \\%s was meant.",yytext,yytext);
1425  yyextra->token->name = yytext;
1426  return TK_COMMAND_SEL();
1427  }
1428 <*>. {
1429  warn(yyextra->fileName,yyextra->yyLineNr,"Unexpected character '%s'",yytext);
1430  }
1431 %%
1432 
1433 //--------------------------------------------------------------------------
1434 
1435 static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size)
1436 {
1437  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1438  yy_size_t c=0;
1439  const char *p = yyextra->inputString + yyextra->inputPos;
1440  while ( c < max_size && *p ) { *buf++ = *p++; c++; }
1441  yyextra->inputPos+=c;
1442  return c;
1443 }
1444 
1445 static void processSection(yyscan_t yyscanner)
1446 {
1447  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1448  //printf("%s: found section/anchor with name '%s'\n",qPrint(g_fileName),qPrint(g_secLabel));
1449  QCString file;
1450  if (yyextra->definition)
1451  {
1452  file = yyextra->definition->getOutputFileBase();
1453  }
1454  else
1455  {
1456  warn(yyextra->fileName,yyextra->yyLineNr,"Found section/anchor %s without context\n",qPrint(yyextra->secLabel));
1457  }
1458  SectionInfo *si = SectionManager::instance().find(yyextra->secLabel);
1459  if (si)
1460  {
1461  si->setFileName(file);
1462  si->setType(yyextra->secType);
1463  }
1464 }
1465 
1466 static void handleHtmlTag(yyscan_t yyscanner,const char *text)
1467 {
1468  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1469 
1470  QCString tagText(text);
1471  yyextra->token->attribs.clear();
1472  yyextra->token->endTag = FALSE;
1473  yyextra->token->emptyTag = FALSE;
1474 
1475  // Check for end tag
1476  int startNamePos=1;
1477  if (tagText.at(1)=='/')
1478  {
1479  yyextra->token->endTag = TRUE;
1480  startNamePos++;
1481  }
1482 
1483  // Parse the name portion
1484  int i = startNamePos;
1485  for (i=startNamePos; i < (int)yyleng; i++)
1486  {
1487  // Check for valid HTML/XML name chars (including namespaces)
1488  char c = tagText.at(i);
1489  if (!(isalnum(c) || c=='-' || c=='_' || c==':')) break;
1490  }
1491  yyextra->token->name = tagText.mid(startNamePos,i-startNamePos);
1492 
1493  // Parse the attributes. Each attribute is a name, value pair
1494  // The result is stored in yyextra->token->attribs.
1495  int startName,endName,startAttrib,endAttrib;
1496  int startAttribList = i;
1497  while (i<(int)yyleng)
1498  {
1499  char c=tagText.at(i);
1500  // skip spaces
1501  while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); }
1502  // check for end of the tag
1503  if (c == '>') break;
1504  // Check for XML style "empty" tag.
1505  if (c == '/')
1506  {
1507  yyextra->token->emptyTag = TRUE;
1508  break;
1509  }
1510  startName=i;
1511  // search for end of name
1512  while (i<(int)yyleng && !isspace((uchar)c) && c!='=' && c!= '>') { c=tagText.at(++i); }
1513  endName=i;
1514  HtmlAttrib opt;
1515  opt.name = tagText.mid(startName,endName-startName).lower();
1516  // skip spaces
1517  while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); }
1518  if (tagText.at(i)=='=') // option has value
1519  {
1520  c=tagText.at(++i);
1521  // skip spaces
1522  while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); }
1523  if (tagText.at(i)=='\'') // option '...'
1524  {
1525  c=tagText.at(++i);
1526  startAttrib=i;
1527 
1528  // search for matching quote
1529  while (i<(int)yyleng && c!='\'') { c=tagText.at(++i); }
1530  endAttrib=i;
1531  if (i<(int)yyleng) { c=tagText.at(++i);}
1532  }
1533  else if (tagText.at(i)=='"') // option "..."
1534  {
1535  c=tagText.at(++i);
1536  startAttrib=i;
1537  // search for matching quote
1538  while (i<(int)yyleng && c!='"') { c=tagText.at(++i); }
1539  endAttrib=i;
1540  if (i<(int)yyleng) { c=tagText.at(++i);}
1541  }
1542  else // value without any quotes
1543  {
1544  startAttrib=i;
1545  // search for separator or end symbol
1546  while (i<(int)yyleng && !isspace((uchar)c) && c!='>') { c=tagText.at(++i); }
1547  endAttrib=i;
1548  if (i<(int)yyleng) { c=tagText.at(++i);}
1549  }
1550  opt.value = tagText.mid(startAttrib,endAttrib-startAttrib);
1551  if (opt.name == "align") opt.value = opt.value.lower();
1552  else if (opt.name == "valign")
1553  {
1554  opt.value = opt.value.lower();
1555  if (opt.value == "center") opt.value="middle";
1556  }
1557  }
1558  else // start next option
1559  {
1560  }
1561  //printf("=====> Adding option name=<%s> value=<%s>\n",
1562  // qPrint(opt.name),qPrint(opt.value));
1563  yyextra->token->attribs.push_back(opt);
1564  }
1565  yyextra->token->attribsStr = tagText.mid(startAttribList,i-startAttribList);
1566 }
1567 
1568 struct DocTokenizer::Private
1569 {
1570  yyscan_t yyscanner;
1571  doctokenizerYY_state extra;
1572 };
1573 
1574 
1575 void DocTokenizer::pushContext()
1576 {
1577  yyscan_t yyscanner = p->yyscanner;
1578  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1579  //printf("DocTokenizer::pushContext() stack=%zu\n",yyextra->lexerStack.size());
1580  yyextra->lexerStack.push(
1581  std::make_unique<DocLexerContext>(
1582  yyextra->token,YY_START,
1583  yyextra->autoListLevel,
1584  yyextra->inputPos,
1585  yyextra->inputString,
1586  YY_CURRENT_BUFFER));
1587  yy_switch_to_buffer(yy_create_buffer(0, YY_BUF_SIZE, yyscanner), yyscanner);
1588 }
1589 
1590 bool DocTokenizer::popContext()
1591 {
1592  yyscan_t yyscanner = p->yyscanner;
1593  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1594  //printf("DocTokenizer::popContext() stack=%zu\n",yyextra->lexerStack.size());
1595  if (yyextra->lexerStack.empty()) return FALSE;
1596  const auto &ctx = yyextra->lexerStack.top();
1597  yyextra->autoListLevel = ctx->autoListLevel;
1598  yyextra->inputPos = ctx->inputPos;
1599  yyextra->inputString = ctx->inputString;
1600 
1601  yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
1602  yy_switch_to_buffer(ctx->state, yyscanner);
1603 
1604  BEGIN(ctx->rule);
1605  yyextra->lexerStack.pop();
1606  return TRUE;
1607 }
1608 
1609 
1610 DocTokenizer::DocTokenizer() : p(std::make_unique<Private>())
1611 {
1612  //printf("%p:DocTokenizer::DocTokenizer()\n",(void*)this);
1613  doctokenizerYYlex_init_extra(&p->extra,&p->yyscanner);
1614 #ifdef FLEX_DEBUG
1615  doctokenizerYYset_debug(1,p->yyscanner);
1616 #endif
1617 }
1618 
1619 DocTokenizer::~DocTokenizer()
1620 {
1621  //printf("%p:DocTokenizer::~DocTokenizer()\n",(void*)this);
1622  doctokenizerYYlex_destroy(p->yyscanner);
1623 }
1624 
1625 int DocTokenizer::lex()
1626 {
1627  return doctokenizerYYlex(p->yyscanner);
1628 }
1629 
1630 void DocTokenizer::findSections(const QCString &input,const Definition *d,
1631  const QCString &fileName)
1632 {
1633  yyscan_t yyscanner = p->yyscanner;
1634  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1635 
1636  if (input.isEmpty()) return;
1637  printlex(yy_flex_debug, TRUE, __FILE__, qPrint(fileName));
1638  yyextra->inputString = input.data();
1639  //printf("parsing --->'%s'<---\n",input);
1640  yyextra->inputPos = 0;
1641  yyextra->definition = d;
1642  yyextra->fileName = fileName;
1643  BEGIN(St_Sections);
1644  yyextra->yyLineNr = 1;
1645  doctokenizerYYlex(yyscanner);
1646  printlex(yy_flex_debug, FALSE, __FILE__, qPrint(fileName));
1647 }
1648 
1649 void DocTokenizer::init(const char *input,const QCString &fileName,bool markdownSupport)
1650 {
1651  yyscan_t yyscanner = p->yyscanner;
1652  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1653  yyextra->autoListLevel = 0;
1654  yyextra->inputString = input;
1655  yyextra->inputPos = 0;
1656  yyextra->fileName = fileName;
1657  yyextra->insidePre = FALSE;
1658  yyextra->markdownSupport = markdownSupport;
1659  BEGIN(St_Para);
1660 }
1661 
1662 TokenInfo *DocTokenizer::newToken()
1663 {
1664  yyscan_t yyscanner = p->yyscanner;
1665  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1666  return yyextra->token = new TokenInfo;
1667 }
1668 
1669 void DocTokenizer::replaceToken(TokenInfo *newToken)
1670 {
1671  yyscan_t yyscanner = p->yyscanner;
1672  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1673  delete yyextra->token;
1674  yyextra->token = newToken;
1675 }
1676 
1677 void DocTokenizer::setStatePara()
1678 {
1679  yyscan_t yyscanner = p->yyscanner;
1680  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1681  BEGIN(St_Para);
1682 }
1683 
1684 void DocTokenizer::setStateTitle()
1685 {
1686  yyscan_t yyscanner = p->yyscanner;
1687  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1688  BEGIN(St_Title);
1689 }
1690 
1691 void DocTokenizer::setStateTitleAttrValue()
1692 {
1693  yyscan_t yyscanner = p->yyscanner;
1694  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1695  BEGIN(St_TitleV);
1696 }
1697 
1698 void DocTokenizer::setStateCode()
1699 {
1700  yyscan_t yyscanner = p->yyscanner;
1701  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1702  yyextra->token->verb="";
1703  yyextra->token->name="";
1704  BEGIN(St_CodeOpt);
1705 }
1706 
1707 void DocTokenizer::setStateXmlCode()
1708 {
1709  yyscan_t yyscanner = p->yyscanner;
1710  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1711  yyextra->token->verb="";
1712  yyextra->token->name="";
1713  BEGIN(St_XmlCode);
1714 }
1715 
1716 void DocTokenizer::setStateHtmlOnly()
1717 {
1718  yyscan_t yyscanner = p->yyscanner;
1719  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1720  yyextra->token->verb="";
1721  yyextra->token->name="";
1722  BEGIN(St_HtmlOnlyOption);
1723 }
1724 
1725 void DocTokenizer::setStateManOnly()
1726 {
1727  yyscan_t yyscanner = p->yyscanner;
1728  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1729  yyextra->token->verb="";
1730  BEGIN(St_ManOnly);
1731 }
1732 
1733 void DocTokenizer::setStateRtfOnly()
1734 {
1735  yyscan_t yyscanner = p->yyscanner;
1736  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1737  yyextra->token->verb="";
1738  BEGIN(St_RtfOnly);
1739 }
1740 
1741 void DocTokenizer::setStateXmlOnly()
1742 {
1743  yyscan_t yyscanner = p->yyscanner;
1744  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1745  yyextra->token->verb="";
1746  BEGIN(St_XmlOnly);
1747 }
1748 
1749 void DocTokenizer::setStateDbOnly()
1750 {
1751  yyscan_t yyscanner = p->yyscanner;
1752  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1753  yyextra->token->verb="";
1754  BEGIN(St_DbOnly);
1755 }
1756 
1757 void DocTokenizer::setStateLatexOnly()
1758 {
1759  yyscan_t yyscanner = p->yyscanner;
1760  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1761  yyextra->token->verb="";
1762  BEGIN(St_LatexOnly);
1763 }
1764 
1765 void DocTokenizer::setStateVerbatim()
1766 {
1767  yyscan_t yyscanner = p->yyscanner;
1768  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1769  yyextra->token->verb="";
1770  BEGIN(St_Verbatim);
1771 }
1772 
1773 void DocTokenizer::setStateDot()
1774 {
1775  yyscan_t yyscanner = p->yyscanner;
1776  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1777  yyextra->token->verb="";
1778  BEGIN(St_Dot);
1779 }
1780 
1781 void DocTokenizer::setStateMsc()
1782 {
1783  yyscan_t yyscanner = p->yyscanner;
1784  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1785  yyextra->token->verb="";
1786  BEGIN(St_Msc);
1787 }
1788 
1789 void DocTokenizer::setStatePlantUMLOpt()
1790 {
1791  yyscan_t yyscanner = p->yyscanner;
1792  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1793  yyextra->token->verb="";
1794  yyextra->token->sectionId="";
1795  BEGIN(St_PlantUMLOpt);
1796 }
1797 
1798 void DocTokenizer::setStatePlantUML()
1799 {
1800  yyscan_t yyscanner = p->yyscanner;
1801  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1802  yyextra->token->verb="";
1803  BEGIN(St_PlantUML);
1804 }
1805 
1806 void DocTokenizer::setStateParam()
1807 {
1808  yyscan_t yyscanner = p->yyscanner;
1809  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1810  BEGIN(St_Param);
1811 }
1812 
1813 void DocTokenizer::setStateXRefItem()
1814 {
1815  yyscan_t yyscanner = p->yyscanner;
1816  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1817  BEGIN(St_XRefItem);
1818 }
1819 
1820 void DocTokenizer::setStateFile()
1821 {
1822  yyscan_t yyscanner = p->yyscanner;
1823  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1824  BEGIN(St_File);
1825 }
1826 
1827 void DocTokenizer::setStatePattern()
1828 {
1829  yyscan_t yyscanner = p->yyscanner;
1830  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1831  yyextra->token->name = "";
1832  BEGIN(St_Pattern);
1833 }
1834 
1835 void DocTokenizer::setStateLink()
1836 {
1837  yyscan_t yyscanner = p->yyscanner;
1838  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1839  BEGIN(St_Link);
1840 }
1841 
1842 void DocTokenizer::setStateCite()
1843 {
1844  yyscan_t yyscanner = p->yyscanner;
1845  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1846  BEGIN(St_Cite);
1847 }
1848 
1849 void DocTokenizer::setStateRef()
1850 {
1851  yyscan_t yyscanner = p->yyscanner;
1852  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1853  BEGIN(St_Ref);
1854 }
1855 
1856 void DocTokenizer::setStateInternalRef()
1857 {
1858  yyscan_t yyscanner = p->yyscanner;
1859  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1860  BEGIN(St_IntRef);
1861 }
1862 
1863 void DocTokenizer::setStateText()
1864 {
1865  yyscan_t yyscanner = p->yyscanner;
1866  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1867  BEGIN(St_Text);
1868 }
1869 
1870 void DocTokenizer::setStateSkipTitle()
1871 {
1872  yyscan_t yyscanner = p->yyscanner;
1873  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1874  BEGIN(St_SkipTitle);
1875 }
1876 
1877 void DocTokenizer::setStateAnchor()
1878 {
1879  yyscan_t yyscanner = p->yyscanner;
1880  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1881  BEGIN(St_Anchor);
1882 }
1883 
1884 void DocTokenizer::setStateSnippet()
1885 {
1886  yyscan_t yyscanner = p->yyscanner;
1887  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1888  yyextra->token->name="";
1889  BEGIN(St_Snippet);
1890 }
1891 
1892 void DocTokenizer::setStateSetScope()
1893 {
1894  yyscan_t yyscanner = p->yyscanner;
1895  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1896  BEGIN(St_SetScope);
1897 }
1898 
1899 void DocTokenizer::setStateOptions()
1900 {
1901  yyscan_t yyscanner = p->yyscanner;
1902  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1903  yyextra->token->name="";
1904  BEGIN(St_Options);
1905 }
1906 
1907 void DocTokenizer::setStateBlock()
1908 {
1909  yyscan_t yyscanner = p->yyscanner;
1910  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1911  yyextra->token->name="";
1912  BEGIN(St_Block);
1913 }
1914 
1915 void DocTokenizer::setStateEmoji()
1916 {
1917  yyscan_t yyscanner = p->yyscanner;
1918  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1919  yyextra->token->name="";
1920  BEGIN(St_Emoji);
1921 }
1922 
1923 void DocTokenizer::setStateIline()
1924 {
1925  yyscan_t yyscanner = p->yyscanner;
1926  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1927  BEGIN(St_Iline);
1928 }
1929 
1930 void DocTokenizer::cleanup()
1931 {
1932  yyscan_t yyscanner = p->yyscanner;
1933  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1934  yy_delete_buffer( YY_CURRENT_BUFFER, yyscanner );
1935 }
1936 
1937 void DocTokenizer::setInsidePre(bool b)
1938 {
1939  yyscan_t yyscanner = p->yyscanner;
1940  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1941  yyextra->insidePre = b;
1942 }
1943 
1944 void DocTokenizer::pushBackHtmlTag(const QCString &tag)
1945 {
1946  yyscan_t yyscanner = p->yyscanner;
1947  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1948  QCString tagName = tag;
1949  int i,l = tagName.length();
1950  unput('>');
1951  for (i=l-1;i>=0;i--)
1952  {
1953  unput(tag[i]);
1954  }
1955  unput('<');
1956 }
1957 
1958 void DocTokenizer::startAutoList()
1959 {
1960  yyscan_t yyscanner = p->yyscanner;
1961  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1962  yyextra->autoListLevel++;
1963 }
1964 
1965 void DocTokenizer::endAutoList()
1966 {
1967  yyscan_t yyscanner = p->yyscanner;
1968  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1969  yyextra->autoListLevel--;
1970 }
1971 
1972 //REAL_YY_DECL
1973 //{
1974 // printlex(yy_flex_debug, TRUE, __FILE__, g_fileName);
1975 // int retval = LOCAL_YY_DECL;
1976 // printlex(yy_flex_debug, FALSE, __FILE__, g_fileName);
1977 // return retval;
1978 //}
1979 
1980 void DocTokenizer::setLineNr(int lineno)
1981 {
1982  yyscan_t yyscanner = p->yyscanner;
1983  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1984  yyextra->yyLineNr = lineno;
1985 }
1986 
1987 int DocTokenizer::getLineNr(void)
1988 {
1989  yyscan_t yyscanner = p->yyscanner;
1990  struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
1991  return yyextra->yyLineNr;
1992 }
1993 
1994 #if USE_STATE2STRING
1995 #include "doctokenizer.l.h"
1996 #endif