16%option never-interactive
17%option prefix="sqlcodeYY"
21%option extra-type="struct sqlcodeYY_state *"
25#define YY_TYPEDEF_YY_SCANNER_T
26#define yyguts_t sqlcodeYYguts_t
49#define YY_NEVER_INTERACTIVE 1
51#define YY_NO_UNISTD_H 1
91#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
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.
Web server based search engine.
static void endCodeLine(yyscan_t yyscanner)
static void nextCodeLine(yyscan_t yyscanner)
static void startCodeLine(yyscan_t yyscanner)
static void setCurrentDoc(yyscan_t yyscanner, const DString &anchor)
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 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.
100idchar [A-Za-z0-9\-_]+
101keywords1 ("ADD"|"ALL"|"ALLOCATE"|"ALTER"|"AND"|"ANY"|"ARE"|"AS"|"ASENSITIVE"|"ASYMMETRIC"|"AT"|"ATOMIC"|"AUTHORIZATION"|"BETWEEN"|"BOTH"|"BY"|"CALL"|"CALLED"|"CASCADED"|"CAST")
102keywords2 ("CHECK"|"CLOSE"|"COLLATE"|"COLUMN"|"COMMIT"|"CONNECT"|"CONSTRAINT"|"CONTINUE"|"CORRESPONDING"|"CREATE"|"CROSS"|"CUBE"|"CURRENT"|"CURRENT_DATE"|"CURRENT_DEFAULT_TRANSFORM_GROUP")
103keywords3 ("CURRENT_PATH"|"CURRENT_ROLE"|"CURRENT_TIME"|"CURRENT_TIMESTAMP"|"CURRENT_TRANSFORM_GROUP_FOR_TYPE"|"CURRENT_USER")
104keywords4 ("CURSOR"|"CYCLE"|"DAY"|"DEALLOCATE"|"DECLARE"|"DEFAULT"|"DELETE"|"DEREF"|"DESCRIBE"|"DETERMINISTIC"|"DISCONNECT"|"DISTINCT"|"DROP"|"DYNAMIC")
105keywords5 ("EACH"|"ELEMENT"|"END-EXEC"|"ESCAPE"|"EXCEPT"|"EXEC"|"EXECUTE"|"EXISTS"|"EXTERNAL"|"FETCH"|"FILTER"|"FOR"|"FOREIGN"|"FREE"|"FROM"|"FULL"|"FUNCTION")
106keywords6 ("GET"|"GLOBAL"|"GRANT"|"GROUP"|"GROUPING"|"HAVING"|"HOLD"|"HOUR"|"IDENTITY"|"IMMEDIATE"|"IN"|"INDICATOR"|"INNER"|"INOUT"|"INPUT"|"INSENSITIVE"|"INSERT"|"INTERSECT")
107keywords7 ("INTERVAL"|"INTO"|"IS"|"ISOLATION"|"JOIN"|"LANGUAGE"|"LARGE"|"LATERAL"|"LEADING"|"LEFT"|"LIKE"|"LOCAL"|"LOCALTIME"|"LOCALTIMESTAMP"|"MATCH"|"MEMBER"|"MERGE"|"METHOD"|"MINUTE")
108keywords8 ("MODIFIES"|"MODULE"|"MONTH"|"MULTISET"|"NATIONAL"|"NATURAL"|"NEW"|"NO"|"NONE"|"NOT"|"OF"|"OLD"|"ON"|"ONLY"|"OPEN"|"OR"|"ORDER"|"OUT"|"OUTER"|"OUTPUT")
109keywords9 ("OVER"|"OVERLAPS"|"PARAMETER"|"PARTITION"|"PRECISION"|"PREPARE"|"PRIMARY"|"PROCEDURE"|"RANGE"|"READS"|"RECURSIVE"|"REF"|"REFERENCES"|"REFERENCING"|"REGR_AVGX"|"REGR_AVGY")
110keywords10 ("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")
111keywords11 ("SCROLL"|"SEARCH"|"SECOND"|"SELECT"|"SENSITIVE"|"SESSION_USER"|"SET"|"SIMILAR"|"SOME"|"SPECIFIC"|"SPECIFICTYPE"|"SQL"|"SQLEXCEPTION"|"SQLSTATE"|"SQLWARNING"|"START"|"STATIC")
112keywords12 ("SUBMULTISET"|"SYMMETRIC"|"SYSTEM"|"SYSTEM_USER"|"TABLE"|"THEN"|"TIMEZONE_HOUR"|"TIMEZONE_MINUTE"|"TO"|"TRAILING"|"TRANSLATION"|"TREAT"|"TRIGGER"|"UESCAPE"|"UNION")
113keywords13 ("UNIQUE"|"UNNEST"|"UPDATE"|"UPPER"|"USER"|"USING"|"VALUE"|"VALUES"|"VAR_POP"|"VAR_SAMP"|"VARYING"|"WHEN"|"WHENEVER"|"WHERE"|"WIDTH_BUCKET"|"WINDOW"|"WITH"|"WITHIN"|"WITHOUT"|"YEAR")
116keyword (?i:{keywords1}|{keywords2}|{keywords3}|{keywords4}|{keywords5}|{keywords6}|{keywords7}|{keywords8}|{keywords9}|{keywords10}|{keywords11}|{keywords12}|{keywords13})
118typekeyword (?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")
120flowkeyword (?i:"CASE"|"IF"|"ELSE"|"BEGIN"|"END"|"WHILE")
122literalkeyword (?i:"false"|"true"|"NULL"|"UNKNOWN")
123stringliteral (\"[^\"]*\")|('[^']*')
125literals ({literalkeyword}|{stringliteral}|{number})
188<COMMENT>{commentclose} {
217 if (yyextra->searchCtx)
235 if (yyextra->sourceFileDef && yyextra->lineNumbers)
237 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
241 yyextra->currentDefinition = d;
242 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
243 yyextra->classScope = d->
name();
245 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
246 if (yyextra->currentMemberDef)
248 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
249 yyextra->currentMemberDef->getOutputFileBase(),
250 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
251 !yyextra->includeCodeFragment);
259 !yyextra->includeCodeFragment);
266 !yyextra->includeCodeFragment);
270 yyextra->code->startCodeLine(yyextra->yyLineNr);
271 yyextra->insideCodeLine=
true;
273 if (yyextra->currentFontClass)
275 yyextra->code->startFontClass(yyextra->currentFontClass);
282 if (yyextra->currentFontClass)
284 yyextra->code->endFontClass();
285 yyextra->currentFontClass=0;
293 yyextra->code->endCodeLine();
294 yyextra->insideCodeLine=
false;
300 const char *fc = yyextra->currentFontClass;
301 if (yyextra->insideCodeLine)
305 if (yyextra->yyLineNr<yyextra->inputLines)
307 yyextra->currentFontClass = fc;
315 const char *p=text,*sp=p;
321 while ((c=*p++) && c!=
'\n') { }
325 size_t l =
static_cast<size_t>(p-sp-1);
326 yyextra->code->codify(
DString(sp,l));
331 yyextra->code->codify(sp);
341 yyextra->code->startFontClass(s);
342 yyextra->currentFontClass=s;
349 const char *p=yyextra->inputString;
355 if (c==
'\n') count++;
357 if (p>yyextra->inputString && *(p-1)!=
'\n')
368 int inputPosition = yyextra->inputPosition;
369 const char *s = yyextra->inputString + inputPosition;
371 while( c < max_size && *s )
376 yyextra->inputPosition += c;
391 sqlcodeYYlex_init_extra(&
p->state, &
p->yyscanner);
400 sqlcodeYYlex_destroy(
p->yyscanner);
406 yyextra->currentDefinition =
nullptr;
407 yyextra->currentMemberDef =
nullptr;
414 bool stripCodeComments,
421 if (input.
empty())
return;
425 yyextra->code = &codeOutIntf;
426 yyextra->inputString = input.
data();
427 yyextra->inputPosition = 0;
428 yyextra->currentFontClass =
nullptr;
429 yyextra->insideCodeLine =
false;
430 yyextra->searchCtx = options.
searchCtx();
433 yyextra->stripCodeComments = stripCodeComments;
434 yyextra->exampleBlock = options.
isExample();
436 yyextra->sourceFileDef = options.
fileDef();
443 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
446 if (yyextra->sourceFileDef)
455 sqlcodeYYrestart(
nullptr, yyscanner );
457 sqlcodeYYlex(yyscanner);
459 if (yyextra->insideCodeLine)
463 if (yyextra->exampleFileDef)
466 yyextra->exampleFileDef.reset();
467 yyextra->sourceFileDef=
nullptr;
473#include "sqlcode.l.h"
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
DString & 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.
static bool isFlagSet(const DebugMask mask)
virtual const DString & name() const =0
virtual bool isLinkableInProject() const =0
virtual DString getReference() const =0
virtual DString getOutputFileBase() const =0
static SearchIndexIntf searchIndex
virtual DString fileName() const =0
void parseCode(OutputCodeList &codeOutIntf, const DString &scopeName, const DString &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< Private > p
void resetCodeParserState() override
Resets the state of the code parser.
~SQLCodeParser() override
void setCurrentDoc(const Definition *ctx, const DString &anchor, bool isSourceFile)
const char * qPrint(const char *s)
std::unique_ptr< FileDef > createFileDef(const DString &p, const DString &n, const DString &ref, const DString &dn)
Options to configure the code parser.
const Definition * searchCtx() const
DString exampleName() const
const FileDef * fileDef() const
bool showLineNumbers() const
bool inlineFragment() const