14%option never-interactive
15%option prefix="lexcodeYY"
18%option extra-type="struct lexcodeYY_state *"
22#define YY_TYPEDEF_YY_SCANNER_T
44#define YY_NEVER_INTERACTIVE 1
46#define YY_NO_UNISTD_H 1
109#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
112static inline const char *
getLexerFILE() {
return __FILE__;}
The common base class of all entity definitions found in the sources.
A model of a file symbol.
A model of a class/file/namespace member symbol.
Class representing a list of different code generators.
This is an alternative implementation of QCString.
static void endCodeLine(yyscan_t yyscanner)
static void nextCodeLine(yyscan_t yyscanner)
static void startCodeLine(yyscan_t yyscanner)
static void codifyLines(yyscan_t yyscanner, const QCString &text)
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
static int countLines(yyscan_t yyscanner)
static const char * stateToString(int state)
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
static const char * getLexerFILE()
static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
#define lineCount(s, len)
static void handleCCode(yyscan_t yyscanner)
Web server based search engine.
std::unique_ptr< FileDef > exampleFileDef
const FileDef * sourceFileDef
int inputPosition
read offset during parsing
QCString rulesPatternBuffer
const char * currentFontClass
int lastPreLineCtrlContext
const Definition * currentDefinition
const char * inputString
the code fragment as text
int inputLines
number of line in the code fragment
const MemberDef * currentMemberDef
const Definition * searchCtx
int yyLineNr
current line number
A bunch of utility functions.
126RulesSharp "<"[^>\n]*">"
127RulesCurly "{"[^{}\n]*"}"
132EscapeRulesCharOpen "\\["|"\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\"
133EscapeRulesCharClose "\\]"|"\>"|"\\}"|"\\)"
134EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose}
141ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
144RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
145RAWEND ")"[^ \t\(\)\\]{0,16}\"
146CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
158DCOMM ("/\*!"|"/\**"|"/\/!"|"/\/\/")
197<DefSection>^{TopStart} {
200 yyextra->lastContext = YY_START;
201 yyextra->startCCodeLine=yyextra->yyLineNr;
204<DefSection>^{LiteralStart} {
207 yyextra->lastContext = YY_START;
208 yyextra->startCCodeLine=yyextra->yyLineNr;
209 BEGIN (LiteralSection);
211<TopSection>^{TopEnd} {
214 BEGIN( yyextra->lastContext ) ;
217 yyextra->CCodeBuffer += yytext;
220<LiteralSection>^{LiteralEnd} {
223 BEGIN( yyextra->lastContext ) ;
225<LiteralSection>.*{nl} {
226 yyextra->CCodeBuffer += yytext;
229<DefSection>{CPPC}.*{nl} {
230 yyextra->CCodeBuffer += yytext;
233<DefSection>^{ws}*{CCS} {
234 yyextra->CCodeBuffer += yytext;
235 yyextra->lastContext = YY_START;
238<COMMENT>{CCE}{ws}*{nl} {
239 yyextra->CCodeBuffer+=yytext;
242 BEGIN(yyextra->lastContext);
245 yyextra->CCodeBuffer+=yytext;
247 BEGIN(yyextra->lastContext);
250 yyextra->CCodeBuffer += yytext;
252<COMMENT>{CPPC}|{CCS} {
253 yyextra->CCodeBuffer += yytext;
256 yyextra->CCodeBuffer += yytext;
260 yyextra->CCodeBuffer += yytext;
265 yyextra->startCCodeLine=yyextra->yyLineNr;
267<DefSection>^{ws}.*{nl} {
268 yyextra->CCodeBuffer += yytext;
271<DefSection>^{RulesStart} {
274 yyextra->startCCodeLine=yyextra->yyLineNr;
275 BEGIN (RulesSectionInit);
280 BEGIN(DefSectionLine);
282<DefSectionLine>.*{nl} {
284 yyextra->startCCodeLine=yyextra->yyLineNr;
287<RulesSectionInit,RulesPattern>^{RulesEnd} {
290 yyextra->startCCodeLine=yyextra->yyLineNr;
293<RulesSectionInit>^{nws} {
298<RulesSectionInit>{nl} {
299 yyextra->CCodeBuffer += yytext;
302<RulesSectionInit>^{ws}.*{nl} {
303 yyextra->CCodeBuffer += yytext;
306<RulesPattern>"<<EOF>>" {
307 yyextra->rulesPatternBuffer += yytext;
309<RulesPattern>{EscapeRulesChar} {
310 yyextra->rulesPatternBuffer += yytext;
312<RulesPattern>{RulesSharp} {
313 yyextra->rulesPatternBuffer += yytext;
315<RulesPattern>{RulesCurly} {
316 yyextra->rulesPatternBuffer += yytext;
318<RulesPattern>{StartDouble} {
319 yyextra->rulesPatternBuffer += yytext;
320 yyextra->lastContext = YY_START;
323<RulesDouble,RulesRoundDouble>"\\\\" {
324 yyextra->rulesPatternBuffer += yytext;
326<RulesDouble,RulesRoundDouble>"\\\"" {
327 yyextra->rulesPatternBuffer += yytext;
330 yyextra->rulesPatternBuffer += yytext;
331 BEGIN( yyextra->lastContext ) ;
333<RulesRoundDouble>"\"" {
334 yyextra->rulesPatternBuffer += yytext;
337<RulesDouble,RulesRoundDouble>. {
338 yyextra->rulesPatternBuffer += yytext;
340<RulesPattern>{StartSquare} {
341 yyextra->rulesPatternBuffer += yytext;
342 yyextra->lastContext = YY_START;
345<RulesSquare,RulesRoundSquare>{CHARCE} {
346 yyextra->rulesPatternBuffer += yytext;
348<RulesSquare,RulesRoundSquare>"\\[" |
349<RulesSquare,RulesRoundSquare>"\\]" {
350 yyextra->rulesPatternBuffer += yytext;
353 yyextra->rulesPatternBuffer += yytext;
354 BEGIN(RulesPattern) ;
356<RulesRoundSquare>"]" {
357 yyextra->rulesPatternBuffer += yytext;
360<RulesSquare,RulesRoundSquare>"\\\\" {
361 yyextra->rulesPatternBuffer += yytext;
363<RulesSquare,RulesRoundSquare>. {
364 yyextra->rulesPatternBuffer += yytext;
366<RulesPattern>{StartRoundQuest} {
367 yyextra->rulesPatternBuffer += yytext;
368 yyextra->lastContext = YY_START;
369 BEGIN(RulesRoundQuest);
371<RulesRoundQuest>{nl} {
372 yyextra->rulesPatternBuffer += yytext;
373 if (!yyextra->rulesPatternBuffer.isEmpty())
376 codifyLines(yyscanner,yyextra->rulesPatternBuffer.data());
377 yyextra->rulesPatternBuffer.clear();
381<RulesRoundQuest>[^)] {
382 yyextra->rulesPatternBuffer += yytext;
384<RulesRoundQuest>")" {
385 yyextra->rulesPatternBuffer += yytext;
386 BEGIN(yyextra->lastContext);
388<RulesPattern>{StartRound} {
389 yyextra->roundCount++;
390 yyextra->rulesPatternBuffer += yytext;
391 yyextra->lastContext = YY_START;
394<RulesRound>{RulesCurly} {
395 yyextra->rulesPatternBuffer += yytext;
397<RulesRound>{StartSquare} {
398 yyextra->rulesPatternBuffer += yytext;
399 BEGIN(RulesRoundSquare);
401<RulesRound>{StartDouble} {
402 yyextra->rulesPatternBuffer += yytext;
403 BEGIN(RulesRoundDouble);
405<RulesRound>{EscapeRulesChar} {
406 yyextra->rulesPatternBuffer += yytext;
409 yyextra->roundCount++;
410 yyextra->rulesPatternBuffer += yytext;
413 yyextra->roundCount--;
414 yyextra->rulesPatternBuffer += yytext;
415 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
418 yyextra->rulesPatternBuffer += yytext;
422 yyextra->rulesPatternBuffer += yytext;
425 yyextra->rulesPatternBuffer += yytext;
427<RulesPattern>{ws}+"|" {
428 if (!yyextra->rulesPatternBuffer.isEmpty())
431 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
432 yyextra->rulesPatternBuffer.clear();
436 yyextra->startCCodeLine=yyextra->yyLineNr;
437 yyextra->curlyCount = 0;
440<RulesPattern>^{ws}*{nl} {
443<RulesPattern>^{ws}+ {
446<RulesPattern>({ws}|{nl}) {
448 if (!yyextra->rulesPatternBuffer.isEmpty())
451 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
452 yyextra->rulesPatternBuffer.clear();
455 yyextra->startCCodeLine=yyextra->yyLineNr;
456 yyextra->curlyCount = 0;
459<RulesPattern>"\\\\" {
460 yyextra->rulesPatternBuffer += yytext;
463 if (!yyextra->rulesPatternBuffer.isEmpty())
466 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
467 yyextra->rulesPatternBuffer.clear();
470 yyextra->CCodeBuffer += yytext;
471 yyextra->lastContext = YY_START;
475 yyextra->rulesPatternBuffer += yytext;
477<SkipCurly>{B}*"#"{B}+[0-9]+{B}+/"\"" {
478 yyextra->CCodeBuffer += yytext;
479 yyextra->lastPreLineCtrlContext = YY_START;
480 BEGIN( PreLineCtrl );
482<PreLineCtrl>"\""[^\n\"]*"\"" {
483 yyextra->CCodeBuffer += yytext;
486 yyextra->CCodeBuffer += yytext;
489 yyextra->CCodeBuffer += yytext;
491 BEGIN( yyextra->lastPreLineCtrlContext );
494 yyextra->CCodeBuffer += yytext;
495 ++yyextra->curlyCount ;
497<SkipCurly>"}"/{BN}*{DCOMM}"<!--" |
499 yyextra->CCodeBuffer += yytext;
501 if( yyextra->curlyCount )
503 --yyextra->curlyCount ;
506<SkipCurly>"}"{BN}*{DCOMM}"<" {
507 yyextra->CCodeBuffer += yytext;
509 if ( yyextra->curlyCount )
511 --yyextra->curlyCount ;
515 yyextra->docBlockContext = SkipCurlyEndDoc;
516 if (yytext[yyleng-3]==
'/')
527 yyextra->CCodeBuffer += yytext;
528 yyextra->lastStringContext=SkipCurly;
532 yyextra->CCodeBuffer += yytext;
533 yyextra->lastPreLineCtrlContext = YY_START;
534 BEGIN( PreLineCtrl );
536<SkipCurly>{B}*{RAWBEGIN} {
540 yyextra->lastRawStringContext = YY_START;
541 yyextra->CCodeBuffer += yytext;
QCString extractBeginRawStringDelimiter(const char *rawStart)
544<SkipCurly>[^\n#"'@\\/{}<]+ {
545 yyextra->CCodeBuffer += yytext;
548 yyextra->CCodeBuffer += yytext;
549 yyextra->lastCContext = YY_START;
553 yyextra->CCodeBuffer += yytext;
554 yyextra->lastCContext = YY_START;
555 BEGIN(SkipCxxComment);
557<SkipCurly>{CHARLIT} {
558 yyextra->CCodeBuffer += yytext;
561 yyextra->CCodeBuffer += yytext;
564 yyextra->CCodeBuffer += yytext;
566<SkipCurly>({CPPC}{B}*)?{CCS}"!" {
567 yyextra->CCodeBuffer += yytext;
568 yyextra->docBlockContext = YY_START;
571<SkipCurly>{CCS}"*"[*]+{BL} {
573 yyextra->CCodeBuffer += yytext;
577 yyextra->docBlockContext = YY_START;
#define Config_getBool(name)
585<SkipCurly>({CPPC}{B}*)?{CCS}"*"/{NCOMM} {
586 yyextra->CCodeBuffer += yytext;
587 yyextra->docBlockContext = YY_START;
590<SkipCurly>{CPPC}"!" {
591 yyextra->CCodeBuffer += yytext;
592 yyextra->docBlockContext = YY_START;
595<SkipCurly>{CPPC}"/"/[^/] {
596 yyextra->CCodeBuffer += yytext;
597 yyextra->docBlockContext = YY_START;
602 yyextra->CCodeBuffer += yytext;
604 if (yyextra->curlyCount<=0)
611 yyextra->CCodeBuffer += yytext;
614 yyextra->CCodeBuffer += yytext;
615 BEGIN( yyextra->lastStringContext );
617<SkipString>{CCS}|{CCE}|{CPPC} {
618 yyextra->CCodeBuffer += yytext;
621 yyextra->CCodeBuffer += yytext;
625 yyextra->CCodeBuffer += yytext;
627<SkipCxxComment>.*"\\\n" {
628 yyextra->CCodeBuffer += yytext;
631<SkipCxxComment>{ANYopt}/\n {
632 yyextra->CCodeBuffer += yytext;
633 BEGIN( yyextra->lastCContext ) ;
636 yyextra->CCodeBuffer += yytext ;
639<Comment>{CCS} { yyextra->CCodeBuffer += yytext ; }
640<Comment>{CPPC} { yyextra->CCodeBuffer += yytext ; }
641<Comment>{CMD}("code"|"verbatim"|"iliteral") {
642 yyextra->insideCode=
TRUE;
643 yyextra->CCodeBuffer += yytext ;
645<Comment>{CMD}("endcode"|"endverbatim"|"endiliteral") {
646 yyextra->insideCode=
FALSE;
647 yyextra->CCodeBuffer += yytext ;
649<Comment>[^ \.\t\r\n\/\*]+ { yyextra->CCodeBuffer += yytext ; }
651 yyextra->CCodeBuffer += yytext ;
652 if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ;
654<Comment>. { yyextra->CCodeBuffer += *yytext ; }
656<SkipComment>{CPPC}|{CCS} {
657 yyextra->CCodeBuffer += yytext;
659<SkipComment>[^\*\n]+ {
660 yyextra->CCodeBuffer += yytext;
663 yyextra->CCodeBuffer += yytext;
666<SkipComment>{B}*{CCE} {
667 yyextra->CCodeBuffer += yytext;
668 BEGIN( yyextra->lastCContext );
671 yyextra->CCodeBuffer += yytext;
674 yyextra->CCodeBuffer += yytext;
677 BEGIN(yyextra->lastRawStringContext);
QCString extractEndRawStringDelimiter(const char *rawEnd)
681 yyextra->CCodeBuffer += yytext;
684 yyextra->CCodeBuffer += yytext;
687 yyextra->CCodeBuffer += yytext;
693<DocLine>[^\n]*"\n"[ \t]*{CPPC}[/!][<]? {
694 yyextra->CCodeBuffer += yytext;
697<DocLine>{B}*{CPPC}"/"[/]+{Bopt}/"\n" {
698 yyextra->CCodeBuffer += yytext;
699 BEGIN( yyextra->docBlockContext );
701<DocLine>{NONLopt}/"\n"{B}*{CPPC}[!/]{B}*{CMD}"}" {
702 yyextra->CCodeBuffer += yytext;
703 BEGIN( yyextra->docBlockContext );
705<DocLine>{NONLopt}/"\n" {
706 yyextra->CCodeBuffer += yytext;
707 BEGIN( yyextra->docBlockContext );
713 yyextra->CCodeBuffer += yytext;
714 BEGIN(yyextra->docBlockContext);
716<DocBlock>^{B}*"*"+/[^/] {
717 yyextra->CCodeBuffer += yytext;
719<DocBlock>^{B}*({CPPC})?{B}*"*"+/[^/a-z_A-Z0-9*] {
720 yyextra->CCodeBuffer += yytext;
722<DocBlock>^{B}*({CPPC}){B}* {
723 yyextra->CCodeBuffer += yytext;
726 yyextra->CCodeBuffer += yytext;
730 yyextra->CCodeBuffer += yytext;
732<DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
733 yyextra->CCodeBuffer += yytext;
735<DocBlock>{CMD}("f$"|"f["|"f{"|"f(") {
736 yyextra->CCodeBuffer += yytext;
737 yyextra->docBlockName=&yytext[1];
738 if (yyextra->docBlockName.at(1)==
'[')
740 yyextra->docBlockName.at(1)=
']';
742 if (yyextra->docBlockName.at(1)==
'{')
744 yyextra->docBlockName.at(1)=
'}';
746 if (yyextra->docBlockName.at(1)==
'(')
748 yyextra->docBlockName.at(1)=
')';
750 yyextra->fencedSize=0;
751 yyextra->nestedComment=
FALSE;
754<DocBlock>{B}*"<"{PRE}">" {
755 yyextra->CCodeBuffer += yytext;
756 yyextra->docBlockName=
"<pre>";
757 yyextra->fencedSize=0;
758 yyextra->nestedComment=
FALSE;
761<DocBlock>{CMD}"startuml"/[^a-z_A-Z0-9\-] {
762 yyextra->CCodeBuffer += yytext;
763 yyextra->docBlockName=
"uml";
764 yyextra->fencedSize=0;
765 yyextra->nestedComment=
FALSE;
768<DocBlock>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] {
769 yyextra->CCodeBuffer += yytext;
770 yyextra->docBlockName=&yytext[1];
771 yyextra->fencedSize=0;
772 yyextra->nestedComment=
FALSE;
775<DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
776 yyextra->CCodeBuffer += yytext;
778 yyextra->docBlockName=
"~~~";
780 yyextra->nestedComment=
FALSE;
size_t length() const
Returns the length of the string, not counting the 0-terminator.
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
783<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
784 yyextra->CCodeBuffer += yytext;
786 yyextra->docBlockName=
"```";
788 yyextra->nestedComment=
FALSE;
791<DocBlock>{B}*"<code>" {
794<DocBlock>[^@*~\/\\\n]+ {
795 yyextra->CCodeBuffer += yytext;
798 yyextra->CCodeBuffer += yytext;
802 yyextra->CCodeBuffer += yytext;
806<DocCopyBlock>"</"{PRE}">" {
807 yyextra->CCodeBuffer += yytext;
808 if (yyextra->docBlockName==
"<pre>")
813<DocCopyBlock>"</"{CODE}">" {
814 yyextra->CCodeBuffer += yytext;
815 if (yyextra->docBlockName==
"<code>")
820<DocCopyBlock>{CMD}("f$"|"f]"|"f}"|"f)") {
821 yyextra->CCodeBuffer += yytext;
822 if (yyextra->docBlockName==&yytext[1])
827<DocCopyBlock>{CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9] {
828 yyextra->CCodeBuffer += yytext;
829 if (&yytext[4]==yyextra->docBlockName)
834<DocCopyBlock>^{B}*"*"+/{BN}+ {
835 yyextra->CCodeBuffer += yytext;
836 if ((yyextra->docBlockName==
"verbatim") || (yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
842 yyextra->CCodeBuffer += yytext;
845<DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* {
846 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
848 yyextra->CCodeBuffer += yytext;
855<DocCopyBlock>^{B}*"*"+/({ID}|"(") {
856 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
858 yyextra->CCodeBuffer += yytext;
865<DocCopyBlock>^{B}*"*"+/{BN}* {
866 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
868 if (yyextra->nestedComment)
870 yyextra->CCodeBuffer += yytext;
874 yyextra->CCodeBuffer += yytext;
882<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
883 yyextra->CCodeBuffer += yytext;
890<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
891 yyextra->CCodeBuffer += yytext;
898<DocCopyBlock>[^<@/\*\]~\$\\\n]+ {
899 yyextra->CCodeBuffer += yytext;
901<DocCopyBlock>{CCS}|{CCE}|{CPPC} {
904 yyextra->nestedComment=
TRUE;
906 else if (yytext[0]==
'*')
908 yyextra->nestedComment=
FALSE;
910 yyextra->CCodeBuffer += yytext;
913 yyextra->CCodeBuffer += yytext;
917 yyextra->CCodeBuffer += yytext;
919<SkipCurlyEndDoc>"}"{BN}*{DCOMM}"<" {
920 yyextra->docBlockContext = SkipCurlyEndDoc;
921 yyextra->CCodeBuffer += yytext;
922 if (yytext[yyleng-3]==
'/')
931<SkipCurlyEndDoc>"}" {
932 yyextra->CCodeBuffer += yytext;
937 yyextra->CCodeBuffer += yytext;
952 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
955 if (yyextra->searchCtx)
972 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
973 if (yyextra->sourceFileDef && yyextra->lineNumbers)
975 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
977 if (!yyextra->includeCodeFragment && d)
979 yyextra->currentDefinition = d;
980 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
981 yyextra->classScope = d->
name();
983 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
984 if (yyextra->currentMemberDef)
986 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
987 yyextra->currentMemberDef->getOutputFileBase(),
988 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
989 !yyextra->includeCodeFragment);
997 !yyextra->includeCodeFragment);
1004 !yyextra->includeCodeFragment);
1008 yyextra->code->startCodeLine(yyextra->yyLineNr);
1009 yyextra->insideCodeLine =
true;
1012 if (yyextra->currentFontClass)
1014 yyextra->code->startFontClass(yyextra->currentFontClass);
1020 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1021 if (yyextra->currentFontClass)
1023 yyextra->code->endFontClass();
1024 yyextra->currentFontClass=0;
1030 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1032 yyextra->code->endCodeLine();
1033 yyextra->insideCodeLine =
false;
1038 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1039 const char *fc = yyextra->currentFontClass;
1040 if (yyextra->insideCodeLine)
1044 if (yyextra->yyLineNr<yyextra->inputLines)
1046 yyextra->currentFontClass = fc;
1053 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1055 const char *p=text.
data(),*sp=p;
1061 while ((c=*p++) && c!=
'\n') { }
1064 yyextra->yyLineNr++;
1065 size_t l =
static_cast<size_t>(p-sp-1);
1066 yyextra->code->codify(
QCString(sp,l));
1071 yyextra->code->codify(sp);
1075 yyextra->startCCodeLine = yyextra->yyLineNr;
1080 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1082 if (!yyextra->currentFontClass || !s || strcmp(yyextra->currentFontClass,s))
1085 yyextra->code->startFontClass(s);
1086 yyextra->currentFontClass=s;
1093 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1094 const char *p=yyextra->inputString;
1100 if (c==
'\n') count++;
1102 if (p>yyextra->inputString && *(p-1)!=
'\n')
1111 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1112 int inputPosition = yyextra->inputPosition;
1113 const char *s = yyextra->inputString + inputPosition;
1115 while( c < max_size && *s )
1120 yyextra->inputPosition += c;
1126 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1127 for (
const char *p = yytext ; *p ; ++p )
1131 yyextra->yyLineNr++;
1138 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1139 if (yyextra->CCodeBuffer.isEmpty())
return;
1141 yyextra->ccodeParser.setInsideCodeLine(yyextra->insideCodeLine);
1142 yyextra->ccodeParser.parseCode(*yyextra->code,
1143 yyextra->classScope,
1144 yyextra->CCodeBuffer,
1146 yyextra->stripCodeComments,
1148 .setExample(yyextra->exampleBlock,yyextra->exampleName)
1157 yyextra->CCodeBuffer.clear();
1158 yyextra->insideCodeLine = yyextra->ccodeParser.insideCodeLine();
1159 yyextra->yyLineNr--;
1173 lexcodeYYlex_init_extra(&
p->state, &
p->yyscanner);
1182 lexcodeYYlex_destroy(
p->yyscanner);
1187 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
1188 yyextra->currentDefinition =
nullptr;
1189 yyextra->currentMemberDef =
nullptr;
1196 bool stripCodeComments,
1201 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1207 yyextra->code = &codeOutIntf;
1208 yyextra->inputString = input.
data();
1209 yyextra->inputPosition = 0;
1211 yyextra->currentFontClass =
nullptr;
1212 yyextra->insideCodeLine =
false;
1213 yyextra->classScope = scopeName;
1214 yyextra->currentMemberDef = options.
memberDef();
1215 yyextra->searchCtx = options.
searchCtx();
1219 yyextra->startCCodeLine = yyextra->yyLineNr;
1220 yyextra->stripCodeComments = stripCodeComments;
1221 yyextra->exampleBlock = options.
isExample();
1223 yyextra->sourceFileDef = options.
fileDef();
1230 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
1233 if (yyextra->sourceFileDef)
1242 lexcodeYYrestart(
nullptr, yyscanner );
1243 BEGIN( DefSection );
1244 lexcodeYYlex(yyscanner);
1246 if (yyextra->insideCodeLine)
1250 if (yyextra->exampleFileDef)
1253 yyextra->exampleFileDef.reset();
1254 yyextra->sourceFileDef=0;
1260#include "lexcode.l.h"
static bool isFlagSet(const DebugMask mask)
virtual QCString getReference() const =0
virtual QCString getOutputFileBase() const =0
virtual const QCString & name() const =0
static SearchIndexIntf searchIndex
virtual QCString fileName() const =0
std::unique_ptr< Private > p
void resetCodeParserState() override
Resets the state of the code parser.
void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt, bool stripCodeComments, const CodeParserOptions &options) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
~LexCodeParser() override
bool isEmpty() const
Returns TRUE iff the string is empty.
QCString & sprintf(const char *format,...)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
const char * qPrint(const char *s)
Options to configure the code parser.
CodeParserOptions & setSearchCtx(const Definition *d)
CodeParserOptions & setStartLine(int lineNr)
const Definition * searchCtx() const
const FileDef * fileDef() const
CodeParserOptions & setInlineFragment(bool enable)
const MemberDef * memberDef() const
CodeParserOptions & setCollectXRefs(bool enable)
bool showLineNumbers() const
bool inlineFragment() const
QCString exampleName() const
CodeParserOptions & setMemberDef(const MemberDef *md)
bool collectXRefs() const
CodeParserOptions & setShowLineNumbers(bool enable)
CodeParserOptions & setFileDef(const FileDef *fd)