16%option never-interactive
17%option prefix="lexcodeYY"
20%option extra-type="struct lexcodeYY_state *"
24#define YY_TYPEDEF_YY_SCANNER_T
46#define YY_NEVER_INTERACTIVE 1
48#define YY_NO_UNISTD_H 1
111#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
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.
#define lineCount(s, len)
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)
static void handleCCode(yyscan_t yyscanner)
static const char * getLexerFILE()
static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
static void endFontClass(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.
128RulesSharp "<"[^>\n]*">"
129RulesCurly "{"[^{}\n]*"}"
134EscapeRulesCharOpen "\\["|"\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\"
135EscapeRulesCharClose "\\]"|"\>"|"\\}"|"\\)"
136EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose}
143ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
146RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
147RAWEND ")"[^ \t\(\)\\]{0,16}\"
148CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
160DCOMM ("/\*!"|"/\**"|"/\/!"|"/\/\/")
199<DefSection>^{TopStart} {
202 yyextra->lastContext = YY_START;
203 yyextra->startCCodeLine=yyextra->yyLineNr;
static void codifyLines(yyscan_t yyscanner, const QCString &text)
206<DefSection>^{LiteralStart} {
209 yyextra->lastContext = YY_START;
210 yyextra->startCCodeLine=yyextra->yyLineNr;
211 BEGIN (LiteralSection);
213<TopSection>^{TopEnd} {
216 BEGIN( yyextra->lastContext ) ;
219 yyextra->CCodeBuffer += yytext;
222<LiteralSection>^{LiteralEnd} {
225 BEGIN( yyextra->lastContext ) ;
227<LiteralSection>.*{nl} {
228 yyextra->CCodeBuffer += yytext;
231<DefSection>{CPPC}.*{nl} {
232 yyextra->CCodeBuffer += yytext;
235<DefSection>^{ws}*{CCS} {
236 yyextra->CCodeBuffer += yytext;
237 yyextra->lastContext = YY_START;
240<COMMENT>{CCE}{ws}*{nl} {
241 yyextra->CCodeBuffer+=yytext;
244 BEGIN(yyextra->lastContext);
247 yyextra->CCodeBuffer+=yytext;
249 BEGIN(yyextra->lastContext);
252 yyextra->CCodeBuffer += yytext;
254<COMMENT>{CPPC}|{CCS} {
255 yyextra->CCodeBuffer += yytext;
258 yyextra->CCodeBuffer += yytext;
262 yyextra->CCodeBuffer += yytext;
267 yyextra->startCCodeLine=yyextra->yyLineNr;
269<DefSection>^{ws}.*{nl} {
270 yyextra->CCodeBuffer += yytext;
273<DefSection>^{RulesStart} {
276 yyextra->startCCodeLine=yyextra->yyLineNr;
277 BEGIN (RulesSectionInit);
282 BEGIN(DefSectionLine);
284<DefSectionLine>.*{nl} {
286 yyextra->startCCodeLine=yyextra->yyLineNr;
289<RulesSectionInit,RulesPattern>^{RulesEnd} {
292 yyextra->startCCodeLine=yyextra->yyLineNr;
295<RulesSectionInit>^{nws} {
300<RulesSectionInit>{nl} {
301 yyextra->CCodeBuffer += yytext;
304<RulesSectionInit>^{ws}.*{nl} {
305 yyextra->CCodeBuffer += yytext;
308<RulesPattern>"<<EOF>>" {
309 yyextra->rulesPatternBuffer += yytext;
311<RulesPattern>{EscapeRulesChar} {
312 yyextra->rulesPatternBuffer += yytext;
314<RulesPattern>{RulesSharp} {
315 yyextra->rulesPatternBuffer += yytext;
317<RulesPattern>{RulesCurly} {
318 yyextra->rulesPatternBuffer += yytext;
320<RulesPattern>{StartDouble} {
321 yyextra->rulesPatternBuffer += yytext;
322 yyextra->lastContext = YY_START;
325<RulesDouble,RulesRoundDouble>"\\\\" {
326 yyextra->rulesPatternBuffer += yytext;
328<RulesDouble,RulesRoundDouble>"\\\"" {
329 yyextra->rulesPatternBuffer += yytext;
332 yyextra->rulesPatternBuffer += yytext;
333 BEGIN( yyextra->lastContext ) ;
335<RulesRoundDouble>"\"" {
336 yyextra->rulesPatternBuffer += yytext;
339<RulesDouble,RulesRoundDouble>. {
340 yyextra->rulesPatternBuffer += yytext;
342<RulesPattern>{StartSquare} {
343 yyextra->rulesPatternBuffer += yytext;
344 yyextra->lastContext = YY_START;
347<RulesSquare,RulesRoundSquare>{CHARCE} {
348 yyextra->rulesPatternBuffer += yytext;
350<RulesSquare,RulesRoundSquare>"\\[" |
351<RulesSquare,RulesRoundSquare>"\\]" {
352 yyextra->rulesPatternBuffer += yytext;
355 yyextra->rulesPatternBuffer += yytext;
356 BEGIN(RulesPattern) ;
358<RulesRoundSquare>"]" {
359 yyextra->rulesPatternBuffer += yytext;
362<RulesSquare,RulesRoundSquare>"\\\\" {
363 yyextra->rulesPatternBuffer += yytext;
365<RulesSquare,RulesRoundSquare>. {
366 yyextra->rulesPatternBuffer += yytext;
368<RulesPattern>{StartRoundQuest} {
369 yyextra->rulesPatternBuffer += yytext;
370 yyextra->lastContext = YY_START;
371 BEGIN(RulesRoundQuest);
373<RulesRoundQuest>{nl} {
374 yyextra->rulesPatternBuffer += yytext;
375 if (!yyextra->rulesPatternBuffer.isEmpty())
378 codifyLines(yyscanner,yyextra->rulesPatternBuffer.data());
379 yyextra->rulesPatternBuffer.clear();
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
383<RulesRoundQuest>[^)] {
384 yyextra->rulesPatternBuffer += yytext;
386<RulesRoundQuest>")" {
387 yyextra->rulesPatternBuffer += yytext;
388 BEGIN(yyextra->lastContext);
390<RulesPattern>{StartRound} {
391 yyextra->roundCount++;
392 yyextra->rulesPatternBuffer += yytext;
393 yyextra->lastContext = YY_START;
396<RulesRound>{RulesCurly} {
397 yyextra->rulesPatternBuffer += yytext;
399<RulesRound>{StartSquare} {
400 yyextra->rulesPatternBuffer += yytext;
401 BEGIN(RulesRoundSquare);
403<RulesRound>{StartDouble} {
404 yyextra->rulesPatternBuffer += yytext;
405 BEGIN(RulesRoundDouble);
407<RulesRound>{EscapeRulesChar} {
408 yyextra->rulesPatternBuffer += yytext;
411 yyextra->roundCount++;
412 yyextra->rulesPatternBuffer += yytext;
415 yyextra->roundCount--;
416 yyextra->rulesPatternBuffer += yytext;
417 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
420 yyextra->rulesPatternBuffer += yytext;
424 yyextra->rulesPatternBuffer += yytext;
427 yyextra->rulesPatternBuffer += yytext;
429<RulesPattern>{ws}+"|" {
430 if (!yyextra->rulesPatternBuffer.isEmpty())
433 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
434 yyextra->rulesPatternBuffer.clear();
438 yyextra->startCCodeLine=yyextra->yyLineNr;
439 yyextra->curlyCount = 0;
442<RulesPattern>^{ws}*{nl} {
445<RulesPattern>^{ws}+ {
448<RulesPattern>({ws}|{nl}) {
450 if (!yyextra->rulesPatternBuffer.isEmpty())
453 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
454 yyextra->rulesPatternBuffer.clear();
457 yyextra->startCCodeLine=yyextra->yyLineNr;
458 yyextra->curlyCount = 0;
461<RulesPattern>"\\\\" {
462 yyextra->rulesPatternBuffer += yytext;
465 if (!yyextra->rulesPatternBuffer.isEmpty())
468 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
469 yyextra->rulesPatternBuffer.clear();
472 yyextra->CCodeBuffer += yytext;
473 yyextra->lastContext = YY_START;
477 yyextra->rulesPatternBuffer += yytext;
479<SkipCurly>{B}*"#"{B}+[0-9]+{B}+/"\"" {
480 yyextra->CCodeBuffer += yytext;
481 yyextra->lastPreLineCtrlContext = YY_START;
482 BEGIN( PreLineCtrl );
484<PreLineCtrl>"\""[^\n\"]*"\"" {
485 yyextra->CCodeBuffer += yytext;
488 yyextra->CCodeBuffer += yytext;
491 yyextra->CCodeBuffer += yytext;
493 BEGIN( yyextra->lastPreLineCtrlContext );
496 yyextra->CCodeBuffer += yytext;
497 ++yyextra->curlyCount ;
499<SkipCurly>"}"/{BN}*{DCOMM}"<!--" |
501 yyextra->CCodeBuffer += yytext;
503 if( yyextra->curlyCount )
505 --yyextra->curlyCount ;
508<SkipCurly>"}"{BN}*{DCOMM}"<" {
509 yyextra->CCodeBuffer += yytext;
511 if ( yyextra->curlyCount )
513 --yyextra->curlyCount ;
517 yyextra->docBlockContext = SkipCurlyEndDoc;
518 if (yytext[yyleng-3]==
'/')
529 yyextra->CCodeBuffer += yytext;
530 yyextra->lastStringContext=SkipCurly;
534 yyextra->CCodeBuffer += yytext;
535 yyextra->lastPreLineCtrlContext = YY_START;
536 BEGIN( PreLineCtrl );
538<SkipCurly>{B}*{RAWBEGIN} {
542 yyextra->lastRawStringContext = YY_START;
543 yyextra->CCodeBuffer += yytext;
QCString extractBeginRawStringDelimiter(const char *rawStart)
546<SkipCurly>[^\n#"'@\\/{}<]+ {
547 yyextra->CCodeBuffer += yytext;
550 yyextra->CCodeBuffer += yytext;
551 yyextra->lastCContext = YY_START;
555 yyextra->CCodeBuffer += yytext;
556 yyextra->lastCContext = YY_START;
557 BEGIN(SkipCxxComment);
559<SkipCurly>{CHARLIT} {
560 yyextra->CCodeBuffer += yytext;
563 yyextra->CCodeBuffer += yytext;
566 yyextra->CCodeBuffer += yytext;
568<SkipCurly>({CPPC}{B}*)?{CCS}"!" {
569 yyextra->CCodeBuffer += yytext;
570 yyextra->docBlockContext = YY_START;
573<SkipCurly>{CCS}"*"[*]+{BL} {
575 yyextra->CCodeBuffer += yytext;
579 yyextra->docBlockContext = YY_START;
#define Config_getBool(name)
587<SkipCurly>({CPPC}{B}*)?{CCS}"*"/{NCOMM} {
588 yyextra->CCodeBuffer += yytext;
589 yyextra->docBlockContext = YY_START;
592<SkipCurly>{CPPC}"!" {
593 yyextra->CCodeBuffer += yytext;
594 yyextra->docBlockContext = YY_START;
597<SkipCurly>{CPPC}"/"/[^/] {
598 yyextra->CCodeBuffer += yytext;
599 yyextra->docBlockContext = YY_START;
604 yyextra->CCodeBuffer += yytext;
606 if (yyextra->curlyCount<=0)
613 yyextra->CCodeBuffer += yytext;
616 yyextra->CCodeBuffer += yytext;
617 BEGIN( yyextra->lastStringContext );
619<SkipString>{CCS}|{CCE}|{CPPC} {
620 yyextra->CCodeBuffer += yytext;
623 yyextra->CCodeBuffer += yytext;
627 yyextra->CCodeBuffer += yytext;
629<SkipCxxComment>.*"\\\n" {
630 yyextra->CCodeBuffer += yytext;
633<SkipCxxComment>{ANYopt}/\n {
634 yyextra->CCodeBuffer += yytext;
635 BEGIN( yyextra->lastCContext ) ;
638 yyextra->CCodeBuffer += yytext ;
641<Comment>{CCS} { yyextra->CCodeBuffer += yytext ; }
642<Comment>{CPPC} { yyextra->CCodeBuffer += yytext ; }
643<Comment>{CMD}("code"|"verbatim"|"iliteral") {
644 yyextra->insideCode=
TRUE;
645 yyextra->CCodeBuffer += yytext ;
647<Comment>{CMD}("endcode"|"endverbatim"|"endiliteral") {
648 yyextra->insideCode=
FALSE;
649 yyextra->CCodeBuffer += yytext ;
651<Comment>[^ \.\t\r\n\/\*]+ { yyextra->CCodeBuffer += yytext ; }
653 yyextra->CCodeBuffer += yytext ;
654 if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ;
656<Comment>. { yyextra->CCodeBuffer += *yytext ; }
658<SkipComment>{CPPC}|{CCS} {
659 yyextra->CCodeBuffer += yytext;
661<SkipComment>[^\*\n]+ {
662 yyextra->CCodeBuffer += yytext;
665 yyextra->CCodeBuffer += yytext;
668<SkipComment>{B}*{CCE} {
669 yyextra->CCodeBuffer += yytext;
670 BEGIN( yyextra->lastCContext );
673 yyextra->CCodeBuffer += yytext;
676 yyextra->CCodeBuffer += yytext;
679 BEGIN(yyextra->lastRawStringContext);
QCString extractEndRawStringDelimiter(const char *rawEnd)
683 yyextra->CCodeBuffer += yytext;
686 yyextra->CCodeBuffer += yytext;
689 yyextra->CCodeBuffer += yytext;
695<DocLine>[^\n]*"\n"[ \t]*{CPPC}[/!][<]? {
696 yyextra->CCodeBuffer += yytext;
699<DocLine>{B}*{CPPC}"/"[/]+{Bopt}/"\n" {
700 yyextra->CCodeBuffer += yytext;
701 BEGIN( yyextra->docBlockContext );
703<DocLine>{NONLopt}/"\n"{B}*{CPPC}[!/]{B}*{CMD}"}" {
704 yyextra->CCodeBuffer += yytext;
705 BEGIN( yyextra->docBlockContext );
707<DocLine>{NONLopt}/"\n" {
708 yyextra->CCodeBuffer += yytext;
709 BEGIN( yyextra->docBlockContext );
715 yyextra->CCodeBuffer += yytext;
716 BEGIN(yyextra->docBlockContext);
718<DocBlock>^{B}*"*"+/[^/] {
719 yyextra->CCodeBuffer += yytext;
721<DocBlock>^{B}*({CPPC})?{B}*"*"+/[^/a-z_A-Z0-9*] {
722 yyextra->CCodeBuffer += yytext;
724<DocBlock>^{B}*({CPPC}){B}* {
725 yyextra->CCodeBuffer += yytext;
728 yyextra->CCodeBuffer += yytext;
732 yyextra->CCodeBuffer += yytext;
734<DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
735 yyextra->CCodeBuffer += yytext;
737<DocBlock>{CMD}("f$"|"f["|"f{"|"f(") {
738 yyextra->CCodeBuffer += yytext;
739 yyextra->docBlockName=&yytext[1];
740 if (yyextra->docBlockName.at(1)==
'[')
742 yyextra->docBlockName.at(1)=
']';
744 if (yyextra->docBlockName.at(1)==
'{')
746 yyextra->docBlockName.at(1)=
'}';
748 if (yyextra->docBlockName.at(1)==
'(')
750 yyextra->docBlockName.at(1)=
')';
752 yyextra->fencedSize=0;
753 yyextra->nestedComment=
FALSE;
756<DocBlock>{B}*"<"{PRE}">" {
757 yyextra->CCodeBuffer += yytext;
758 yyextra->docBlockName=
"<pre>";
759 yyextra->fencedSize=0;
760 yyextra->nestedComment=
FALSE;
763<DocBlock>{CMD}"startuml"/[^a-z_A-Z0-9\-] {
764 yyextra->CCodeBuffer += yytext;
765 yyextra->docBlockName=
"uml";
766 yyextra->fencedSize=0;
767 yyextra->nestedComment=
FALSE;
770<DocBlock>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] {
771 yyextra->CCodeBuffer += yytext;
772 yyextra->docBlockName=&yytext[1];
773 yyextra->fencedSize=0;
774 yyextra->nestedComment=
FALSE;
777<DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
778 yyextra->CCodeBuffer += yytext;
780 yyextra->docBlockName=
"~~~";
782 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
785<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
786 yyextra->CCodeBuffer += yytext;
788 yyextra->docBlockName=
"```";
790 yyextra->nestedComment=
FALSE;
793<DocBlock>{B}*"<code>" {
796<DocBlock>[^@*~\/\\\n]+ {
797 yyextra->CCodeBuffer += yytext;
800 yyextra->CCodeBuffer += yytext;
804 yyextra->CCodeBuffer += yytext;
808<DocCopyBlock>"</"{PRE}">" {
809 yyextra->CCodeBuffer += yytext;
810 if (yyextra->docBlockName==
"<pre>")
815<DocCopyBlock>"</"{CODE}">" {
816 yyextra->CCodeBuffer += yytext;
817 if (yyextra->docBlockName==
"<code>")
822<DocCopyBlock>{CMD}("f$"|"f]"|"f}"|"f)") {
823 yyextra->CCodeBuffer += yytext;
824 if (yyextra->docBlockName==&yytext[1])
829<DocCopyBlock>{CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9] {
830 yyextra->CCodeBuffer += yytext;
831 if (&yytext[4]==yyextra->docBlockName)
836<DocCopyBlock>^{B}*"*"+/{BN}+ {
837 yyextra->CCodeBuffer += yytext;
838 if ((yyextra->docBlockName==
"verbatim") || (yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
844 yyextra->CCodeBuffer += yytext;
847<DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* {
848 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
850 yyextra->CCodeBuffer += yytext;
857<DocCopyBlock>^{B}*"*"+/({ID}|"(") {
858 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
860 yyextra->CCodeBuffer += yytext;
867<DocCopyBlock>^{B}*"*"+/{BN}* {
868 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
870 if (yyextra->nestedComment)
872 yyextra->CCodeBuffer += yytext;
876 yyextra->CCodeBuffer += yytext;
884<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
885 yyextra->CCodeBuffer += yytext;
892<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
893 yyextra->CCodeBuffer += yytext;
900<DocCopyBlock>[^<@/\*\]~\$\\\n]+ {
901 yyextra->CCodeBuffer += yytext;
903<DocCopyBlock>{CCS}|{CCE}|{CPPC} {
906 yyextra->nestedComment=
TRUE;
908 else if (yytext[0]==
'*')
910 yyextra->nestedComment=
FALSE;
912 yyextra->CCodeBuffer += yytext;
915 yyextra->CCodeBuffer += yytext;
919 yyextra->CCodeBuffer += yytext;
921<SkipCurlyEndDoc>"}"{BN}*{DCOMM}"<" {
922 yyextra->docBlockContext = SkipCurlyEndDoc;
923 yyextra->CCodeBuffer += yytext;
924 if (yytext[yyleng-3]==
'/')
933<SkipCurlyEndDoc>"}" {
934 yyextra->CCodeBuffer += yytext;
939 yyextra->CCodeBuffer += yytext;
954 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
957 if (yyextra->searchCtx)
974 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
975 if (yyextra->sourceFileDef && yyextra->lineNumbers)
977 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
979 if (!yyextra->includeCodeFragment && d)
981 yyextra->currentDefinition = d;
982 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
983 yyextra->classScope = d->
name();
985 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
986 if (yyextra->currentMemberDef)
988 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
989 yyextra->currentMemberDef->getOutputFileBase(),
990 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
991 !yyextra->includeCodeFragment);
999 !yyextra->includeCodeFragment);
1006 !yyextra->includeCodeFragment);
1010 yyextra->code->startCodeLine(yyextra->yyLineNr);
1011 yyextra->insideCodeLine =
true;
1014 if (yyextra->currentFontClass)
1016 yyextra->code->startFontClass(yyextra->currentFontClass);
1022 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1023 if (yyextra->currentFontClass)
1025 yyextra->code->endFontClass();
1026 yyextra->currentFontClass=0;
1032 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1034 yyextra->code->endCodeLine();
1035 yyextra->insideCodeLine =
false;
1040 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1041 const char *fc = yyextra->currentFontClass;
1042 if (yyextra->insideCodeLine)
1046 if (yyextra->yyLineNr<yyextra->inputLines)
1048 yyextra->currentFontClass = fc;
1055 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1057 const char *p=text.
data(),*sp=p;
1063 while ((c=*p++) && c!=
'\n') { }
1066 yyextra->yyLineNr++;
1067 size_t l =
static_cast<size_t>(p-sp-1);
1068 std::string tmp(sp,l);
1069 yyextra->code->codify(tmp.c_str());
1074 yyextra->code->codify(sp);
1078 yyextra->startCCodeLine = yyextra->yyLineNr;
1083 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1085 if (!yyextra->currentFontClass || !s || strcmp(yyextra->currentFontClass,s))
1088 yyextra->code->startFontClass(s);
1089 yyextra->currentFontClass=s;
1096 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1097 const char *p=yyextra->inputString;
1103 if (c==
'\n') count++;
1105 if (p>yyextra->inputString && *(p-1)!=
'\n')
1114 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1115 int inputPosition = yyextra->inputPosition;
1116 const char *s = yyextra->inputString + inputPosition;
1118 while( c < max_size && *s )
1123 yyextra->inputPosition += c;
1129 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1130 for (
const char *p = yytext ; *p ; ++p )
1134 yyextra->yyLineNr++;
1141 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1142 if (yyextra->CCodeBuffer.isEmpty())
return;
1144 yyextra->ccodeParser.setInsideCodeLine(yyextra->insideCodeLine);
1145 yyextra->ccodeParser.parseCode(*yyextra->code,
1146 yyextra->classScope,
1147 yyextra->CCodeBuffer,
1149 yyextra->stripCodeComments,
1150 yyextra->exampleBlock,
1151 yyextra->exampleName,
1152 yyextra->sourceFileDef,
1153 yyextra->startCCodeLine,
1155 yyextra->includeCodeFragment,
1156 yyextra->currentMemberDef,
1157 yyextra->lineNumbers,
1159 yyextra->collectXRefs
1161 yyextra->CCodeBuffer.clear();
1162 yyextra->insideCodeLine = yyextra->ccodeParser.insideCodeLine();
1163 yyextra->yyLineNr--;
1177 lexcodeYYlex_init_extra(&
p->state, &
p->yyscanner);
1186 lexcodeYYlex_destroy(
p->yyscanner);
1191 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
1192 yyextra->currentDefinition =
nullptr;
1193 yyextra->currentMemberDef =
nullptr;
1200 bool stripCodeComments,
1201 bool isExampleBlock,
1206 bool inlineFragment,
1208 bool showLineNumbers,
1214 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1220 yyextra->code = &codeOutIntf;
1221 yyextra->inputString = input.
data();
1222 yyextra->inputPosition = 0;
1223 yyextra->fileName = fileDef ? fileDef->
fileName():
"";
1224 yyextra->currentFontClass =
nullptr;
1225 yyextra->insideCodeLine =
false;
1227 yyextra->classScope=scopeName;
1228 yyextra->currentMemberDef=memberDef;
1229 yyextra->searchCtx=searchCtx;
1230 yyextra->collectXRefs=collectXRefs;
1233 yyextra->yyLineNr = startLine;
1235 yyextra->yyLineNr = 1;
1238 yyextra->inputLines = endLine+1;
1240 yyextra->inputLines = yyextra->yyLineNr +
countLines(yyscanner) - 1;
1242 yyextra->startCCodeLine = yyextra->yyLineNr;
1243 yyextra->stripCodeComments = stripCodeComments;
1244 yyextra->exampleBlock = isExampleBlock;
1245 yyextra->exampleName = exampleName;
1246 yyextra->sourceFileDef = fileDef;
1247 yyextra->lineNumbers = fileDef!=0 && showLineNumbers;
1249 if (isExampleBlock && fileDef==0)
1253 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
1256 if (yyextra->sourceFileDef)
1261 yyextra->includeCodeFragment = inlineFragment;
1265 lexcodeYYrestart(
nullptr, yyscanner );
1266 BEGIN( DefSection );
1267 lexcodeYYlex(yyscanner);
1269 if (yyextra->insideCodeLine)
1273 if (yyextra->exampleFileDef)
1276 yyextra->exampleFileDef.reset();
1277 yyextra->sourceFileDef=0;
1283#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 parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt, bool stripCodeComments, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
void resetCodeParserState() override
Resets the state of the code parser.
~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.
static void endCodeLine(yyscan_t yyscanner)
static void nextCodeLine(yyscan_t yyscanner)
static void startCodeLine(yyscan_t yyscanner)
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
static int countLines(yyscan_t yyscanner)
static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
std::unique_ptr< FileDef > createFileDef(const QCString &p, const QCString &n, const QCString &ref, const QCString &dn)
const char * qPrint(const char *s)