20%option never-interactive
21%option prefix="xmlcodeYY"
23%option extra-type="struct xmlcodeYY_state *"
30#define YY_TYPEDEF_YY_SCANNER_T
31#define yyguts_t xmlcodeYYguts_t
54#define YY_NEVER_INTERACTIVE 1
56#define YY_NO_UNISTD_H 1
107#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.
Web server based search engine.
const char * currentFontClass
const Definition * currentDefinition
const FileDef * sourceFileDef
const MemberDef * currentMemberDef
int yyLineNr
current line number
int inputPosition
read offset during parsing
std::unique_ptr< FileDef > exampleFileDef
const char * inputString
the code fragment as text
int inputLines
number of line in the code fragment
const Definition * searchCtx
A bunch of utility functions.
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 codifyLines(yyscan_t yyscanner, const char *text)
static const char * getLexerFILE()
static void codify(yyscan_t yyscanner, const char *text)
static void endFontClass(yyscan_t yyscanner)
119namestart [A-Za-z\200-\377_]
120namechar [:A-Za-z\200-\377_0-9.-]
121esc "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";"
122name {namestart}{namechar}*
123comment {open}"!--"([^-]|"-"[^-])*"--"{close}
124cdata {open}"![CDATA["([^\]]|"\]"[^\]])*"]]"{close}
125string \"([^\"&]|{esc})*\"|\'([^'&]|{esc})*\'
165 char openBracket[] = { yytext[0],
'\0' };
166 codify(yyscanner,openBracket);
176{open}{ws}?"/"{name} {
178 char closeBracket[] = { yytext[0], yytext[1],
'\0' };
180 codify(yyscanner,closeBracket);
216 int inputPosition = yyextra->inputPosition;
217 const char *s = yyextra->inputString + inputPosition;
219 while( c < max_size && *s)
224 yyextra->inputPosition += c;
231 yyextra->code->codify(text);
239 if (yyextra->searchCtx)
257 if (yyextra->sourceFileDef && yyextra->lineNumbers)
259 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
263 yyextra->currentDefinition = d;
264 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
266 yyextra->classScope = d->
name();
268 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
269 if (yyextra->currentMemberDef)
271 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
272 yyextra->currentMemberDef->getOutputFileBase(),
273 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
274 !yyextra->includeCodeFragment);
282 !yyextra->includeCodeFragment);
289 !yyextra->includeCodeFragment);
293 yyextra->code->startCodeLine(yyextra->yyLineNr);
294 yyextra->insideCodeLine =
true;
296 if (yyextra->currentFontClass)
298 yyextra->code->startFontClass(yyextra->currentFontClass);
305 if (yyextra->currentFontClass)
307 yyextra->code->endFontClass();
308 yyextra->currentFontClass=0;
316 yyextra->code->endCodeLine();
317 yyextra->insideCodeLine =
false;
323 const char *fc = yyextra->currentFontClass;
324 if (yyextra->insideCodeLine)
328 if (yyextra->yyLineNr<yyextra->inputLines)
330 yyextra->currentFontClass = fc;
338 const char *p=text,*sp=p;
344 while ((c=*p++) && c!=
'\n') { }
348 size_t l =
static_cast<size_t>(p-sp-1);
349 yyextra->code->codify(
DString(sp,l));
354 yyextra->code->codify(sp);
364 yyextra->code->startFontClass(s);
365 yyextra->currentFontClass=s;
372 const char *p=yyextra->inputString;
378 if (c==
'\n') count++;
380 if (p>yyextra->inputString && *(p-1)!=
'\n')
398 xmlcodeYYlex_init_extra(&
p->state,&
p->yyscanner);
407 xmlcodeYYlex_destroy(
p->yyscanner);
413 yyextra->currentDefinition =
nullptr;
414 yyextra->currentMemberDef =
nullptr;
421 bool stripCodeComments,
428 if (input.
empty())
return;
432 yyextra->code = &codeOutIntf;
433 yyextra->inputString = input.
data();
434 yyextra->inputPosition = 0;
435 yyextra->currentFontClass =
nullptr;
436 yyextra->insideCodeLine =
false;
437 yyextra->searchCtx = options.
searchCtx();
440 yyextra->stripCodeComments = stripCodeComments;
441 yyextra->exampleBlock = options.
isExample();
443 yyextra->sourceFileDef = options.
fileDef();
450 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
453 if (yyextra->sourceFileDef)
462 xmlcodeYYrestart(
nullptr, yyscanner );
464 xmlcodeYYlex(yyscanner);
466 if (yyextra->insideCodeLine)
470 if (yyextra->exampleFileDef)
473 yyextra->exampleFileDef.reset();
474 yyextra->sourceFileDef=
nullptr;
479#include "xmlcode.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 bool isLinkableInProject() const =0
virtual DString getReference() const =0
virtual DString getOutputFileBase() const =0
static SearchIndexIntf searchIndex
virtual DString fileName() const =0
void setCurrentDoc(const Definition *ctx, const DString &anchor, bool isSourceFile)
std::unique_ptr< Private > p
~XMLCodeParser() override
void resetCodeParserState() override
Resets the state of the code parser.
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.
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.
const Definition * searchCtx() const
DString exampleName() const
const FileDef * fileDef() const
bool showLineNumbers() const
bool inlineFragment() const