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
90#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.
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.
100keywords1 ("ADD"|"ALL"|"ALLOCATE"|"ALTER"|"AND"|"ANY"|"ARE"|"AS"|"ASENSITIVE"|"ASYMMETRIC"|"AT"|"ATOMIC"|"AUTHORIZATION"|"BETWEEN"|"BOTH"|"BY"|"CALL"|"CALLED"|"CASCADED"|"CAST")
101keywords2 ("CHECK"|"CLOSE"|"COLLATE"|"COLUMN"|"COMMIT"|"CONNECT"|"CONSTRAINT"|"CONTINUE"|"CORRESPONDING"|"CREATE"|"CROSS"|"CUBE"|"CURRENT"|"CURRENT_DATE"|"CURRENT_DEFAULT_TRANSFORM_GROUP")
102keywords3 ("CURRENT_PATH"|"CURRENT_ROLE"|"CURRENT_TIME"|"CURRENT_TIMESTAMP"|"CURRENT_TRANSFORM_GROUP_FOR_TYPE"|"CURRENT_USER")
103keywords4 ("CURSOR"|"CYCLE"|"DAY"|"DEALLOCATE"|"DECLARE"|"DEFAULT"|"DELETE"|"DEREF"|"DESCRIBE"|"DETERMINISTIC"|"DISCONNECT"|"DISTINCT"|"DROP"|"DYNAMIC")
104keywords5 ("EACH"|"ELEMENT"|"END-EXEC"|"ESCAPE"|"EXCEPT"|"EXEC"|"EXECUTE"|"EXISTS"|"EXTERNAL"|"FETCH"|"FILTER"|"FOR"|"FOREIGN"|"FREE"|"FROM"|"FULL"|"FUNCTION")
105keywords6 ("GET"|"GLOBAL"|"GRANT"|"GROUP"|"GROUPING"|"HAVING"|"HOLD"|"HOUR"|"IDENTITY"|"IMMEDIATE"|"IN"|"INDICATOR"|"INNER"|"INOUT"|"INPUT"|"INSENSITIVE"|"INSERT"|"INTERSECT")
106keywords7 ("INTERVAL"|"INTO"|"IS"|"ISOLATION"|"JOIN"|"LANGUAGE"|"LARGE"|"LATERAL"|"LEADING"|"LEFT"|"LIKE"|"LOCAL"|"LOCALTIME"|"LOCALTIMESTAMP"|"MATCH"|"MEMBER"|"MERGE"|"METHOD"|"MINUTE")
107keywords8 ("MODIFIES"|"MODULE"|"MONTH"|"MULTISET"|"NATIONAL"|"NATURAL"|"NEW"|"NO"|"NONE"|"NOT"|"OF"|"OLD"|"ON"|"ONLY"|"OPEN"|"OR"|"ORDER"|"OUT"|"OUTER"|"OUTPUT")
108keywords9 ("OVER"|"OVERLAPS"|"PARAMETER"|"PARTITION"|"PRECISION"|"PREPARE"|"PRIMARY"|"PROCEDURE"|"RANGE"|"READS"|"RECURSIVE"|"REF"|"REFERENCES"|"REFERENCING"|"REGR_AVGX"|"REGR_AVGY")
109keywords10 ("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")
110keywords11 ("SCROLL"|"SEARCH"|"SECOND"|"SELECT"|"SENSITIVE"|"SESSION_USER"|"SET"|"SIMILAR"|"SOME"|"SPECIFIC"|"SPECIFICTYPE"|"SQL"|"SQLEXCEPTION"|"SQLSTATE"|"SQLWARNING"|"START"|"STATIC")
111keywords12 ("SUBMULTISET"|"SYMMETRIC"|"SYSTEM"|"SYSTEM_USER"|"TABLE"|"THEN"|"TIMEZONE_HOUR"|"TIMEZONE_MINUTE"|"TO"|"TRAILING"|"TRANSLATION"|"TREAT"|"TRIGGER"|"UESCAPE"|"UNION")
112keywords13 ("UNIQUE"|"UNNEST"|"UPDATE"|"UPPER"|"USER"|"USING"|"VALUE"|"VALUES"|"VAR_POP"|"VAR_SAMP"|"VARYING"|"WHEN"|"WHENEVER"|"WHERE"|"WIDTH_BUCKET"|"WINDOW"|"WITH"|"WITHIN"|"WITHOUT"|"YEAR")
115keyword (?i:{keywords1}|{keywords2}|{keywords3}|{keywords4}|{keywords5}|{keywords6}|{keywords7}|{keywords8}|{keywords9}|{keywords10}|{keywords11}|{keywords12}|{keywords13})
117typekeyword (?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")
119flowkeyword (?i:"CASE"|"IF"|"ELSE"|"BEGIN"|"END"|"WHILE")
121literalkeyword (?i:"false"|"true"|"NULL"|"UNKNOWN")
122stringliteral (\"[^\"]*\")|('[^']*')
124literals ({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)
187<COMMENT>{commentclose} {
213 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
216 if (yyextra->searchCtx)
233 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
234 if (yyextra->sourceFileDef && yyextra->lineNumbers)
236 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
240 yyextra->currentDefinition = d;
241 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
242 yyextra->classScope = d->
name();
244 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
245 if (yyextra->currentMemberDef)
247 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
248 yyextra->currentMemberDef->getOutputFileBase(),
249 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
250 !yyextra->includeCodeFragment);
258 !yyextra->includeCodeFragment);
265 !yyextra->includeCodeFragment);
269 yyextra->code->startCodeLine(yyextra->yyLineNr);
270 yyextra->insideCodeLine=
true;
272 if (yyextra->currentFontClass)
274 yyextra->code->startFontClass(yyextra->currentFontClass);
280 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
281 if (yyextra->currentFontClass)
283 yyextra->code->endFontClass();
284 yyextra->currentFontClass=0;
290 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
292 yyextra->code->endCodeLine();
293 yyextra->insideCodeLine=
false;
298 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
299 const char *fc = yyextra->currentFontClass;
300 if (yyextra->insideCodeLine)
304 if (yyextra->yyLineNr<yyextra->inputLines)
306 yyextra->currentFontClass = fc;
313 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
314 const char *p=text,*sp=p;
320 while ((c=*p++) && c!=
'\n') { }
324 size_t l =
static_cast<size_t>(p-sp-1);
325 yyextra->code->codify(
QCString(sp,l));
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,
418 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
424 yyextra->code = &codeOutIntf;
425 yyextra->inputString = input.
data();
426 yyextra->inputPosition = 0;
427 yyextra->currentFontClass =
nullptr;
428 yyextra->insideCodeLine =
false;
429 yyextra->searchCtx = options.
searchCtx();
432 yyextra->stripCodeComments = stripCodeComments;
433 yyextra->exampleBlock = options.
isExample();
435 yyextra->sourceFileDef = options.
fileDef();
442 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
445 if (yyextra->sourceFileDef)
454 sqlcodeYYrestart(
nullptr, yyscanner );
456 sqlcodeYYlex(yyscanner);
458 if (yyextra->insideCodeLine)
462 if (yyextra->exampleFileDef)
465 yyextra->exampleFileDef.reset();
466 yyextra->sourceFileDef=
nullptr;
472#include "sqlcode.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
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.
~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)
Options to configure the code parser.
const Definition * searchCtx() const
const FileDef * fileDef() const
bool showLineNumbers() const
bool inlineFragment() const
QCString exampleName() const