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
88#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
91static 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.
98keywords1 ("ADD"|"ALL"|"ALLOCATE"|"ALTER"|"AND"|"ANY"|"ARE"|"AS"|"ASENSITIVE"|"ASYMMETRIC"|"AT"|"ATOMIC"|"AUTHORIZATION"|"BETWEEN"|"BOTH"|"BY"|"CALL"|"CALLED"|"CASCADED"|"CAST")
99keywords2 ("CHECK"|"CLOSE"|"COLLATE"|"COLUMN"|"COMMIT"|"CONNECT"|"CONSTRAINT"|"CONTINUE"|"CORRESPONDING"|"CREATE"|"CROSS"|"CUBE"|"CURRENT"|"CURRENT_DATE"|"CURRENT_DEFAULT_TRANSFORM_GROUP")
100keywords3 ("CURRENT_PATH"|"CURRENT_ROLE"|"CURRENT_TIME"|"CURRENT_TIMESTAMP"|"CURRENT_TRANSFORM_GROUP_FOR_TYPE"|"CURRENT_USER")
101keywords4 ("CURSOR"|"CYCLE"|"DAY"|"DEALLOCATE"|"DECLARE"|"DEFAULT"|"DELETE"|"DEREF"|"DESCRIBE"|"DETERMINISTIC"|"DISCONNECT"|"DISTINCT"|"DROP"|"DYNAMIC")
102keywords5 ("EACH"|"ELEMENT"|"END-EXEC"|"ESCAPE"|"EXCEPT"|"EXEC"|"EXECUTE"|"EXISTS"|"EXTERNAL"|"FETCH"|"FILTER"|"FOR"|"FOREIGN"|"FREE"|"FROM"|"FULL"|"FUNCTION")
103keywords6 ("GET"|"GLOBAL"|"GRANT"|"GROUP"|"GROUPING"|"HAVING"|"HOLD"|"HOUR"|"IDENTITY"|"IMMEDIATE"|"IN"|"INDICATOR"|"INNER"|"INOUT"|"INPUT"|"INSENSITIVE"|"INSERT"|"INTERSECT")
104keywords7 ("INTERVAL"|"INTO"|"IS"|"ISOLATION"|"JOIN"|"LANGUAGE"|"LARGE"|"LATERAL"|"LEADING"|"LEFT"|"LIKE"|"LOCAL"|"LOCALTIME"|"LOCALTIMESTAMP"|"MATCH"|"MEMBER"|"MERGE"|"METHOD"|"MINUTE")
105keywords8 ("MODIFIES"|"MODULE"|"MONTH"|"MULTISET"|"NATIONAL"|"NATURAL"|"NEW"|"NO"|"NONE"|"NOT"|"OF"|"OLD"|"ON"|"ONLY"|"OPEN"|"OR"|"ORDER"|"OUT"|"OUTER"|"OUTPUT")
106keywords9 ("OVER"|"OVERLAPS"|"PARAMETER"|"PARTITION"|"PRECISION"|"PREPARE"|"PRIMARY"|"PROCEDURE"|"RANGE"|"READS"|"RECURSIVE"|"REF"|"REFERENCES"|"REFERENCING"|"REGR_AVGX"|"REGR_AVGY")
107keywords10 ("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")
108keywords11 ("SCROLL"|"SEARCH"|"SECOND"|"SELECT"|"SENSITIVE"|"SESSION_USER"|"SET"|"SIMILAR"|"SOME"|"SPECIFIC"|"SPECIFICTYPE"|"SQL"|"SQLEXCEPTION"|"SQLSTATE"|"SQLWARNING"|"START"|"STATIC")
109keywords12 ("SUBMULTISET"|"SYMMETRIC"|"SYSTEM"|"SYSTEM_USER"|"TABLE"|"THEN"|"TIMEZONE_HOUR"|"TIMEZONE_MINUTE"|"TO"|"TRAILING"|"TRANSLATION"|"TREAT"|"TRIGGER"|"UESCAPE"|"UNION")
110keywords13 ("UNIQUE"|"UNNEST"|"UPDATE"|"UPPER"|"USER"|"USING"|"VALUE"|"VALUES"|"VAR_POP"|"VAR_SAMP"|"VARYING"|"WHEN"|"WHENEVER"|"WHERE"|"WIDTH_BUCKET"|"WINDOW"|"WITH"|"WITHIN"|"WITHOUT"|"YEAR")
113keyword (?i:{keywords1}|{keywords2}|{keywords3}|{keywords4}|{keywords5}|{keywords6}|{keywords7}|{keywords8}|{keywords9}|{keywords10}|{keywords11}|{keywords12}|{keywords13})
115typekeyword (?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")
117flowkeyword (?i:"CASE"|"IF"|"ELSE"|"BEGIN"|"END"|"WHILE")
119literalkeyword (?i:"false"|"true"|"NULL"|"UNKNOWN")
120stringliteral (\"[^\"]*\")|('[^']*')
122literals ({literalkeyword}|{stringliteral}|{number})
185<COMMENT>{commentclose} {
211 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
214 if (yyextra->searchCtx)
231 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
232 if (yyextra->sourceFileDef && yyextra->lineNumbers)
234 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
238 yyextra->currentDefinition = d;
239 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
240 yyextra->classScope = d->
name();
242 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
243 if (yyextra->currentMemberDef)
245 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
246 yyextra->currentMemberDef->getOutputFileBase(),
247 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
248 !yyextra->includeCodeFragment);
256 !yyextra->includeCodeFragment);
263 !yyextra->includeCodeFragment);
267 yyextra->code->startCodeLine(yyextra->yyLineNr);
268 yyextra->insideCodeLine=
true;
270 if (yyextra->currentFontClass)
272 yyextra->code->startFontClass(yyextra->currentFontClass);
278 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
279 if (yyextra->currentFontClass)
281 yyextra->code->endFontClass();
282 yyextra->currentFontClass=0;
288 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
290 yyextra->code->endCodeLine();
291 yyextra->insideCodeLine=
false;
296 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
297 const char *fc = yyextra->currentFontClass;
298 if (yyextra->insideCodeLine)
302 if (yyextra->yyLineNr<yyextra->inputLines)
304 yyextra->currentFontClass = fc;
311 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
312 const char *p=text,*sp=p;
318 while ((c=*p++) && c!=
'\n') { }
322 size_t l =
static_cast<size_t>(p-sp-1);
323 yyextra->code->codify(
QCString(sp,l));
328 yyextra->code->codify(sp);
336 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
338 yyextra->code->startFontClass(s);
339 yyextra->currentFontClass=s;
345 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
346 const char *p=yyextra->inputString;
352 if (c==
'\n') count++;
354 if (p>yyextra->inputString && *(p-1)!=
'\n')
364 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
365 int inputPosition = yyextra->inputPosition;
366 const char *s = yyextra->inputString + inputPosition;
368 while( c < max_size && *s )
373 yyextra->inputPosition += c;
388 sqlcodeYYlex_init_extra(&
p->state, &
p->yyscanner);
397 sqlcodeYYlex_destroy(
p->yyscanner);
402 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
403 yyextra->currentDefinition =
nullptr;
404 yyextra->currentMemberDef =
nullptr;
411 bool stripCodeComments,
416 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
422 yyextra->code = &codeOutIntf;
423 yyextra->inputString = input.
data();
424 yyextra->inputPosition = 0;
425 yyextra->currentFontClass =
nullptr;
426 yyextra->insideCodeLine =
false;
427 yyextra->searchCtx = options.
searchCtx();
430 yyextra->stripCodeComments = stripCodeComments;
431 yyextra->exampleBlock = options.
isExample();
433 yyextra->sourceFileDef = options.
fileDef();
440 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
443 if (yyextra->sourceFileDef)
452 sqlcodeYYrestart(
nullptr, yyscanner );
454 sqlcodeYYlex(yyscanner);
456 if (yyextra->insideCodeLine)
460 if (yyextra->exampleFileDef)
463 yyextra->exampleFileDef.reset();
464 yyextra->sourceFileDef=
nullptr;
470#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 showLineNumbers() const
bool inlineFragment() const
QCString exampleName() const