20%option never-interactive
21%option prefix="xmlcodeYY"
23%option extra-type="struct xmlcodeYY_state *"
30#define YY_TYPEDEF_YY_SCANNER_T
53#define YY_NEVER_INTERACTIVE 1
55#define YY_NO_UNISTD_H 1
106#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.
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 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 setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
static void codify(yyscan_t yyscanner, const char *text)
static void endFontClass(yyscan_t yyscanner)
118namestart [A-Za-z\200-\377_]
119namechar [:A-Za-z\200-\377_0-9.-]
120esc "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";"
121name {namestart}{namechar}*
122comment {open}"!--"([^-]|"-"[^-])*"--"{close}
123cdata {open}"![CDATA["([^\]]|"\]"[^\]])*"]]"{close}
124string \"([^\"&]|{esc})*\"|\'([^'&]|{esc})*\'
static void codifyLines(yyscan_t yyscanner, const QCString &text)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
static void codify(yyscan_t yyscanner, const QCString &text)
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
164 char openBracket[] = { yytext[0],
'\0' };
165 codify(yyscanner,openBracket);
175{open}{ws}?"/"{name} {
177 char closeBracket[] = { yytext[0], yytext[1],
'\0' };
179 codify(yyscanner,closeBracket);
214 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
215 int inputPosition = yyextra->inputPosition;
216 const char *s = yyextra->inputString + inputPosition;
218 while( c < max_size && *s)
223 yyextra->inputPosition += c;
229 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
230 yyextra->code->codify(text);
235 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
238 if (yyextra->searchCtx)
255 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
256 if (yyextra->sourceFileDef && yyextra->lineNumbers)
258 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
262 yyextra->currentDefinition = d;
263 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
265 yyextra->classScope = d->
name();
267 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
268 if (yyextra->currentMemberDef)
270 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
271 yyextra->currentMemberDef->getOutputFileBase(),
272 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
273 !yyextra->includeCodeFragment);
281 !yyextra->includeCodeFragment);
288 !yyextra->includeCodeFragment);
292 yyextra->code->startCodeLine(yyextra->yyLineNr);
293 yyextra->insideCodeLine =
true;
295 if (yyextra->currentFontClass)
297 yyextra->code->startFontClass(yyextra->currentFontClass);
303 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
304 if (yyextra->currentFontClass)
306 yyextra->code->endFontClass();
307 yyextra->currentFontClass=0;
313 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
315 yyextra->code->endCodeLine();
316 yyextra->insideCodeLine =
false;
321 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
322 const char *fc = yyextra->currentFontClass;
323 if (yyextra->insideCodeLine)
327 if (yyextra->yyLineNr<yyextra->inputLines)
329 yyextra->currentFontClass = fc;
336 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
337 const char *p=text,*sp=p;
343 while ((c=*p++) && c!=
'\n') { }
347 size_t l =
static_cast<size_t>(p-sp-1);
348 yyextra->code->codify(
QCString(sp,l));
353 yyextra->code->codify(sp);
361 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
363 yyextra->code->startFontClass(s);
364 yyextra->currentFontClass=s;
370 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
371 const char *p=yyextra->inputString;
377 if (c==
'\n') count++;
379 if (p>yyextra->inputString && *(p-1)!=
'\n')
397 xmlcodeYYlex_init_extra(&
p->state,&
p->yyscanner);
406 xmlcodeYYlex_destroy(
p->yyscanner);
411 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
412 yyextra->currentDefinition =
nullptr;
413 yyextra->currentMemberDef =
nullptr;
420 bool stripCodeComments,
425 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
431 yyextra->code = &codeOutIntf;
432 yyextra->inputString = input.
data();
433 yyextra->inputPosition = 0;
434 yyextra->currentFontClass =
nullptr;
435 yyextra->insideCodeLine =
false;
436 yyextra->searchCtx = options.
searchCtx();
439 yyextra->stripCodeComments = stripCodeComments;
440 yyextra->exampleBlock = options.
isExample();
442 yyextra->sourceFileDef = options.
fileDef();
449 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
452 if (yyextra->sourceFileDef)
461 xmlcodeYYrestart(
nullptr, yyscanner );
463 xmlcodeYYlex(yyscanner);
465 if (yyextra->insideCodeLine)
469 if (yyextra->exampleFileDef)
472 yyextra->exampleFileDef.reset();
473 yyextra->sourceFileDef=
nullptr;
478#include "xmlcode.l.h"
static bool isFlagSet(const DebugMask mask)
virtual bool isLinkableInProject() const =0
virtual QCString getReference() const =0
virtual QCString getOutputFileBase() const =0
virtual const QCString & name() const =0
static SearchIndexIntf searchIndex
virtual QCString fileName() const =0
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.
std::unique_ptr< Private > p
~XMLCodeParser() override
void resetCodeParserState() override
Resets the state of the code parser.
void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt, bool stripCodeComments, const CodeParserOptions &options) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
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)
Options to configure the code parser.
const Definition * searchCtx() const
const FileDef * fileDef() const
bool showLineNumbers() const
bool inlineFragment() const
QCString exampleName() const