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
104#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
107static 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.
116namestart [A-Za-z\200-\377_]
117namechar [:A-Za-z\200-\377_0-9.-]
118esc "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";"
119name {namestart}{namechar}*
120comment {open}"!--"([^-]|"-"[^-])*"--"{close}
121cdata {open}"![CDATA["([^\]]|"\]"[^\]])*"]]"{close}
122string \"([^\"&]|{esc})*\"|\'([^'&]|{esc})*\'
162 char openBracket[] = { yytext[0],
'\0' };
163 codify(yyscanner,openBracket);
173{open}{ws}?"/"{name} {
175 char closeBracket[] = { yytext[0], yytext[1],
'\0' };
177 codify(yyscanner,closeBracket);
212 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
213 int inputPosition = yyextra->inputPosition;
214 const char *s = yyextra->inputString + inputPosition;
216 while( c < max_size && *s)
221 yyextra->inputPosition += c;
227 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
228 yyextra->code->codify(text);
233 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
236 if (yyextra->searchCtx)
253 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
254 if (yyextra->sourceFileDef && yyextra->lineNumbers)
256 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
260 yyextra->currentDefinition = d;
261 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
263 yyextra->classScope = d->
name();
265 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
266 if (yyextra->currentMemberDef)
268 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
269 yyextra->currentMemberDef->getOutputFileBase(),
270 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
271 !yyextra->includeCodeFragment);
279 !yyextra->includeCodeFragment);
286 !yyextra->includeCodeFragment);
290 yyextra->code->startCodeLine(yyextra->yyLineNr);
291 yyextra->insideCodeLine =
true;
293 if (yyextra->currentFontClass)
295 yyextra->code->startFontClass(yyextra->currentFontClass);
301 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
302 if (yyextra->currentFontClass)
304 yyextra->code->endFontClass();
305 yyextra->currentFontClass=0;
311 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
313 yyextra->code->endCodeLine();
314 yyextra->insideCodeLine =
false;
319 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
320 const char *fc = yyextra->currentFontClass;
321 if (yyextra->insideCodeLine)
325 if (yyextra->yyLineNr<yyextra->inputLines)
327 yyextra->currentFontClass = fc;
334 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
335 const char *p=text,*sp=p;
341 while ((c=*p++) && c!=
'\n') { }
345 size_t l =
static_cast<size_t>(p-sp-1);
346 yyextra->code->codify(
QCString(sp,l));
351 yyextra->code->codify(sp);
359 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
361 yyextra->code->startFontClass(s);
362 yyextra->currentFontClass=s;
368 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
369 const char *p=yyextra->inputString;
375 if (c==
'\n') count++;
377 if (p>yyextra->inputString && *(p-1)!=
'\n')
395 xmlcodeYYlex_init_extra(&
p->state,&
p->yyscanner);
404 xmlcodeYYlex_destroy(
p->yyscanner);
409 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
410 yyextra->currentDefinition =
nullptr;
411 yyextra->currentMemberDef =
nullptr;
418 bool stripCodeComments,
423 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
429 yyextra->code = &codeOutIntf;
430 yyextra->inputString = input.
data();
431 yyextra->inputPosition = 0;
432 yyextra->currentFontClass =
nullptr;
433 yyextra->insideCodeLine =
false;
434 yyextra->searchCtx = options.
searchCtx();
437 yyextra->stripCodeComments = stripCodeComments;
438 yyextra->exampleBlock = options.
isExample();
440 yyextra->sourceFileDef = options.
fileDef();
447 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
450 if (yyextra->sourceFileDef)
459 xmlcodeYYrestart(
nullptr, yyscanner );
461 xmlcodeYYlex(yyscanner);
463 if (yyextra->insideCodeLine)
467 if (yyextra->exampleFileDef)
470 yyextra->exampleFileDef.reset();
471 yyextra->sourceFileDef=
nullptr;
476#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 showLineNumbers() const
bool inlineFragment() const
QCString exampleName() const