16%option never-interactive
17%option prefix="sqlcodeYY"
21%option extra-type="struct sqlcodeYY_state *"
25#define YY_TYPEDEF_YY_SCANNER_T
48#define YY_NEVER_INTERACTIVE 1
50#define YY_NO_UNISTD_H 1
54 OutputCodeList *
code =
nullptr;
89#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
This is an alternative implementation of QCString.
Web server based search engine.
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 endFontClass(yyscan_t yyscanner)
const char * currentFontClass
const Definition * searchCtx
const char * inputString
the code fragment as text
const MemberDef * currentMemberDef
int yyLineNr
current line number
int inputLines
number of line in the code fragment
const FileDef * sourceFileDef
std::unique_ptr< FileDef > exampleFileDef
int inputPosition
read offset during parsing
const Definition * currentDefinition
A bunch of utility functions.
99keywords1 ("ADD"|"ALL"|"ALLOCATE"|"ALTER"|"AND"|"ANY"|"ARE"|"AS"|"ASENSITIVE"|"ASYMMETRIC"|"AT"|"ATOMIC"|"AUTHORIZATION"|"BETWEEN"|"BOTH"|"BY"|"CALL"|"CALLED"|"CASCADED"|"CAST")
100keywords2 ("CHECK"|"CLOSE"|"COLLATE"|"COLUMN"|"COMMIT"|"CONNECT"|"CONSTRAINT"|"CONTINUE"|"CORRESPONDING"|"CREATE"|"CROSS"|"CUBE"|"CURRENT"|"CURRENT_DATE"|"CURRENT_DEFAULT_TRANSFORM_GROUP")
101keywords3 ("CURRENT_PATH"|"CURRENT_ROLE"|"CURRENT_TIME"|"CURRENT_TIMESTAMP"|"CURRENT_TRANSFORM_GROUP_FOR_TYPE"|"CURRENT_USER")
102keywords4 ("CURSOR"|"CYCLE"|"DAY"|"DEALLOCATE"|"DECLARE"|"DEFAULT"|"DELETE"|"DEREF"|"DESCRIBE"|"DETERMINISTIC"|"DISCONNECT"|"DISTINCT"|"DROP"|"DYNAMIC")
103keywords5 ("EACH"|"ELEMENT"|"END-EXEC"|"ESCAPE"|"EXCEPT"|"EXEC"|"EXECUTE"|"EXISTS"|"EXTERNAL"|"FETCH"|"FILTER"|"FOR"|"FOREIGN"|"FREE"|"FROM"|"FULL"|"FUNCTION")
104keywords6 ("GET"|"GLOBAL"|"GRANT"|"GROUP"|"GROUPING"|"HAVING"|"HOLD"|"HOUR"|"IDENTITY"|"IMMEDIATE"|"IN"|"INDICATOR"|"INNER"|"INOUT"|"INPUT"|"INSENSITIVE"|"INSERT"|"INTERSECT")
105keywords7 ("INTERVAL"|"INTO"|"IS"|"ISOLATION"|"JOIN"|"LANGUAGE"|"LARGE"|"LATERAL"|"LEADING"|"LEFT"|"LIKE"|"LOCAL"|"LOCALTIME"|"LOCALTIMESTAMP"|"MATCH"|"MEMBER"|"MERGE"|"METHOD"|"MINUTE")
106keywords8 ("MODIFIES"|"MODULE"|"MONTH"|"MULTISET"|"NATIONAL"|"NATURAL"|"NEW"|"NO"|"NONE"|"NOT"|"OF"|"OLD"|"ON"|"ONLY"|"OPEN"|"OR"|"ORDER"|"OUT"|"OUTER"|"OUTPUT")
107keywords9 ("OVER"|"OVERLAPS"|"PARAMETER"|"PARTITION"|"PRECISION"|"PREPARE"|"PRIMARY"|"PROCEDURE"|"RANGE"|"READS"|"RECURSIVE"|"REF"|"REFERENCES"|"REFERENCING"|"REGR_AVGX"|"REGR_AVGY")
108keywords10 ("REGR_COUNT"|"REGR_INTERCEPT"|"REGR_R2"|"REGR_SLOPE"|"REGR_SXX"|"REGR_SXY"|"REGR_SYY"|"RELEASE"|"RESULT"|"RETURN"|"RETURNS"|"REVOKE"|"RIGHT"|"ROLLBACK"|"ROLLUP"|"ROW"|"ROWS"|"SAVEPOINT")
109keywords11 ("SCROLL"|"SEARCH"|"SECOND"|"SELECT"|"SENSITIVE"|"SESSION_USER"|"SET"|"SIMILAR"|"SOME"|"SPECIFIC"|"SPECIFICTYPE"|"SQL"|"SQLEXCEPTION"|"SQLSTATE"|"SQLWARNING"|"START"|"STATIC")
110keywords12 ("SUBMULTISET"|"SYMMETRIC"|"SYSTEM"|"SYSTEM_USER"|"TABLE"|"THEN"|"TIMEZONE_HOUR"|"TIMEZONE_MINUTE"|"TO"|"TRAILING"|"TRANSLATION"|"TREAT"|"TRIGGER"|"UESCAPE"|"UNION")
111keywords13 ("UNIQUE"|"UNNEST"|"UPDATE"|"UPPER"|"USER"|"USING"|"VALUE"|"VALUES"|"VAR_POP"|"VAR_SAMP"|"VARYING"|"WHEN"|"WHENEVER"|"WHERE"|"WIDTH_BUCKET"|"WINDOW"|"WITH"|"WITHIN"|"WITHOUT"|"YEAR")
114keyword (?i:{keywords1}|{keywords2}|{keywords3}|{keywords4}|{keywords5}|{keywords6}|{keywords7}|{keywords8}|{keywords9}|{keywords10}|{keywords11}|{keywords12}|{keywords13})
116typekeyword (?i:"ARRAY"|"BIGINT"|"BINARY"|"BLOB"|"BOOLEAN"|"CHAR"|"CHARACTER"|"CLOB"|"DATE"|"DEC"|"DECIMAL"|"DOUBLE"|"FLOAT"|"INT"|"INTEGER"|"NCHAR"|"NCLOB"|"NUMERIC"|"NVARCHAR"|"REAL"|"SMALLINT"|"TIME"|"TIMESTAMP"|"VARCHAR")
118flowkeyword (?i:"CASE"|"IF"|"ELSE"|"BEGIN"|"END"|"WHILE")
120literalkeyword (?i:"false"|"true"|"NULL"|"UNKNOWN")
121stringliteral (\"[^\"]*\")|('[^']*')
123literals ({literalkeyword}|{stringliteral}|{number})
static void codifyLines(yyscan_t yyscanner, const QCString &text)
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
186<COMMENT>{commentclose} {
212 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
215 if (yyextra->searchCtx)
232 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
233 if (yyextra->sourceFileDef)
235 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
239 yyextra->currentDefinition = d;
240 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
241 yyextra->classScope = d->
name();
243 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
244 if (yyextra->currentMemberDef)
246 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
247 yyextra->currentMemberDef->getOutputFileBase(),
248 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
249 !yyextra->includeCodeFragment);
257 !yyextra->includeCodeFragment);
264 !yyextra->includeCodeFragment);
268 yyextra->code->startCodeLine(yyextra->yyLineNr);
269 yyextra->insideCodeLine=
true;
271 if (yyextra->currentFontClass)
273 yyextra->code->startFontClass(yyextra->currentFontClass);
279 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
280 if (yyextra->currentFontClass)
282 yyextra->code->endFontClass();
283 yyextra->currentFontClass=0;
289 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
291 yyextra->code->endCodeLine();
292 yyextra->insideCodeLine=
false;
297 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
298 const char *fc = yyextra->currentFontClass;
299 if (yyextra->insideCodeLine)
303 if (yyextra->yyLineNr<yyextra->inputLines)
305 yyextra->currentFontClass = fc;
312 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
313 const char *p=text,*sp=p;
319 while ((c=*p++) && c!=
'\n') { }
323 size_t l =
static_cast<size_t>(p-sp-1);
324 std::string tmp(sp,l);
325 yyextra->code->codify(tmp.c_str());
330 yyextra->code->codify(sp);
338 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
340 yyextra->code->startFontClass(s);
341 yyextra->currentFontClass=s;
347 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
348 const char *p=yyextra->inputString;
354 if (c==
'\n') count++;
356 if (p>yyextra->inputString && *(p-1)!=
'\n')
366 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
367 int inputPosition = yyextra->inputPosition;
368 const char *s = yyextra->inputString + inputPosition;
370 while( c < max_size && *s )
375 yyextra->inputPosition += c;
390 sqlcodeYYlex_init_extra(&
p->state, &
p->yyscanner);
399 sqlcodeYYlex_destroy(
p->yyscanner);
404 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
405 yyextra->currentDefinition =
nullptr;
406 yyextra->currentMemberDef =
nullptr;
413 bool stripCodeComments,
427 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
432 yyextra->fileName = fileDef ? fileDef->
fileName():
"";
434 yyextra->code = &codeOutIntf;
435 yyextra->inputString = input.
data();
436 yyextra->inputPosition = 0;
437 yyextra->currentFontClass =
nullptr;
438 yyextra->insideCodeLine =
false;
439 yyextra->searchCtx=searchCtx;
442 yyextra->yyLineNr = startLine;
444 yyextra->yyLineNr = 1;
447 yyextra->inputLines = endLine+1;
449 yyextra->inputLines = yyextra->yyLineNr +
countLines(yyscanner) - 1;
451 yyextra->stripCodeComments = stripCodeComments;
452 yyextra->exampleBlock = isExampleBlock;
453 yyextra->exampleName = exampleName;
454 yyextra->sourceFileDef = fileDef;
456 if (isExampleBlock && fileDef==0)
459 yyextra->exampleFileDef =
createFileDef(QCString(),!exampleName.
isEmpty() ? exampleName : QCString(
"generated"));
460 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
463 if (yyextra->sourceFileDef)
468 yyextra->includeCodeFragment = inlineFragment;
472 sqlcodeYYrestart(
nullptr, yyscanner );
474 sqlcodeYYlex(yyscanner);
476 if (yyextra->insideCodeLine)
480 if (yyextra->exampleFileDef)
483 yyextra->exampleFileDef.reset();
484 yyextra->sourceFileDef=
nullptr;
490#include "sqlcode.l.h"
static bool isFlagSet(const DebugMask mask)
The common base class of all entity definitions found in the sources.
virtual bool isLinkableInProject() const =0
virtual QCString getReference() const =0
virtual QCString getOutputFileBase() const =0
virtual const QCString & name() const =0
static SearchIndexIntf searchIndex
A model of a file symbol.
virtual QCString fileName() const =0
A model of a class/file/namespace member symbol.
Class representing a list of different code generators.
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
void resetCodeParserState() override
Resets the state of the code parser.
void parseCode(OutputCodeList &codeOutIntf, const QCString &scopeName, const QCString &input, SrcLangExt, bool stripCodeComments, bool isExampleBlock, const QCString &exampleName=QCString(), const FileDef *fileDef=nullptr, int startLine=-1, int endLine=-1, bool inlineFragment=FALSE, const MemberDef *memberDef=nullptr, bool showLineNumbers=TRUE, const Definition *searchCtx=nullptr, bool collectXRefs=TRUE) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
~SQLCodeParser() override
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)
SrcLangExt
Language as given by extension.