16%option never-interactive
17%option prefix="lexcodeYY"
20%option extra-type="struct lexcodeYY_state *"
24#define YY_TYPEDEF_YY_SCANNER_T
45#define YY_NEVER_INTERACTIVE 1
47#define YY_NO_UNISTD_H 1
110#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
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
127RulesSharp "<"[^>\n]*">"
128RulesCurly "{"[^{}\n]*"}"
133EscapeRulesCharOpen "\\["|"\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\"
134EscapeRulesCharClose "\\]"|"\>"|"\\}"|"\\)"
135EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose}
142ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
145RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
146RAWEND ")"[^ \t\(\)\\]{0,16}\"
147CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
159DCOMM ("/\*!"|"/\**"|"/\/!"|"/\/\/")
198<DefSection>^{TopStart} {
201 yyextra->lastContext = YY_START;
202 yyextra->startCCodeLine=yyextra->yyLineNr;
static void codifyLines(yyscan_t yyscanner, const QCString &text)
205<DefSection>^{LiteralStart} {
208 yyextra->lastContext = YY_START;
209 yyextra->startCCodeLine=yyextra->yyLineNr;
210 BEGIN (LiteralSection);
212<TopSection>^{TopEnd} {
215 BEGIN( yyextra->lastContext ) ;
218 yyextra->CCodeBuffer += yytext;
221<LiteralSection>^{LiteralEnd} {
224 BEGIN( yyextra->lastContext ) ;
226<LiteralSection>.*{nl} {
227 yyextra->CCodeBuffer += yytext;
230<DefSection>{CPPC}.*{nl} {
231 yyextra->CCodeBuffer += yytext;
234<DefSection>^{ws}*{CCS} {
235 yyextra->CCodeBuffer += yytext;
236 yyextra->lastContext = YY_START;
239<COMMENT>{CCE}{ws}*{nl} {
240 yyextra->CCodeBuffer+=yytext;
243 BEGIN(yyextra->lastContext);
246 yyextra->CCodeBuffer+=yytext;
248 BEGIN(yyextra->lastContext);
251 yyextra->CCodeBuffer += yytext;
253<COMMENT>{CPPC}|{CCS} {
254 yyextra->CCodeBuffer += yytext;
257 yyextra->CCodeBuffer += yytext;
261 yyextra->CCodeBuffer += yytext;
266 yyextra->startCCodeLine=yyextra->yyLineNr;
268<DefSection>^{ws}.*{nl} {
269 yyextra->CCodeBuffer += yytext;
272<DefSection>^{RulesStart} {
275 yyextra->startCCodeLine=yyextra->yyLineNr;
276 BEGIN (RulesSectionInit);
281 BEGIN(DefSectionLine);
283<DefSectionLine>.*{nl} {
285 yyextra->startCCodeLine=yyextra->yyLineNr;
288<RulesSectionInit,RulesPattern>^{RulesEnd} {
291 yyextra->startCCodeLine=yyextra->yyLineNr;
294<RulesSectionInit>^{nws} {
299<RulesSectionInit>{nl} {
300 yyextra->CCodeBuffer += yytext;
303<RulesSectionInit>^{ws}.*{nl} {
304 yyextra->CCodeBuffer += yytext;
307<RulesPattern>"<<EOF>>" {
308 yyextra->rulesPatternBuffer += yytext;
310<RulesPattern>{EscapeRulesChar} {
311 yyextra->rulesPatternBuffer += yytext;
313<RulesPattern>{RulesSharp} {
314 yyextra->rulesPatternBuffer += yytext;
316<RulesPattern>{RulesCurly} {
317 yyextra->rulesPatternBuffer += yytext;
319<RulesPattern>{StartDouble} {
320 yyextra->rulesPatternBuffer += yytext;
321 yyextra->lastContext = YY_START;
324<RulesDouble,RulesRoundDouble>"\\\\" {
325 yyextra->rulesPatternBuffer += yytext;
327<RulesDouble,RulesRoundDouble>"\\\"" {
328 yyextra->rulesPatternBuffer += yytext;
331 yyextra->rulesPatternBuffer += yytext;
332 BEGIN( yyextra->lastContext ) ;
334<RulesRoundDouble>"\"" {
335 yyextra->rulesPatternBuffer += yytext;
338<RulesDouble,RulesRoundDouble>. {
339 yyextra->rulesPatternBuffer += yytext;
341<RulesPattern>{StartSquare} {
342 yyextra->rulesPatternBuffer += yytext;
343 yyextra->lastContext = YY_START;
346<RulesSquare,RulesRoundSquare>{CHARCE} {
347 yyextra->rulesPatternBuffer += yytext;
349<RulesSquare,RulesRoundSquare>"\\[" |
350<RulesSquare,RulesRoundSquare>"\\]" {
351 yyextra->rulesPatternBuffer += yytext;
354 yyextra->rulesPatternBuffer += yytext;
355 BEGIN(RulesPattern) ;
357<RulesRoundSquare>"]" {
358 yyextra->rulesPatternBuffer += yytext;
361<RulesSquare,RulesRoundSquare>"\\\\" {
362 yyextra->rulesPatternBuffer += yytext;
364<RulesSquare,RulesRoundSquare>. {
365 yyextra->rulesPatternBuffer += yytext;
367<RulesPattern>{StartRoundQuest} {
368 yyextra->rulesPatternBuffer += yytext;
369 yyextra->lastContext = YY_START;
370 BEGIN(RulesRoundQuest);
372<RulesRoundQuest>{nl} {
373 yyextra->rulesPatternBuffer += yytext;
374 if (!yyextra->rulesPatternBuffer.isEmpty())
377 codifyLines(yyscanner,yyextra->rulesPatternBuffer.data());
378 yyextra->rulesPatternBuffer.clear();
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
382<RulesRoundQuest>[^)] {
383 yyextra->rulesPatternBuffer += yytext;
385<RulesRoundQuest>")" {
386 yyextra->rulesPatternBuffer += yytext;
387 BEGIN(yyextra->lastContext);
389<RulesPattern>{StartRound} {
390 yyextra->roundCount++;
391 yyextra->rulesPatternBuffer += yytext;
392 yyextra->lastContext = YY_START;
395<RulesRound>{RulesCurly} {
396 yyextra->rulesPatternBuffer += yytext;
398<RulesRound>{StartSquare} {
399 yyextra->rulesPatternBuffer += yytext;
400 BEGIN(RulesRoundSquare);
402<RulesRound>{StartDouble} {
403 yyextra->rulesPatternBuffer += yytext;
404 BEGIN(RulesRoundDouble);
406<RulesRound>{EscapeRulesChar} {
407 yyextra->rulesPatternBuffer += yytext;
410 yyextra->roundCount++;
411 yyextra->rulesPatternBuffer += yytext;
414 yyextra->roundCount--;
415 yyextra->rulesPatternBuffer += yytext;
416 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
419 yyextra->rulesPatternBuffer += yytext;
423 yyextra->rulesPatternBuffer += yytext;
426 yyextra->rulesPatternBuffer += yytext;
428<RulesPattern>{ws}+"|" {
429 if (!yyextra->rulesPatternBuffer.isEmpty())
432 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
433 yyextra->rulesPatternBuffer.clear();
437 yyextra->startCCodeLine=yyextra->yyLineNr;
438 yyextra->curlyCount = 0;
441<RulesPattern>^{ws}*{nl} {
444<RulesPattern>^{ws}+ {
447<RulesPattern>({ws}|{nl}) {
449 if (!yyextra->rulesPatternBuffer.isEmpty())
452 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
453 yyextra->rulesPatternBuffer.clear();
456 yyextra->startCCodeLine=yyextra->yyLineNr;
457 yyextra->curlyCount = 0;
460<RulesPattern>"\\\\" {
461 yyextra->rulesPatternBuffer += yytext;
464 if (!yyextra->rulesPatternBuffer.isEmpty())
467 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
468 yyextra->rulesPatternBuffer.clear();
471 yyextra->CCodeBuffer += yytext;
472 yyextra->lastContext = YY_START;
476 yyextra->rulesPatternBuffer += yytext;
478<SkipCurly>{B}*"#"{B}+[0-9]+{B}+/"\"" {
479 yyextra->CCodeBuffer += yytext;
480 yyextra->lastPreLineCtrlContext = YY_START;
481 BEGIN( PreLineCtrl );
483<PreLineCtrl>"\""[^\n\"]*"\"" {
484 yyextra->CCodeBuffer += yytext;
487 yyextra->CCodeBuffer += yytext;
490 yyextra->CCodeBuffer += yytext;
492 BEGIN( yyextra->lastPreLineCtrlContext );
495 yyextra->CCodeBuffer += yytext;
496 ++yyextra->curlyCount ;
498<SkipCurly>"}"/{BN}*{DCOMM}"<!--" |
500 yyextra->CCodeBuffer += yytext;
502 if( yyextra->curlyCount )
504 --yyextra->curlyCount ;
507<SkipCurly>"}"{BN}*{DCOMM}"<" {
508 yyextra->CCodeBuffer += yytext;
510 if ( yyextra->curlyCount )
512 --yyextra->curlyCount ;
516 yyextra->docBlockContext = SkipCurlyEndDoc;
517 if (yytext[yyleng-3]==
'/')
528 yyextra->CCodeBuffer += yytext;
529 yyextra->lastStringContext=SkipCurly;
533 yyextra->CCodeBuffer += yytext;
534 yyextra->lastPreLineCtrlContext = YY_START;
535 BEGIN( PreLineCtrl );
537<SkipCurly>{B}*{RAWBEGIN} {
539 yyextra->delimiter = raw.
mid(2);
540 yyextra->delimiter=yyextra->delimiter.
left(yyextra->delimiter.length()-1);
541 yyextra->lastRawStringContext = YY_START;
542 yyextra->CCodeBuffer += yytext;
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
QCString left(size_t len) const
545<SkipCurly>[^\n#"'@\\/{}<]+ {
546 yyextra->CCodeBuffer += yytext;
549 yyextra->CCodeBuffer += yytext;
550 yyextra->lastCContext = YY_START;
554 yyextra->CCodeBuffer += yytext;
555 yyextra->lastCContext = YY_START;
556 BEGIN(SkipCxxComment);
558<SkipCurly>{CHARLIT} {
559 yyextra->CCodeBuffer += yytext;
562 yyextra->CCodeBuffer += yytext;
565 yyextra->CCodeBuffer += yytext;
567<SkipCurly>({CPPC}{B}*)?{CCS}"!" {
568 yyextra->CCodeBuffer += yytext;
569 yyextra->docBlockContext = YY_START;
572<SkipCurly>{CCS}"*"[*]+{BL} {
574 yyextra->CCodeBuffer += yytext;
578 yyextra->docBlockContext = YY_START;
#define Config_getBool(name)
586<SkipCurly>({CPPC}{B}*)?{CCS}"*"/{NCOMM} {
587 yyextra->CCodeBuffer += yytext;
588 yyextra->docBlockContext = YY_START;
591<SkipCurly>{CPPC}"!" {
592 yyextra->CCodeBuffer += yytext;
593 yyextra->docBlockContext = YY_START;
596<SkipCurly>{CPPC}"/"/[^/] {
597 yyextra->CCodeBuffer += yytext;
598 yyextra->docBlockContext = YY_START;
603 yyextra->CCodeBuffer += yytext;
605 if (yyextra->curlyCount<=0)
612 yyextra->CCodeBuffer += yytext;
615 yyextra->CCodeBuffer += yytext;
616 BEGIN( yyextra->lastStringContext );
618<SkipString>{CCS}|{CCE}|{CPPC} {
619 yyextra->CCodeBuffer += yytext;
622 yyextra->CCodeBuffer += yytext;
626 yyextra->CCodeBuffer += yytext;
628<SkipCxxComment>.*"\\\n" {
629 yyextra->CCodeBuffer += yytext;
632<SkipCxxComment>{ANYopt}/\n {
633 yyextra->CCodeBuffer += yytext;
634 BEGIN( yyextra->lastCContext ) ;
637 yyextra->CCodeBuffer += yytext ;
640<Comment>{CCS} { yyextra->CCodeBuffer += yytext ; }
641<Comment>{CPPC} { yyextra->CCodeBuffer += yytext ; }
642<Comment>{CMD}("code"|"verbatim"|"iliteral") {
643 yyextra->insideCode=
TRUE;
644 yyextra->CCodeBuffer += yytext ;
646<Comment>{CMD}("endcode"|"endverbatim"|"endiliteral") {
647 yyextra->insideCode=
FALSE;
648 yyextra->CCodeBuffer += yytext ;
650<Comment>[^ \.\t\r\n\/\*]+ { yyextra->CCodeBuffer += yytext ; }
652 yyextra->CCodeBuffer += yytext ;
653 if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ;
655<Comment>. { yyextra->CCodeBuffer += *yytext ; }
657<SkipComment>{CPPC}|{CCS} {
658 yyextra->CCodeBuffer += yytext;
660<SkipComment>[^\*\n]+ {
661 yyextra->CCodeBuffer += yytext;
664 yyextra->CCodeBuffer += yytext;
667<SkipComment>{B}*{CCE} {
668 yyextra->CCodeBuffer += yytext;
669 BEGIN( yyextra->lastCContext );
672 yyextra->CCodeBuffer += yytext;
675 yyextra->CCodeBuffer += yytext;
677 delimiter=delimiter.
left(delimiter.
length()-1);
678 if (delimiter==yyextra->delimiter)
680 BEGIN(yyextra->lastRawStringContext);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
684 yyextra->CCodeBuffer += yytext;
687 yyextra->CCodeBuffer += yytext;
690 yyextra->CCodeBuffer += yytext;
696<DocLine>[^\n]*"\n"[ \t]*{CPPC}[/!][<]? {
697 yyextra->CCodeBuffer += yytext;
700<DocLine>{B}*{CPPC}"/"[/]+{Bopt}/"\n" {
701 yyextra->CCodeBuffer += yytext;
702 BEGIN( yyextra->docBlockContext );
704<DocLine>{NONLopt}/"\n"{B}*{CPPC}[!/]{B}*{CMD}"}" {
705 yyextra->CCodeBuffer += yytext;
706 BEGIN( yyextra->docBlockContext );
708<DocLine>{NONLopt}/"\n" {
709 yyextra->CCodeBuffer += yytext;
710 BEGIN( yyextra->docBlockContext );
716 yyextra->CCodeBuffer += yytext;
717 BEGIN(yyextra->docBlockContext);
719<DocBlock>^{B}*"*"+/[^/] {
720 yyextra->CCodeBuffer += yytext;
722<DocBlock>^{B}*({CPPC})?{B}*"*"+/[^/a-z_A-Z0-9*] {
723 yyextra->CCodeBuffer += yytext;
725<DocBlock>^{B}*({CPPC}){B}* {
726 yyextra->CCodeBuffer += yytext;
729 yyextra->CCodeBuffer += yytext;
733 yyextra->CCodeBuffer += yytext;
735<DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
736 yyextra->CCodeBuffer += yytext;
738<DocBlock>{CMD}("f$"|"f["|"f{"|"f(") {
739 yyextra->CCodeBuffer += yytext;
740 yyextra->docBlockName=&yytext[1];
741 if (yyextra->docBlockName.at(1)==
'[')
743 yyextra->docBlockName.at(1)=
']';
745 if (yyextra->docBlockName.at(1)==
'{')
747 yyextra->docBlockName.at(1)=
'}';
749 if (yyextra->docBlockName.at(1)==
'(')
751 yyextra->docBlockName.at(1)=
')';
753 yyextra->fencedSize=0;
754 yyextra->nestedComment=
FALSE;
757<DocBlock>{B}*"<"{PRE}">" {
758 yyextra->CCodeBuffer += yytext;
759 yyextra->docBlockName=
"<pre>";
760 yyextra->fencedSize=0;
761 yyextra->nestedComment=
FALSE;
764<DocBlock>{CMD}"startuml"/[^a-z_A-Z0-9\-] {
765 yyextra->CCodeBuffer += yytext;
766 yyextra->docBlockName=
"uml";
767 yyextra->fencedSize=0;
768 yyextra->nestedComment=
FALSE;
771<DocBlock>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] {
772 yyextra->CCodeBuffer += yytext;
773 yyextra->docBlockName=&yytext[1];
774 yyextra->fencedSize=0;
775 yyextra->nestedComment=
FALSE;
778<DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
779 yyextra->CCodeBuffer += yytext;
781 yyextra->docBlockName=
"~~~";
783 yyextra->nestedComment=
FALSE;
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
786<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
787 yyextra->CCodeBuffer += yytext;
789 yyextra->docBlockName=
"```";
791 yyextra->nestedComment=
FALSE;
794<DocBlock>{B}*"<code>" {
797<DocBlock>[^@*~\/\\\n]+ {
798 yyextra->CCodeBuffer += yytext;
801 yyextra->CCodeBuffer += yytext;
805 yyextra->CCodeBuffer += yytext;
809<DocCopyBlock>"</"{PRE}">" {
810 yyextra->CCodeBuffer += yytext;
811 if (yyextra->docBlockName==
"<pre>")
816<DocCopyBlock>"</"{CODE}">" {
817 yyextra->CCodeBuffer += yytext;
818 if (yyextra->docBlockName==
"<code>")
823<DocCopyBlock>[\\@]("f$"|"f]"|"f}"|"f)") {
824 yyextra->CCodeBuffer += yytext;
825 if (yyextra->docBlockName==&yytext[1])
830<DocCopyBlock>[\\@]("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9] {
831 yyextra->CCodeBuffer += yytext;
832 if (&yytext[4]==yyextra->docBlockName)
837<DocCopyBlock>^{B}*"*"+/{BN}+ {
838 yyextra->CCodeBuffer += yytext;
839 if ((yyextra->docBlockName==
"verbatim") || (yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
845 yyextra->CCodeBuffer += yytext;
848<DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* {
849 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
851 yyextra->CCodeBuffer += yytext;
858<DocCopyBlock>^{B}*"*"+/({ID}|"(") {
859 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
861 yyextra->CCodeBuffer += yytext;
868<DocCopyBlock>^{B}*"*"+/{BN}* {
869 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
871 if (yyextra->nestedComment)
873 yyextra->CCodeBuffer += yytext;
877 yyextra->CCodeBuffer += yytext;
885<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
886 yyextra->CCodeBuffer += yytext;
893<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
894 yyextra->CCodeBuffer += yytext;
901<DocCopyBlock>[^<@/\*\]~\$\\\n]+ {
902 yyextra->CCodeBuffer += yytext;
904<DocCopyBlock>{CCS}|{CCE}|{CPPC} {
907 yyextra->nestedComment=
TRUE;
909 else if (yytext[0]==
'*')
911 yyextra->nestedComment=
FALSE;
913 yyextra->CCodeBuffer += yytext;
916 yyextra->CCodeBuffer += yytext;
920 yyextra->CCodeBuffer += yytext;
922<SkipCurlyEndDoc>"}"{BN}*{DCOMM}"<" {
923 yyextra->docBlockContext = SkipCurlyEndDoc;
924 yyextra->CCodeBuffer += yytext;
925 if (yytext[yyleng-3]==
'/')
934<SkipCurlyEndDoc>"}" {
935 yyextra->CCodeBuffer += yytext;
940 yyextra->CCodeBuffer += yytext;
955 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
958 if (yyextra->searchCtx)
975 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
976 if (yyextra->sourceFileDef && yyextra->lineNumbers)
978 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
980 if (!yyextra->includeCodeFragment && d)
982 yyextra->currentDefinition = d;
983 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
984 yyextra->classScope = d->
name();
986 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
987 if (yyextra->currentMemberDef)
989 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
990 yyextra->currentMemberDef->getOutputFileBase(),
991 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
992 !yyextra->includeCodeFragment);
1000 !yyextra->includeCodeFragment);
1007 !yyextra->includeCodeFragment);
1011 yyextra->code->startCodeLine(yyextra->yyLineNr);
1012 yyextra->insideCodeLine =
true;
1015 if (yyextra->currentFontClass)
1017 yyextra->code->startFontClass(yyextra->currentFontClass);
1023 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1024 if (yyextra->currentFontClass)
1026 yyextra->code->endFontClass();
1027 yyextra->currentFontClass=0;
1033 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1035 yyextra->code->endCodeLine();
1036 yyextra->insideCodeLine =
false;
1041 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1042 const char *fc = yyextra->currentFontClass;
1043 if (yyextra->insideCodeLine)
1047 if (yyextra->yyLineNr<yyextra->inputLines)
1049 yyextra->currentFontClass = fc;
1056 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1058 const char *p=text.
data(),*sp=p;
1064 while ((c=*p++) && c!=
'\n') { }
1067 yyextra->yyLineNr++;
1068 size_t l =
static_cast<size_t>(p-sp-1);
1069 std::string tmp(sp,l);
1070 yyextra->code->codify(tmp.c_str());
1075 yyextra->code->codify(sp);
1079 yyextra->startCCodeLine = yyextra->yyLineNr;
1084 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1086 if (!yyextra->currentFontClass || !s || strcmp(yyextra->currentFontClass,s))
1089 yyextra->code->startFontClass(s);
1090 yyextra->currentFontClass=s;
1097 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1098 const char *p=yyextra->inputString;
1104 if (c==
'\n') count++;
1106 if (p>yyextra->inputString && *(p-1)!=
'\n')
1115 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1116 int inputPosition = yyextra->inputPosition;
1117 const char *s = yyextra->inputString + inputPosition;
1119 while( c < max_size && *s )
1124 yyextra->inputPosition += c;
1130 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1131 for (
const char *p = yytext ; *p ; ++p )
1135 yyextra->yyLineNr++;
1142 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1143 if (yyextra->CCodeBuffer.isEmpty())
return;
1145 yyextra->ccodeParser.setInsideCodeLine(yyextra->insideCodeLine);
1146 yyextra->ccodeParser.parseCode(*yyextra->code,
1147 yyextra->classScope,
1148 yyextra->CCodeBuffer,
1150 yyextra->stripCodeComments,
1151 yyextra->exampleBlock,
1152 yyextra->exampleName,
1153 yyextra->sourceFileDef,
1154 yyextra->startCCodeLine,
1156 yyextra->includeCodeFragment,
1157 yyextra->currentMemberDef,
1158 yyextra->lineNumbers,
1160 yyextra->collectXRefs
1162 yyextra->CCodeBuffer.clear();
1163 yyextra->insideCodeLine = yyextra->ccodeParser.insideCodeLine();
1164 yyextra->yyLineNr--;
1178 lexcodeYYlex_init_extra(&
p->state, &
p->yyscanner);
1187 lexcodeYYlex_destroy(
p->yyscanner);
1192 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
1193 yyextra->currentDefinition =
nullptr;
1194 yyextra->currentMemberDef =
nullptr;
1201 bool stripCodeComments,
1202 bool isExampleBlock,
1207 bool inlineFragment,
1209 bool showLineNumbers,
1215 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1221 yyextra->code = &codeOutIntf;
1222 yyextra->inputString = input.
data();
1223 yyextra->inputPosition = 0;
1224 yyextra->fileName = fileDef ? fileDef->
fileName():
"";
1225 yyextra->currentFontClass =
nullptr;
1226 yyextra->insideCodeLine =
false;
1228 yyextra->classScope=scopeName;
1229 yyextra->currentMemberDef=memberDef;
1230 yyextra->searchCtx=searchCtx;
1231 yyextra->collectXRefs=collectXRefs;
1234 yyextra->yyLineNr = startLine;
1236 yyextra->yyLineNr = 1;
1239 yyextra->inputLines = endLine+1;
1241 yyextra->inputLines = yyextra->yyLineNr +
countLines(yyscanner) - 1;
1243 yyextra->startCCodeLine = yyextra->yyLineNr;
1244 yyextra->stripCodeComments = stripCodeComments;
1245 yyextra->exampleBlock = isExampleBlock;
1246 yyextra->exampleName = exampleName;
1247 yyextra->sourceFileDef = fileDef;
1248 yyextra->lineNumbers = fileDef!=0 && showLineNumbers;
1250 if (isExampleBlock && fileDef==0)
1253 yyextra->exampleFileDef =
createFileDef(QCString(),!exampleName.
isEmpty() ? exampleName : QCString(
"generated"));
1254 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
1257 if (yyextra->sourceFileDef)
1262 yyextra->includeCodeFragment = inlineFragment;
1266 lexcodeYYrestart(
nullptr, yyscanner );
1267 BEGIN( DefSection );
1268 lexcodeYYlex(yyscanner);
1270 if (yyextra->insideCodeLine)
1274 if (yyextra->exampleFileDef)
1277 yyextra->exampleFileDef.reset();
1278 yyextra->sourceFileDef=0;
1284#include "lexcode.l.h"
static bool isFlagSet(const DebugMask mask)
The common base class of all entity definitions found in the sources.
virtual QCString getReference() const =0
virtual QCString getOutputFileBase() const =0
virtual const QCString & name() const =0
static SearchIndexIntf searchIndex
A model of a file symbol.
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
A model of a class/file/namespace member symbol.
Class representing a list of different code generators.
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)
SrcLangExt
Language as given by extension.