18%option never-interactive
19%option prefix="xmlcodeYY"
21%option extra-type="struct xmlcodeYY_state *"
28#define YY_TYPEDEF_YY_SCANNER_T
51#define YY_NEVER_INTERACTIVE 1
53#define YY_NO_UNISTD_H 1
103#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
106static inline const char *
getLexerFILE() {
return __FILE__;}
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.
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, bool specialComment=false)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
static const char * getLexerFILE()
static void setCurrentDoc(yyscan_t yyscanner, const QCString &anchor)
static void codify(yyscan_t yyscanner, const QCString &text)
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.
115namestart [A-Za-z\200-\377_]
116namechar [:A-Za-z\200-\377_0-9.-]
117esc "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";"
118name {namestart}{namechar}*
119comment {open}"!--"([^-]|"-"[^-])*"--"{close}
120cdata {open}"![CDATA["([^\]]|"\]"[^\]])*"]]"{close}
121string \"([^\"&]|{esc})*\"|\'([^'&]|{esc})*\'
161 char openBracket[] = { yytext[0],
'\0' };
162 codify(yyscanner,openBracket);
172{open}{ws}?"/"{name} {
174 char closeBracket[] = { yytext[0], yytext[1],
'\0' };
176 codify(yyscanner,closeBracket);
211 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
212 int inputPosition = yyextra->inputPosition;
213 const char *s = yyextra->inputString + inputPosition;
215 while( c < max_size && *s)
220 yyextra->inputPosition += c;
226 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
227 yyextra->code->codify(text);
232 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
235 if (yyextra->searchCtx)
252 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
253 if (yyextra->sourceFileDef)
255 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
259 yyextra->currentDefinition = d;
260 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
262 yyextra->classScope = d->
name();
264 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
265 if (yyextra->currentMemberDef)
267 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
268 yyextra->currentMemberDef->getOutputFileBase(),
269 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
270 !yyextra->includeCodeFragment);
278 !yyextra->includeCodeFragment);
285 !yyextra->includeCodeFragment);
289 yyextra->code->startCodeLine(yyextra->yyLineNr);
290 yyextra->insideCodeLine =
true;
292 if (yyextra->currentFontClass)
294 yyextra->code->startFontClass(yyextra->currentFontClass);
300 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
301 if (yyextra->currentFontClass)
303 yyextra->code->endFontClass();
304 yyextra->currentFontClass=0;
310 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
312 yyextra->code->endCodeLine();
313 yyextra->insideCodeLine =
false;
318 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
319 const char *fc = yyextra->currentFontClass;
320 if (yyextra->insideCodeLine)
324 if (yyextra->yyLineNr<yyextra->inputLines)
326 yyextra->currentFontClass = fc;
333 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
334 const char *p=text,*sp=p;
340 while ((c=*p++) && c!=
'\n') { }
344 size_t l =
static_cast<size_t>(p-sp-1);
345 yyextra->code->codify(
QCString(sp,l));
350 yyextra->code->codify(sp);
358 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
360 yyextra->code->startFontClass(s);
361 yyextra->currentFontClass=s;
367 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
368 const char *p=yyextra->inputString;
374 if (c==
'\n') count++;
376 if (p>yyextra->inputString && *(p-1)!=
'\n')
394 xmlcodeYYlex_init_extra(&
p->state,&
p->yyscanner);
403 xmlcodeYYlex_destroy(
p->yyscanner);
408 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
409 yyextra->currentDefinition =
nullptr;
410 yyextra->currentMemberDef =
nullptr;
417 bool stripCodeComments,
422 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
428 yyextra->code = &codeOutIntf;
429 yyextra->inputString = input.
data();
430 yyextra->inputPosition = 0;
431 yyextra->currentFontClass =
nullptr;
432 yyextra->insideCodeLine =
false;
433 yyextra->searchCtx = options.
searchCtx();
436 yyextra->stripCodeComments = stripCodeComments;
437 yyextra->exampleBlock = options.
isExample();
439 yyextra->sourceFileDef = options.
fileDef();
445 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
448 if (yyextra->sourceFileDef)
457 xmlcodeYYrestart(
nullptr, yyscanner );
459 xmlcodeYYlex(yyscanner);
461 if (yyextra->insideCodeLine)
465 if (yyextra->exampleFileDef)
468 yyextra->exampleFileDef.reset();
469 yyextra->sourceFileDef=
nullptr;
474#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.
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 inlineFragment() const
QCString exampleName() const