14%option never-interactive
15%option prefix="sqlcodeYY"
19%option extra-type="struct sqlcodeYY_state *"
23#define YY_TYPEDEF_YY_SCANNER_T
46#define YY_NEVER_INTERACTIVE 1
48#define YY_NO_UNISTD_H 1
87#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
90static 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)
Web server based search engine.
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.
97keywords1 ("ADD"|"ALL"|"ALLOCATE"|"ALTER"|"AND"|"ANY"|"ARE"|"AS"|"ASENSITIVE"|"ASYMMETRIC"|"AT"|"ATOMIC"|"AUTHORIZATION"|"BETWEEN"|"BOTH"|"BY"|"CALL"|"CALLED"|"CASCADED"|"CAST")
98keywords2 ("CHECK"|"CLOSE"|"COLLATE"|"COLUMN"|"COMMIT"|"CONNECT"|"CONSTRAINT"|"CONTINUE"|"CORRESPONDING"|"CREATE"|"CROSS"|"CUBE"|"CURRENT"|"CURRENT_DATE"|"CURRENT_DEFAULT_TRANSFORM_GROUP")
99keywords3 ("CURRENT_PATH"|"CURRENT_ROLE"|"CURRENT_TIME"|"CURRENT_TIMESTAMP"|"CURRENT_TRANSFORM_GROUP_FOR_TYPE"|"CURRENT_USER")
100keywords4 ("CURSOR"|"CYCLE"|"DAY"|"DEALLOCATE"|"DECLARE"|"DEFAULT"|"DELETE"|"DEREF"|"DESCRIBE"|"DETERMINISTIC"|"DISCONNECT"|"DISTINCT"|"DROP"|"DYNAMIC")
101keywords5 ("EACH"|"ELEMENT"|"END-EXEC"|"ESCAPE"|"EXCEPT"|"EXEC"|"EXECUTE"|"EXISTS"|"EXTERNAL"|"FETCH"|"FILTER"|"FOR"|"FOREIGN"|"FREE"|"FROM"|"FULL"|"FUNCTION")
102keywords6 ("GET"|"GLOBAL"|"GRANT"|"GROUP"|"GROUPING"|"HAVING"|"HOLD"|"HOUR"|"IDENTITY"|"IMMEDIATE"|"IN"|"INDICATOR"|"INNER"|"INOUT"|"INPUT"|"INSENSITIVE"|"INSERT"|"INTERSECT")
103keywords7 ("INTERVAL"|"INTO"|"IS"|"ISOLATION"|"JOIN"|"LANGUAGE"|"LARGE"|"LATERAL"|"LEADING"|"LEFT"|"LIKE"|"LOCAL"|"LOCALTIME"|"LOCALTIMESTAMP"|"MATCH"|"MEMBER"|"MERGE"|"METHOD"|"MINUTE")
104keywords8 ("MODIFIES"|"MODULE"|"MONTH"|"MULTISET"|"NATIONAL"|"NATURAL"|"NEW"|"NO"|"NONE"|"NOT"|"OF"|"OLD"|"ON"|"ONLY"|"OPEN"|"OR"|"ORDER"|"OUT"|"OUTER"|"OUTPUT")
105keywords9 ("OVER"|"OVERLAPS"|"PARAMETER"|"PARTITION"|"PRECISION"|"PREPARE"|"PRIMARY"|"PROCEDURE"|"RANGE"|"READS"|"RECURSIVE"|"REF"|"REFERENCES"|"REFERENCING"|"REGR_AVGX"|"REGR_AVGY")
106keywords10 ("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")
107keywords11 ("SCROLL"|"SEARCH"|"SECOND"|"SELECT"|"SENSITIVE"|"SESSION_USER"|"SET"|"SIMILAR"|"SOME"|"SPECIFIC"|"SPECIFICTYPE"|"SQL"|"SQLEXCEPTION"|"SQLSTATE"|"SQLWARNING"|"START"|"STATIC")
108keywords12 ("SUBMULTISET"|"SYMMETRIC"|"SYSTEM"|"SYSTEM_USER"|"TABLE"|"THEN"|"TIMEZONE_HOUR"|"TIMEZONE_MINUTE"|"TO"|"TRAILING"|"TRANSLATION"|"TREAT"|"TRIGGER"|"UESCAPE"|"UNION")
109keywords13 ("UNIQUE"|"UNNEST"|"UPDATE"|"UPPER"|"USER"|"USING"|"VALUE"|"VALUES"|"VAR_POP"|"VAR_SAMP"|"VARYING"|"WHEN"|"WHENEVER"|"WHERE"|"WIDTH_BUCKET"|"WINDOW"|"WITH"|"WITHIN"|"WITHOUT"|"YEAR")
112keyword (?i:{keywords1}|{keywords2}|{keywords3}|{keywords4}|{keywords5}|{keywords6}|{keywords7}|{keywords8}|{keywords9}|{keywords10}|{keywords11}|{keywords12}|{keywords13})
114typekeyword (?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")
116flowkeyword (?i:"CASE"|"IF"|"ELSE"|"BEGIN"|"END"|"WHILE")
118literalkeyword (?i:"false"|"true"|"NULL"|"UNKNOWN")
119stringliteral (\"[^\"]*\")|('[^']*')
121literals ({literalkeyword}|{stringliteral}|{number})
184<COMMENT>{commentclose} {
210 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
213 if (yyextra->searchCtx)
230 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
231 if (yyextra->sourceFileDef)
233 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
237 yyextra->currentDefinition = d;
238 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
239 yyextra->classScope = d->
name();
241 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
242 if (yyextra->currentMemberDef)
244 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
245 yyextra->currentMemberDef->getOutputFileBase(),
246 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
247 !yyextra->includeCodeFragment);
255 !yyextra->includeCodeFragment);
262 !yyextra->includeCodeFragment);
266 yyextra->code->startCodeLine(yyextra->yyLineNr);
267 yyextra->insideCodeLine=
true;
269 if (yyextra->currentFontClass)
271 yyextra->code->startFontClass(yyextra->currentFontClass);
277 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
278 if (yyextra->currentFontClass)
280 yyextra->code->endFontClass();
281 yyextra->currentFontClass=0;
287 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
289 yyextra->code->endCodeLine();
290 yyextra->insideCodeLine=
false;
295 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
296 const char *fc = yyextra->currentFontClass;
297 if (yyextra->insideCodeLine)
301 if (yyextra->yyLineNr<yyextra->inputLines)
303 yyextra->currentFontClass = fc;
310 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
311 const char *p=text,*sp=p;
317 while ((c=*p++) && c!=
'\n') { }
321 size_t l =
static_cast<size_t>(p-sp-1);
322 yyextra->code->codify(
QCString(sp,l));
327 yyextra->code->codify(sp);
335 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
337 yyextra->code->startFontClass(s);
338 yyextra->currentFontClass=s;
344 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
345 const char *p=yyextra->inputString;
351 if (c==
'\n') count++;
353 if (p>yyextra->inputString && *(p-1)!=
'\n')
363 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
364 int inputPosition = yyextra->inputPosition;
365 const char *s = yyextra->inputString + inputPosition;
367 while( c < max_size && *s )
372 yyextra->inputPosition += c;
387 sqlcodeYYlex_init_extra(&
p->state, &
p->yyscanner);
396 sqlcodeYYlex_destroy(
p->yyscanner);
401 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
402 yyextra->currentDefinition =
nullptr;
403 yyextra->currentMemberDef =
nullptr;
410 bool stripCodeComments,
415 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
421 yyextra->code = &codeOutIntf;
422 yyextra->inputString = input.
data();
423 yyextra->inputPosition = 0;
424 yyextra->currentFontClass =
nullptr;
425 yyextra->insideCodeLine =
false;
426 yyextra->searchCtx = options.
searchCtx();
429 yyextra->stripCodeComments = stripCodeComments;
430 yyextra->exampleBlock = options.
isExample();
432 yyextra->sourceFileDef = options.
fileDef();
438 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
441 if (yyextra->sourceFileDef)
450 sqlcodeYYrestart(
nullptr, yyscanner );
452 sqlcodeYYlex(yyscanner);
454 if (yyextra->insideCodeLine)
458 if (yyextra->exampleFileDef)
461 yyextra->exampleFileDef.reset();
462 yyextra->sourceFileDef=
nullptr;
468#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
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