16%option never-interactive
17%option prefix="lexcodeYY"
20%option extra-type="struct lexcodeYY_state *"
24#define YY_TYPEDEF_YY_SCANNER_T
47#define YY_NEVER_INTERACTIVE 1
49#define YY_NO_UNISTD_H 1
112#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.
129RulesSharp "<"[^>\n]*">"
130RulesCurly "{"[^{}\n]*"}"
135EscapeRulesCharOpen "\\["|"\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\"
136EscapeRulesCharClose "\\]"|"\>"|"\\}"|"\\)"
137EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose}
144ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
147RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
148RAWEND ")"[^ \t\(\)\\]{0,16}\"
149CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
161DCOMM ("/\*!"|"/\**"|"/\/!"|"/\/\/")
200<DefSection>^{TopStart} {
203 yyextra->lastContext = YY_START;
204 yyextra->startCCodeLine=yyextra->yyLineNr;
static void codifyLines(yyscan_t yyscanner, const DString &text)
207<DefSection>^{LiteralStart} {
210 yyextra->lastContext = YY_START;
211 yyextra->startCCodeLine=yyextra->yyLineNr;
212 BEGIN (LiteralSection);
214<TopSection>^{TopEnd} {
217 BEGIN( yyextra->lastContext ) ;
220 yyextra->CCodeBuffer += yytext;
223<LiteralSection>^{LiteralEnd} {
226 BEGIN( yyextra->lastContext ) ;
228<LiteralSection>.*{nl} {
229 yyextra->CCodeBuffer += yytext;
232<DefSection>{CPPC}.*{nl} {
233 yyextra->CCodeBuffer += yytext;
236<DefSection>^{ws}*{CCS} {
237 yyextra->CCodeBuffer += yytext;
238 yyextra->lastContext = YY_START;
241<COMMENT>{CCE}{ws}*{nl} {
242 yyextra->CCodeBuffer+=yytext;
245 BEGIN(yyextra->lastContext);
248 yyextra->CCodeBuffer+=yytext;
250 BEGIN(yyextra->lastContext);
253 yyextra->CCodeBuffer += yytext;
255<COMMENT>{CPPC}|{CCS} {
256 yyextra->CCodeBuffer += yytext;
259 yyextra->CCodeBuffer += yytext;
263 yyextra->CCodeBuffer += yytext;
268 yyextra->startCCodeLine=yyextra->yyLineNr;
270<DefSection>^{ws}.*{nl} {
271 yyextra->CCodeBuffer += yytext;
274<DefSection>^{RulesStart} {
277 yyextra->startCCodeLine=yyextra->yyLineNr;
278 BEGIN (RulesSectionInit);
283 BEGIN(DefSectionLine);
285<DefSectionLine>.*{nl} {
287 yyextra->startCCodeLine=yyextra->yyLineNr;
290<RulesSectionInit,RulesPattern>^{RulesEnd} {
293 yyextra->startCCodeLine=yyextra->yyLineNr;
296<RulesSectionInit>^{nws} {
301<RulesSectionInit>{nl} {
302 yyextra->CCodeBuffer += yytext;
305<RulesSectionInit>^{ws}.*{nl} {
306 yyextra->CCodeBuffer += yytext;
309<RulesPattern>"<<EOF>>" {
310 yyextra->rulesPatternBuffer += yytext;
312<RulesPattern>{EscapeRulesChar} {
313 yyextra->rulesPatternBuffer += yytext;
315<RulesPattern>{RulesSharp} {
316 yyextra->rulesPatternBuffer += yytext;
318<RulesPattern>{RulesCurly} {
319 yyextra->rulesPatternBuffer += yytext;
321<RulesPattern>{StartDouble} {
322 yyextra->rulesPatternBuffer += yytext;
323 yyextra->lastContext = YY_START;
326<RulesDouble,RulesRoundDouble>"\\\\" {
327 yyextra->rulesPatternBuffer += yytext;
329<RulesDouble,RulesRoundDouble>"\\\"" {
330 yyextra->rulesPatternBuffer += yytext;
333 yyextra->rulesPatternBuffer += yytext;
334 BEGIN( yyextra->lastContext ) ;
336<RulesRoundDouble>"\"" {
337 yyextra->rulesPatternBuffer += yytext;
340<RulesDouble,RulesRoundDouble>. {
341 yyextra->rulesPatternBuffer += yytext;
343<RulesPattern>{StartSquare} {
344 yyextra->rulesPatternBuffer += yytext;
345 yyextra->lastContext = YY_START;
348<RulesSquare,RulesRoundSquare>{CHARCE} {
349 yyextra->rulesPatternBuffer += yytext;
351<RulesSquare,RulesRoundSquare>"\\[" |
352<RulesSquare,RulesRoundSquare>"\\]" {
353 yyextra->rulesPatternBuffer += yytext;
356 yyextra->rulesPatternBuffer += yytext;
357 BEGIN(RulesPattern) ;
359<RulesRoundSquare>"]" {
360 yyextra->rulesPatternBuffer += yytext;
363<RulesSquare,RulesRoundSquare>"\\\\" {
364 yyextra->rulesPatternBuffer += yytext;
366<RulesSquare,RulesRoundSquare>. {
367 yyextra->rulesPatternBuffer += yytext;
369<RulesPattern>{StartRoundQuest} {
370 yyextra->rulesPatternBuffer += yytext;
371 yyextra->lastContext = YY_START;
372 BEGIN(RulesRoundQuest);
374<RulesRoundQuest>{nl} {
375 yyextra->rulesPatternBuffer += yytext;
376 if (!yyextra->rulesPatternBuffer.empty())
379 codifyLines(yyscanner,yyextra->rulesPatternBuffer.data());
380 yyextra->rulesPatternBuffer.clear();
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
384<RulesRoundQuest>[^)] {
385 yyextra->rulesPatternBuffer += yytext;
387<RulesRoundQuest>")" {
388 yyextra->rulesPatternBuffer += yytext;
389 BEGIN(yyextra->lastContext);
391<RulesPattern>{StartRound} {
392 yyextra->roundCount++;
393 yyextra->rulesPatternBuffer += yytext;
394 yyextra->lastContext = YY_START;
397<RulesRound>{RulesCurly} {
398 yyextra->rulesPatternBuffer += yytext;
400<RulesRound>{StartSquare} {
401 yyextra->rulesPatternBuffer += yytext;
402 BEGIN(RulesRoundSquare);
404<RulesRound>{StartDouble} {
405 yyextra->rulesPatternBuffer += yytext;
406 BEGIN(RulesRoundDouble);
408<RulesRound>{EscapeRulesChar} {
409 yyextra->rulesPatternBuffer += yytext;
412 yyextra->roundCount++;
413 yyextra->rulesPatternBuffer += yytext;
416 yyextra->roundCount--;
417 yyextra->rulesPatternBuffer += yytext;
418 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
421 yyextra->rulesPatternBuffer += yytext;
425 yyextra->rulesPatternBuffer += yytext;
428 yyextra->rulesPatternBuffer += yytext;
430<RulesPattern>{ws}+"|" {
431 if (!yyextra->rulesPatternBuffer.empty())
434 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
435 yyextra->rulesPatternBuffer.clear();
439 yyextra->startCCodeLine=yyextra->yyLineNr;
440 yyextra->curlyCount = 0;
443<RulesPattern>^{ws}*{nl} {
446<RulesPattern>^{ws}+ {
449<RulesPattern>({ws}|{nl}) {
451 if (!yyextra->rulesPatternBuffer.empty())
454 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
455 yyextra->rulesPatternBuffer.clear();
458 yyextra->startCCodeLine=yyextra->yyLineNr;
459 yyextra->curlyCount = 0;
462<RulesPattern>"\\\\" {
463 yyextra->rulesPatternBuffer += yytext;
466 if (!yyextra->rulesPatternBuffer.empty())
469 codifyLines(yyscanner,yyextra->rulesPatternBuffer);
470 yyextra->rulesPatternBuffer.clear();
473 yyextra->CCodeBuffer += yytext;
474 yyextra->lastContext = YY_START;
478 yyextra->rulesPatternBuffer += yytext;
480<SkipCurly>{B}*"#"{B}+[0-9]+{B}+/"\"" {
481 yyextra->CCodeBuffer += yytext;
482 yyextra->lastPreLineCtrlContext = YY_START;
483 BEGIN( PreLineCtrl );
485<PreLineCtrl>"\""[^\n\"]*"\"" {
486 yyextra->CCodeBuffer += yytext;
489 yyextra->CCodeBuffer += yytext;
492 yyextra->CCodeBuffer += yytext;
494 BEGIN( yyextra->lastPreLineCtrlContext );
497 yyextra->CCodeBuffer += yytext;
498 ++yyextra->curlyCount ;
500<SkipCurly>"}"/{BN}*{DCOMM}"<!--" |
502 yyextra->CCodeBuffer += yytext;
504 if( yyextra->curlyCount )
506 --yyextra->curlyCount ;
509<SkipCurly>"}"{BN}*{DCOMM}"<" {
510 yyextra->CCodeBuffer += yytext;
512 if ( yyextra->curlyCount )
514 --yyextra->curlyCount ;
518 yyextra->docBlockContext = SkipCurlyEndDoc;
519 if (yytext[yyleng-3]==
'/')
530 yyextra->CCodeBuffer += yytext;
531 yyextra->lastStringContext=SkipCurly;
535 yyextra->CCodeBuffer += yytext;
536 yyextra->lastPreLineCtrlContext = YY_START;
537 BEGIN( PreLineCtrl );
539<SkipCurly>{B}*{RAWBEGIN} {
543 yyextra->lastRawStringContext = YY_START;
544 yyextra->CCodeBuffer += yytext;
DString extractBeginRawStringDelimiter(const char *rawStart)
547<SkipCurly>[^\n#"'@\\/{}<]+ {
548 yyextra->CCodeBuffer += yytext;
551 yyextra->CCodeBuffer += yytext;
552 yyextra->lastCContext = YY_START;
556 yyextra->CCodeBuffer += yytext;
557 yyextra->lastCContext = YY_START;
558 BEGIN(SkipCxxComment);
560<SkipCurly>{CHARLIT} {
561 yyextra->CCodeBuffer += yytext;
564 yyextra->CCodeBuffer += yytext;
567 yyextra->CCodeBuffer += yytext;
569<SkipCurly>({CPPC}{B}*)?{CCS}"!" {
570 yyextra->CCodeBuffer += yytext;
571 yyextra->docBlockContext = YY_START;
574<SkipCurly>{CCS}"*"[*]+{BL} {
576 yyextra->CCodeBuffer += yytext;
580 yyextra->docBlockContext = YY_START;
#define Config_getBool(name)
588<SkipCurly>({CPPC}{B}*)?{CCS}"*"/{NCOMM} {
589 yyextra->CCodeBuffer += yytext;
590 yyextra->docBlockContext = YY_START;
593<SkipCurly>{CPPC}"!" {
594 yyextra->CCodeBuffer += yytext;
595 yyextra->docBlockContext = YY_START;
598<SkipCurly>{CPPC}"/"/[^/] {
599 yyextra->CCodeBuffer += yytext;
600 yyextra->docBlockContext = YY_START;
605 yyextra->CCodeBuffer += yytext;
607 if (yyextra->curlyCount<=0)
614 yyextra->CCodeBuffer += yytext;
617 yyextra->CCodeBuffer += yytext;
618 BEGIN( yyextra->lastStringContext );
620<SkipString>{CCS}|{CCE}|{CPPC} {
621 yyextra->CCodeBuffer += yytext;
624 yyextra->CCodeBuffer += yytext;
628 yyextra->CCodeBuffer += yytext;
630<SkipCxxComment>.*"\\\n" {
631 yyextra->CCodeBuffer += yytext;
634<SkipCxxComment>{ANYopt}/\n {
635 yyextra->CCodeBuffer += yytext;
636 BEGIN( yyextra->lastCContext ) ;
639 yyextra->CCodeBuffer += yytext ;
642<Comment>{CCS} { yyextra->CCodeBuffer += yytext ; }
643<Comment>{CPPC} { yyextra->CCodeBuffer += yytext ; }
644<Comment>{CMD}("code"|"verbatim"|"iliteral") {
645 yyextra->insideCode=
true;
646 yyextra->CCodeBuffer += yytext ;
648<Comment>{CMD}("endcode"|"endverbatim"|"endiliteral") {
649 yyextra->insideCode=
false;
650 yyextra->CCodeBuffer += yytext ;
652<Comment>[^ \.\t\r\n\/\*]+ { yyextra->CCodeBuffer += yytext ; }
654 yyextra->CCodeBuffer += yytext ;
655 if (!yyextra->insideCode) BEGIN( yyextra->lastContext ) ;
657<Comment>. { yyextra->CCodeBuffer += *yytext ; }
659<SkipComment>{CPPC}|{CCS} {
660 yyextra->CCodeBuffer += yytext;
662<SkipComment>[^\*\n]+ {
663 yyextra->CCodeBuffer += yytext;
666 yyextra->CCodeBuffer += yytext;
669<SkipComment>{B}*{CCE} {
670 yyextra->CCodeBuffer += yytext;
671 BEGIN( yyextra->lastCContext );
674 yyextra->CCodeBuffer += yytext;
677 yyextra->CCodeBuffer += yytext;
680 BEGIN(yyextra->lastRawStringContext);
DString extractEndRawStringDelimiter(const char *rawEnd)
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"|"mermaid"|"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;
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
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>{CMD}("f$"|"f]"|"f}"|"f)") {
824 yyextra->CCodeBuffer += yytext;
825 if (yyextra->docBlockName==&yytext[1])
830<DocCopyBlock>{CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"endmermaid"|"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;
1057 if (text.
empty())
return;
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 yyextra->code->codify(
DString(sp,l));
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.empty())
return;
1144 yyextra->ccodeParser.setInsideCodeLine(yyextra->insideCodeLine);
1145 yyextra->ccodeParser.parseCode(*yyextra->code,
1146 yyextra->classScope,
1147 yyextra->CCodeBuffer,
1149 yyextra->stripCodeComments,
1151 .setExample(yyextra->exampleBlock,yyextra->exampleName)
1160 yyextra->CCodeBuffer.clear();
1161 yyextra->insideCodeLine = yyextra->ccodeParser.insideCodeLine();
1162 yyextra->yyLineNr--;
1176 lexcodeYYlex_init_extra(&
p->state, &
p->yyscanner);
1185 lexcodeYYlex_destroy(
p->yyscanner);
1190 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
1191 yyextra->currentDefinition =
nullptr;
1192 yyextra->currentMemberDef =
nullptr;
1199 bool stripCodeComments,
1204 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1206 if (input.
empty())
return;
1210 yyextra->code = &codeOutIntf;
1211 yyextra->inputString = input.
data();
1212 yyextra->inputPosition = 0;
1214 yyextra->currentFontClass =
nullptr;
1215 yyextra->insideCodeLine =
false;
1216 yyextra->classScope = scopeName;
1217 yyextra->currentMemberDef = options.
memberDef();
1218 yyextra->searchCtx = options.
searchCtx();
1222 yyextra->startCCodeLine = yyextra->yyLineNr;
1223 yyextra->stripCodeComments = stripCodeComments;
1224 yyextra->exampleBlock = options.
isExample();
1226 yyextra->sourceFileDef = options.
fileDef();
1233 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
1236 if (yyextra->sourceFileDef)
1245 lexcodeYYrestart(
nullptr, yyscanner );
1246 BEGIN( DefSection );
1247 lexcodeYYlex(yyscanner);
1249 if (yyextra->insideCodeLine)
1253 if (yyextra->exampleFileDef)
1256 yyextra->exampleFileDef.reset();
1257 yyextra->sourceFileDef=0;
1263#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)
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)
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)