16%option never-interactive
17%option prefix="lexcodeYY"
20%option extra-type="struct lexcodeYY_state *"
24#define YY_TYPEDEF_YY_SCANNER_T
25#define yyguts_t lexcodeYYguts_t
48#define YY_NEVER_INTERACTIVE 1
50#define YY_NO_UNISTD_H 1
113#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
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.
#define lineCount(s, len)
static void endCodeLine(yyscan_t yyscanner)
static void nextCodeLine(yyscan_t yyscanner)
static void startCodeLine(yyscan_t yyscanner)
static void setCurrentDoc(yyscan_t yyscanner, const DString &anchor)
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 void codifyLines(yyscan_t yyscanner, const DString &text)
static const char * getLexerFILE()
static void endFontClass(yyscan_t yyscanner)
std::unique_ptr< FileDef > exampleFileDef
const FileDef * sourceFileDef
int inputPosition
read offset during parsing
DString 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.
130RulesSharp "<"[^>\n]*">"
131RulesCurly "{"[^{}\n]*"}"
136EscapeRulesCharOpen "\\["|"\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\"
137EscapeRulesCharClose "\\]"|"\>"|"\\}"|"\\)"
138EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose}
145ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
148RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
149RAWEND ")"[^ \t\(\)\\]{0,16}\"
150CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
162DCOMM ("/\*!"|"/\**"|"/\/!"|"/\/\/")
201<DefSection>^{TopStart} {
204 yyextra->lastContext = YY_START;
205 yyextra->startCCodeLine=yyextra->yyLineNr;
208<DefSection>^{LiteralStart} {
211 yyextra->lastContext = YY_START;
212 yyextra->startCCodeLine=yyextra->yyLineNr;
213 BEGIN (LiteralSection);
215<TopSection>^{TopEnd} {
218 BEGIN( yyextra->lastContext ) ;
221 yyextra->CCodeBuffer += yytext;
224<LiteralSection>^{LiteralEnd} {
227 BEGIN( yyextra->lastContext ) ;
229<LiteralSection>.*{nl} {
230 yyextra->CCodeBuffer += yytext;
233<DefSection>{CPPC}.*{nl} {
234 yyextra->CCodeBuffer += yytext;
237<DefSection>^{ws}*{CCS} {
238 yyextra->CCodeBuffer += yytext;
239 yyextra->lastContext = YY_START;
242<COMMENT>{CCE}{ws}*{nl} {
243 yyextra->CCodeBuffer+=yytext;
246 BEGIN(yyextra->lastContext);
249 yyextra->CCodeBuffer+=yytext;
251 BEGIN(yyextra->lastContext);
254 yyextra->CCodeBuffer += yytext;
256<COMMENT>{CPPC}|{CCS} {
257 yyextra->CCodeBuffer += yytext;
260 yyextra->CCodeBuffer += yytext;
264 yyextra->CCodeBuffer += yytext;
269 yyextra->startCCodeLine=yyextra->yyLineNr;
271<DefSection>^{ws}.*{nl} {
272 yyextra->CCodeBuffer += yytext;
275<DefSection>^{RulesStart} {
278 yyextra->startCCodeLine=yyextra->yyLineNr;
279 BEGIN (RulesSectionInit);
284 BEGIN(DefSectionLine);
286<DefSectionLine>.*{nl} {
288 yyextra->startCCodeLine=yyextra->yyLineNr;
291<RulesSectionInit,RulesPattern>^{RulesEnd} {
294 yyextra->startCCodeLine=yyextra->yyLineNr;
297<RulesSectionInit>^{nws} {
302<RulesSectionInit>{nl} {
303 yyextra->CCodeBuffer += yytext;
306<RulesSectionInit>^{ws}.*{nl} {
307 yyextra->CCodeBuffer += yytext;
310<RulesPattern>"<<EOF>>" {
311 yyextra->rulesPatternBuffer += yytext;
313<RulesPattern>{EscapeRulesChar} {
314 yyextra->rulesPatternBuffer += yytext;
316<RulesPattern>{RulesSharp} {
317 yyextra->rulesPatternBuffer += yytext;
319<RulesPattern>{RulesCurly} {
320 yyextra->rulesPatternBuffer += yytext;
322<RulesPattern>{StartDouble} {
323 yyextra->rulesPatternBuffer += yytext;
324 yyextra->lastContext = YY_START;
327<RulesDouble,RulesRoundDouble>"\\\\" {
328 yyextra->rulesPatternBuffer += yytext;
330<RulesDouble,RulesRoundDouble>"\\\"" {
331 yyextra->rulesPatternBuffer += yytext;
334 yyextra->rulesPatternBuffer += yytext;
335 BEGIN( yyextra->lastContext ) ;
337<RulesRoundDouble>"\"" {
338 yyextra->rulesPatternBuffer += yytext;
341<RulesDouble,RulesRoundDouble>. {
342 yyextra->rulesPatternBuffer += yytext;
344<RulesPattern>{StartSquare} {
345 yyextra->rulesPatternBuffer += yytext;
346 yyextra->lastContext = YY_START;
349<RulesSquare,RulesRoundSquare>{CHARCE} {
350 yyextra->rulesPatternBuffer += yytext;
352<RulesSquare,RulesRoundSquare>"\\[" |
353<RulesSquare,RulesRoundSquare>"\\]" {
354 yyextra->rulesPatternBuffer += yytext;
357 yyextra->rulesPatternBuffer += yytext;
358 BEGIN(RulesPattern) ;
360<RulesRoundSquare>"]" {
361 yyextra->rulesPatternBuffer += yytext;
364<RulesSquare,RulesRoundSquare>"\\\\" {
365 yyextra->rulesPatternBuffer += yytext;
367<RulesSquare,RulesRoundSquare>. {
368 yyextra->rulesPatternBuffer += yytext;
370<RulesPattern>{StartRoundQuest} {
371 yyextra->rulesPatternBuffer += yytext;
372 yyextra->lastContext = YY_START;
373 BEGIN(RulesRoundQuest);
375<RulesRoundQuest>{nl} {
376 yyextra->rulesPatternBuffer += yytext;
377 if (!yyextra->rulesPatternBuffer.empty())
380 codifyLines(yyscanner,yyextra->rulesPatternBuffer.data());
381 yyextra->rulesPatternBuffer.clear();
385<RulesRoundQuest>[^)] {
386 yyextra->rulesPatternBuffer += yytext;
388<RulesRoundQuest>")" {
389 yyextra->rulesPatternBuffer += yytext;
390 BEGIN(yyextra->lastContext);
392<RulesPattern>{StartRound} {
393 yyextra->roundCount++;
394 yyextra->rulesPatternBuffer += yytext;
395 yyextra->lastContext = YY_START;
398<RulesRound>{RulesCurly} {
399 yyextra->rulesPatternBuffer += yytext;
401<RulesRound>{StartSquare} {
402 yyextra->rulesPatternBuffer += yytext;
403 BEGIN(RulesRoundSquare);
405<RulesRound>{StartDouble} {
406 yyextra->rulesPatternBuffer += yytext;
407 BEGIN(RulesRoundDouble);
409<RulesRound>{EscapeRulesChar} {
410 yyextra->rulesPatternBuffer += yytext;
413 yyextra->roundCount++;
414 yyextra->rulesPatternBuffer += yytext;
417 yyextra->roundCount--;
418 yyextra->rulesPatternBuffer += yytext;
419 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
422 yyextra->rulesPatternBuffer += yytext;
426 yyextra->rulesPatternBuffer += yytext;
429 yyextra->rulesPatternBuffer += yytext;
431<RulesPattern>{ws}+"|" {
432 if (!yyextra->rulesPatternBuffer.empty())
435 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
436 yyextra->rulesPatternBuffer.clear();
440 yyextra->startCCodeLine=yyextra->yyLineNr;
441 yyextra->curlyCount = 0;
444<RulesPattern>^{ws}*{nl} {
447<RulesPattern>^{ws}+ {
450<RulesPattern>({ws}|{nl}) {
452 if (!yyextra->rulesPatternBuffer.empty())
455 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
456 yyextra->rulesPatternBuffer.clear();
459 yyextra->startCCodeLine=yyextra->yyLineNr;
460 yyextra->curlyCount = 0;
463<RulesPattern>"\\\\" {
464 yyextra->rulesPatternBuffer += yytext;
467 if (!yyextra->rulesPatternBuffer.empty())
470 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
471 yyextra->rulesPatternBuffer.clear();
474 yyextra->CCodeBuffer += yytext;
475 yyextra->lastContext = YY_START;
479 yyextra->rulesPatternBuffer += yytext;
481<SkipCurly>{B}*"#"{B}+[0-9]+{B}+/"\"" {
482 yyextra->CCodeBuffer += yytext;
483 yyextra->lastPreLineCtrlContext = YY_START;
484 BEGIN( PreLineCtrl );
486<PreLineCtrl>"\""[^\n\"]*"\"" {
487 yyextra->CCodeBuffer += yytext;
490 yyextra->CCodeBuffer += yytext;
493 yyextra->CCodeBuffer += yytext;
495 BEGIN( yyextra->lastPreLineCtrlContext );
498 yyextra->CCodeBuffer += yytext;
499 ++yyextra->curlyCount ;
501<SkipCurly>"}"/{BN}*{DCOMM}"<!--" |
503 yyextra->CCodeBuffer += yytext;
505 if( yyextra->curlyCount )
507 --yyextra->curlyCount ;
510<SkipCurly>"}"{BN}*{DCOMM}"<" {
511 yyextra->CCodeBuffer += yytext;
513 if ( yyextra->curlyCount )
515 --yyextra->curlyCount ;
519 yyextra->docBlockContext = SkipCurlyEndDoc;
520 if (yytext[yyleng-3]==
'/')
531 yyextra->CCodeBuffer += yytext;
532 yyextra->lastStringContext=SkipCurly;
536 yyextra->CCodeBuffer += yytext;
537 yyextra->lastPreLineCtrlContext = YY_START;
538 BEGIN( PreLineCtrl );
540<SkipCurly>{B}*{RAWBEGIN} {
544 yyextra->lastRawStringContext = YY_START;
545 yyextra->CCodeBuffer += yytext;
DString extractBeginRawStringDelimiter(const char *rawStart)
548<SkipCurly>[^\n#"'@\\/{}<]+ {
549 yyextra->CCodeBuffer += yytext;
552 yyextra->CCodeBuffer += yytext;
553 yyextra->lastCContext = YY_START;
557 yyextra->CCodeBuffer += yytext;
558 yyextra->lastCContext = YY_START;
559 BEGIN(SkipCxxComment);
561<SkipCurly>{CHARLIT} {
562 yyextra->CCodeBuffer += yytext;
565 yyextra->CCodeBuffer += yytext;
568 yyextra->CCodeBuffer += yytext;
570<SkipCurly>({CPPC}{B}*)?{CCS}"!" {
571 yyextra->CCodeBuffer += yytext;
572 yyextra->docBlockContext = YY_START;
575<SkipCurly>{CCS}"*"[*]+{BL} {
577 yyextra->CCodeBuffer += yytext;
581 yyextra->docBlockContext = YY_START;
#define Config_getBool(name)
589<SkipCurly>({CPPC}{B}*)?{CCS}"*"/{NCOMM} {
590 yyextra->CCodeBuffer += yytext;
591 yyextra->docBlockContext = YY_START;
594<SkipCurly>{CPPC}"!" {
595 yyextra->CCodeBuffer += yytext;
596 yyextra->docBlockContext = YY_START;
599<SkipCurly>{CPPC}"/"/[^/] {
600 yyextra->CCodeBuffer += yytext;
601 yyextra->docBlockContext = YY_START;
606 yyextra->CCodeBuffer += yytext;
608 if (yyextra->curlyCount<=0)
615 yyextra->CCodeBuffer += yytext;
618 yyextra->CCodeBuffer += yytext;
619 BEGIN( yyextra->lastStringContext );
621<SkipString>{CCS}|{CCE}|{CPPC} {
622 yyextra->CCodeBuffer += yytext;
625 yyextra->CCodeBuffer += yytext;
629 yyextra->CCodeBuffer += yytext;
631<SkipCxxComment>.*"\\\n" {
632 yyextra->CCodeBuffer += yytext;
635<SkipCxxComment>{ANYopt}/\n {
636 yyextra->CCodeBuffer += yytext;
637 BEGIN( yyextra->lastCContext ) ;
640 yyextra->CCodeBuffer += yytext ;
643<Comment>{CCS} { yyextra->CCodeBuffer += yytext ; }
644<Comment>{CPPC} { yyextra->CCodeBuffer += yytext ; }
645<Comment>{CMD}("code"|"verbatim"|"iliteral") {
646 yyextra->insideCode=
true;
647 yyextra->CCodeBuffer += yytext ;
649<Comment>{CMD}("endcode"|"endverbatim"|"endiliteral") {
650 yyextra->insideCode=
false;
651 yyextra->CCodeBuffer += yytext ;
653<Comment>[^ \.\t\r\n\/\*]+ { yyextra->CCodeBuffer += yytext ; }
655 yyextra->CCodeBuffer += yytext ;
656 if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ;
658<Comment>. { yyextra->CCodeBuffer += *yytext ; }
660<SkipComment>{CPPC}|{CCS} {
661 yyextra->CCodeBuffer += yytext;
663<SkipComment>[^\*\n]+ {
664 yyextra->CCodeBuffer += yytext;
667 yyextra->CCodeBuffer += yytext;
670<SkipComment>{B}*{CCE} {
671 yyextra->CCodeBuffer += yytext;
672 BEGIN( yyextra->lastCContext );
675 yyextra->CCodeBuffer += yytext;
678 yyextra->CCodeBuffer += yytext;
681 BEGIN(yyextra->lastRawStringContext);
DString extractEndRawStringDelimiter(const char *rawEnd)
685 yyextra->CCodeBuffer += yytext;
688 yyextra->CCodeBuffer += yytext;
691 yyextra->CCodeBuffer += yytext;
697<DocLine>[^\n]*"\n"[ \t]*{CPPC}[/!][<]? {
698 yyextra->CCodeBuffer += yytext;
701<DocLine>{B}*{CPPC}"/"[/]+{Bopt}/"\n" {
702 yyextra->CCodeBuffer += yytext;
703 BEGIN( yyextra->docBlockContext );
705<DocLine>{NONLopt}/"\n"{B}*{CPPC}[!/]{B}*{CMD}"}" {
706 yyextra->CCodeBuffer += yytext;
707 BEGIN( yyextra->docBlockContext );
709<DocLine>{NONLopt}/"\n" {
710 yyextra->CCodeBuffer += yytext;
711 BEGIN( yyextra->docBlockContext );
717 yyextra->CCodeBuffer += yytext;
718 BEGIN(yyextra->docBlockContext);
720<DocBlock>^{B}*"*"+/[^/] {
721 yyextra->CCodeBuffer += yytext;
723<DocBlock>^{B}*({CPPC})?{B}*"*"+/[^/a-z_A-Z0-9*] {
724 yyextra->CCodeBuffer += yytext;
726<DocBlock>^{B}*({CPPC}){B}* {
727 yyextra->CCodeBuffer += yytext;
730 yyextra->CCodeBuffer += yytext;
734 yyextra->CCodeBuffer += yytext;
736<DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
737 yyextra->CCodeBuffer += yytext;
739<DocBlock>{CMD}("f$"|"f["|"f{"|"f(") {
740 yyextra->CCodeBuffer += yytext;
741 yyextra->docBlockName=&yytext[1];
742 if (yyextra->docBlockName.at(1)==
'[')
744 yyextra->docBlockName.at(1)=
']';
746 if (yyextra->docBlockName.at(1)==
'{')
748 yyextra->docBlockName.at(1)=
'}';
750 if (yyextra->docBlockName.at(1)==
'(')
752 yyextra->docBlockName.at(1)=
')';
754 yyextra->fencedSize=0;
755 yyextra->nestedComment=
false;
758<DocBlock>{B}*"<"{PRE}">" {
759 yyextra->CCodeBuffer += yytext;
760 yyextra->docBlockName=
"<pre>";
761 yyextra->fencedSize=0;
762 yyextra->nestedComment=
false;
765<DocBlock>{CMD}"startuml"/[^a-z_A-Z0-9\-] {
766 yyextra->CCodeBuffer += yytext;
767 yyextra->docBlockName=
"uml";
768 yyextra->fencedSize=0;
769 yyextra->nestedComment=
false;
772<DocBlock>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"mermaid"|"code")/[^a-z_A-Z0-9\-] {
773 yyextra->CCodeBuffer += yytext;
774 yyextra->docBlockName=&yytext[1];
775 yyextra->fencedSize=0;
776 yyextra->nestedComment=
false;
779<DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
780 yyextra->CCodeBuffer += yytext;
782 yyextra->docBlockName=
"~~~";
784 yyextra->nestedComment=
false;
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
size_t length() const
Returns the length of the string, not counting the 0-terminator.
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
787<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
788 yyextra->CCodeBuffer += yytext;
790 yyextra->docBlockName=
"```";
792 yyextra->nestedComment=
false;
795<DocBlock>{B}*"<code>" {
798<DocBlock>[^@*~\/\\\n]+ {
799 yyextra->CCodeBuffer += yytext;
802 yyextra->CCodeBuffer += yytext;
806 yyextra->CCodeBuffer += yytext;
810<DocCopyBlock>"</"{PRE}">" {
811 yyextra->CCodeBuffer += yytext;
812 if (yyextra->docBlockName==
"<pre>")
817<DocCopyBlock>"</"{CODE}">" {
818 yyextra->CCodeBuffer += yytext;
819 if (yyextra->docBlockName==
"<code>")
824<DocCopyBlock>{CMD}("f$"|"f]"|"f}"|"f)") {
825 yyextra->CCodeBuffer += yytext;
826 if (yyextra->docBlockName==&yytext[1])
831<DocCopyBlock>{CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"endmermaid"|"enduml"|"endcode")/[^a-z_A-Z0-9] {
832 yyextra->CCodeBuffer += yytext;
833 if (&yytext[4]==yyextra->docBlockName)
838<DocCopyBlock>^{B}*"*"+/{BN}+ {
839 yyextra->CCodeBuffer += yytext;
840 if ((yyextra->docBlockName==
"verbatim") || (yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
846 yyextra->CCodeBuffer += yytext;
849<DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* {
850 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
852 yyextra->CCodeBuffer += yytext;
859<DocCopyBlock>^{B}*"*"+/({ID}|"(") {
860 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
862 yyextra->CCodeBuffer += yytext;
869<DocCopyBlock>^{B}*"*"+/{BN}* {
870 if ((yyextra->docBlockName==
"code") || (yyextra->docBlockName==
"iliteral"))
872 if (yyextra->nestedComment)
874 yyextra->CCodeBuffer += yytext;
878 yyextra->CCodeBuffer += yytext;
886<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
887 yyextra->CCodeBuffer += yytext;
894<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
895 yyextra->CCodeBuffer += yytext;
902<DocCopyBlock>[^<@/\*\]~\$\\\n]+ {
903 yyextra->CCodeBuffer += yytext;
905<DocCopyBlock>{CCS}|{CCE}|{CPPC} {
908 yyextra->nestedComment=
true;
910 else if (yytext[0]==
'*')
912 yyextra->nestedComment=
false;
914 yyextra->CCodeBuffer += yytext;
917 yyextra->CCodeBuffer += yytext;
921 yyextra->CCodeBuffer += yytext;
923<SkipCurlyEndDoc>"}"{BN}*{DCOMM}"<" {
924 yyextra->docBlockContext = SkipCurlyEndDoc;
925 yyextra->CCodeBuffer += yytext;
926 if (yytext[yyleng-3]==
'/')
935<SkipCurlyEndDoc>"}" {
936 yyextra->CCodeBuffer += yytext;
941 yyextra->CCodeBuffer += yytext;
959 if (yyextra->searchCtx)
977 if (yyextra->sourceFileDef && yyextra->lineNumbers)
979 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
981 if (!yyextra->includeCodeFragment && d)
983 yyextra->currentDefinition = d;
984 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
985 yyextra->classScope = d->
name();
987 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
988 if (yyextra->currentMemberDef)
990 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
991 yyextra->currentMemberDef->getOutputFileBase(),
992 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
993 !yyextra->includeCodeFragment);
1001 !yyextra->includeCodeFragment);
1008 !yyextra->includeCodeFragment);
1012 yyextra->code->startCodeLine(yyextra->yyLineNr);
1013 yyextra->insideCodeLine =
true;
1016 if (yyextra->currentFontClass)
1018 yyextra->code->startFontClass(yyextra->currentFontClass);
1025 if (yyextra->currentFontClass)
1027 yyextra->code->endFontClass();
1028 yyextra->currentFontClass=0;
1036 yyextra->code->endCodeLine();
1037 yyextra->insideCodeLine =
false;
1043 const char *fc = yyextra->currentFontClass;
1044 if (yyextra->insideCodeLine)
1048 if (yyextra->yyLineNr<yyextra->inputLines)
1050 yyextra->currentFontClass = fc;
1058 if (text.
empty())
return;
1059 const char *p=text.
data(),*sp=p;
1065 while ((c=*p++) && c!=
'\n') { }
1068 yyextra->yyLineNr++;
1069 size_t l =
static_cast<size_t>(p-sp-1);
1070 yyextra->code->codify(
DString(sp,l));
1075 yyextra->code->codify(sp);
1079 yyextra->startCCodeLine = yyextra->yyLineNr;
1086 if (!yyextra->currentFontClass || !s || strcmp(yyextra->currentFontClass,s))
1089 yyextra->code->startFontClass(s);
1090 yyextra->currentFontClass=s;
1098 const char *p=yyextra->inputString;
1104 if (c==
'\n') count++;
1106 if (p>yyextra->inputString && *(p-1)!=
'\n')
1116 int inputPosition = yyextra->inputPosition;
1117 const char *s = yyextra->inputString + inputPosition;
1119 while( c < max_size && *s )
1124 yyextra->inputPosition += c;
1131 for (
const char *p = yytext ; *p ; ++p )
1135 yyextra->yyLineNr++;
1143 if (yyextra->CCodeBuffer.empty())
return;
1145 yyextra->ccodeParser.setInsideCodeLine(yyextra->insideCodeLine);
1146 yyextra->ccodeParser.parseCode(*yyextra->code,
1147 yyextra->classScope,
1148 yyextra->CCodeBuffer,
1150 yyextra->stripCodeComments,
1152 .setExample(yyextra->exampleBlock,yyextra->exampleName)
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);
1192 yyextra->currentDefinition =
nullptr;
1193 yyextra->currentMemberDef =
nullptr;
1200 bool stripCodeComments,
1207 if (input.
empty())
return;
1211 yyextra->code = &codeOutIntf;
1212 yyextra->inputString = input.
data();
1213 yyextra->inputPosition = 0;
1215 yyextra->currentFontClass =
nullptr;
1216 yyextra->insideCodeLine =
false;
1217 yyextra->classScope = scopeName;
1218 yyextra->currentMemberDef = options.
memberDef();
1219 yyextra->searchCtx = options.
searchCtx();
1223 yyextra->startCCodeLine = yyextra->yyLineNr;
1224 yyextra->stripCodeComments = stripCodeComments;
1225 yyextra->exampleBlock = options.
isExample();
1227 yyextra->sourceFileDef = options.
fileDef();
1234 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
1237 if (yyextra->sourceFileDef)
1246 lexcodeYYrestart(
nullptr, yyscanner );
1247 BEGIN( DefSection );
1248 lexcodeYYlex(yyscanner);
1250 if (yyextra->insideCodeLine)
1254 if (yyextra->exampleFileDef)
1257 yyextra->exampleFileDef.reset();
1258 yyextra->sourceFileDef=0;
1264#include "lexcode.l.h"
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
DString & 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 bool isFlagSet(const DebugMask mask)
virtual const DString & name() const =0
virtual DString getReference() const =0
virtual DString getOutputFileBase() const =0
static SearchIndexIntf searchIndex
virtual DString fileName() const =0
std::unique_ptr< Private > p
void parseCode(OutputCodeList &codeOutIntf, const DString &scopeName, const DString &input, SrcLangExt, bool stripCodeComments, const CodeParserOptions &options) 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
void setCurrentDoc(const Definition *ctx, const DString &anchor, bool isSourceFile)
const char * qPrint(const char *s)
std::unique_ptr< FileDef > createFileDef(const DString &p, const DString &n, const DString &ref, const DString &dn)
Options to configure the code parser.
CodeParserOptions & setSearchCtx(const Definition *d)
CodeParserOptions & setStartLine(int lineNr)
const Definition * searchCtx() const
DString exampleName() const
const FileDef * fileDef() const
CodeParserOptions & setInlineFragment(bool enable)
const MemberDef * memberDef() const
CodeParserOptions & setCollectXRefs(bool enable)
bool showLineNumbers() const
bool inlineFragment() const
CodeParserOptions & setMemberDef(const MemberDef *md)
bool collectXRefs() const
CodeParserOptions & setShowLineNumbers(bool enable)
CodeParserOptions & setFileDef(const FileDef *fd)