Skip to main content

The sqlcode.l File Reference

Included Headers

#include <stdint.h> #include <stdio.h> #include "sqlcode.h" #include "entry.h" #include "doxygen.h" #include "outputlist.h" #include "util.h" #include "membername.h" #include "searchindex.h" #include "config.h" #include "filedef.h" #include "tooltip.h" #include "message.h" #include "debug.h" #include "doxygen_lex.h" #include "sqlcode.l.h"

Classes Index

structsqlcodeYY_state
structPrivate

Typedefs Index

typedefyyguts_t * yyscan_t

Functions Index

static const char *stateToString (int state)
static voidsetCurrentDoc (yyscan_t yyscanner, const QCString &anchor)
static voidstartCodeLine (yyscan_t yyscanner)
static voidendFontClass (yyscan_t yyscanner)
static voidendCodeLine (yyscan_t yyscanner)
static voidnextCodeLine (yyscan_t yyscanner)
static voidcodifyLines (yyscan_t yyscanner, const char *text)
static voidstartFontClass (yyscan_t yyscanner, const char *s)
static intcountLines (yyscan_t yyscanner)
static intyyread (yyscan_t yyscanner, char *buf, int max_size)
static const char *getLexerFILE ()
intyylex (yyscan_t yyscanner)

Macro Definitions Index

#defineYY_TYPEDEF_YY_SCANNER_T
#defineYY_NEVER_INTERACTIVE   1
#defineYY_NO_INPUT   1
#defineYY_NO_UNISTD_H   1
#defineYY_INPUT(buf, result, max_size)   result=yyread(yyscanner,buf,max_size);

Typedefs

yyscan_t

typedef yyguts_t* yyscan_t

Definition at line 27 of file sqlcode.l.

27typedef yyguts_t *yyscan_t;

Functions

codifyLines()

void codifyLines (yyscan_t yyscanner, const char * text)
static

Definition at line 310 of file sqlcode.l.

310static void codifyLines(yyscan_t yyscanner,const char *text)
311{
312 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
313 const char *p=text,*sp=p;
314 char c;
315 bool done=false;
316 while (!done)
317 {
318 sp=p;
319 while ((c=*p++) && c!='\n') { }
320 if (c=='\n')
321 {
322 yyextra->yyLineNr++;
323 size_t l = static_cast<size_t>(p-sp-1);
324 std::string tmp(sp,l);
325 yyextra->code->codify(tmp.c_str());
326 nextCodeLine(yyscanner);
327 }
328 else
329 {
330 yyextra->code->codify(sp);
331 done=true;
332 }
333 }
334}

Reference nextCodeLine.

countLines()

int countLines (yyscan_t yyscanner)
static

counts the number of lines in the input

Definition at line 345 of file sqlcode.l.

345static int countLines(yyscan_t yyscanner)
346{
347 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
348 const char *p=yyextra->inputString;
349 char c;
350 int count=1;
351 while ((c=*p))
352 {
353 p++ ;
354 if (c=='\n') count++;
355 }
356 if (p>yyextra->inputString && *(p-1)!='\n')
357 { // last line does not end with a \n, so we add an extra
358 // line and explicitly terminate the line after parsing.
359 count++;
360 }
361 return count;
362}

endCodeLine()

void endCodeLine (yyscan_t yyscanner)
static

Definition at line 287 of file sqlcode.l.

287static void endCodeLine(yyscan_t yyscanner)
288{
289 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
290 endFontClass(yyscanner);
291 yyextra->code->endCodeLine();
292 yyextra->insideCodeLine=false;
293}

Reference endFontClass.

endFontClass()

void endFontClass (yyscan_t yyscanner)
static

Definition at line 277 of file sqlcode.l.

277static void endFontClass(yyscan_t yyscanner)
278{
279 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
280 if (yyextra->currentFontClass)
281 {
282 yyextra->code->endFontClass();
283 yyextra->currentFontClass=0;
284 }
285}

getLexerFILE()

const char * getLexerFILE ()
inline static

Definition at line 92 of file sqlcode.l.

92static inline const char *getLexerFILE() {return __FILE__;}

nextCodeLine()

void nextCodeLine (yyscan_t yyscanner)
static

Definition at line 295 of file sqlcode.l.

295static void nextCodeLine(yyscan_t yyscanner)
296{
297 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
298 const char *fc = yyextra->currentFontClass;
299 if (yyextra->insideCodeLine)
300 {
301 endCodeLine(yyscanner);
302 }
303 if (yyextra->yyLineNr<yyextra->inputLines)
304 {
305 yyextra->currentFontClass = fc;
306 startCodeLine(yyscanner);
307 }
308}

References endCodeLine and startCodeLine.

setCurrentDoc()

void setCurrentDoc (yyscan_t yyscanner, const QCString & anchor)
static

Definition at line 210 of file sqlcode.l.

210static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor)
211{
212 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
213 if (Doxygen::searchIndex.enabled())
214 {
215 if (yyextra->searchCtx)
216 {
217 Doxygen::searchIndex.setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),false);
218 }
219 else
220 {
221 Doxygen::searchIndex.setCurrentDoc(yyextra->sourceFileDef,anchor,true);
222 }
223 }
224}

Reference Doxygen::searchIndex.

startCodeLine()

void startCodeLine (yyscan_t yyscanner)
static

start a new line of code, inserting a line number if yyextra->sourceFileDef is true. If a definition starts at the current line, then the line number is linked to the documentation of that definition.

Definition at line 230 of file sqlcode.l.

230static void startCodeLine(yyscan_t yyscanner)
231{
232 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
233 if (yyextra->sourceFileDef)
234 {
235 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
236
237 if (!yyextra->includeCodeFragment && d && d->isLinkableInProject())
238 {
239 yyextra->currentDefinition = d;
240 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
241 yyextra->classScope = d->name();
242 QCString lineAnchor;
243 lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
244 if (yyextra->currentMemberDef)
245 {
246 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
247 yyextra->currentMemberDef->getOutputFileBase(),
248 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
249 !yyextra->includeCodeFragment);
250 setCurrentDoc(yyscanner,lineAnchor);
251 }
252 else
253 {
254 yyextra->code->writeLineNumber(d->getReference(),
256 QCString(),yyextra->yyLineNr,
257 !yyextra->includeCodeFragment);
258 setCurrentDoc(yyscanner,lineAnchor);
259 }
260 }
261 else
262 {
263 yyextra->code->writeLineNumber(QCString(),QCString(),QCString(),yyextra->yyLineNr,
264 !yyextra->includeCodeFragment);
265 }
266 }
267
268 yyextra->code->startCodeLine(yyextra->yyLineNr);
269 yyextra->insideCodeLine=true;
270
271 if (yyextra->currentFontClass)
272 {
273 yyextra->code->startFontClass(yyextra->currentFontClass);
274 }
275}

References Definition::getOutputFileBase, Definition::getReference, Definition::isLinkableInProject, Definition::name, setCurrentDoc and QCString::sprintf.

startFontClass()

void startFontClass (yyscan_t yyscanner, const char * s)
static

Definition at line 336 of file sqlcode.l.

336static void startFontClass(yyscan_t yyscanner,const char *s)
337{
338 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
339 endFontClass(yyscanner);
340 yyextra->code->startFontClass(s);
341 yyextra->currentFontClass=s;
342}

Reference endFontClass.

stateToString()

const char * stateToString (int state)
static

Definition at line 76 of file sqlcode.l.

yylex()

int yylex (yyscan_t yyscanner)

Definition at line 133 of file sqlcode.l.

133%%
134
135{literals} {
136 startFontClass(yyscanner,"stringliteral");
137 codifyLines(yyscanner,yytext);
138 endFontClass(yyscanner);
139 }
140
141
142{keyword} {
143 startFontClass(yyscanner,"keyword");
144 codifyLines(yyscanner,yytext);
145 endFontClass(yyscanner);
146 }
147
148{flowkeyword} {
149 startFontClass(yyscanner,"keywordflow");
150 codifyLines(yyscanner,yytext);
151 endFontClass(yyscanner);
152 }
153
154{typekeyword} {
155 startFontClass(yyscanner,"keywordtype");
156 codifyLines(yyscanner,yytext);
157 endFontClass(yyscanner);
158 }
159
160{variable} {
161 startFontClass(yyscanner,"preprocessor");
162 codifyLines(yyscanner,yytext);
163 endFontClass(yyscanner);
164 }
165
166{simplecomment} {
167 startFontClass(yyscanner,"comment");
168 codifyLines(yyscanner,yytext);
169 endFontClass(yyscanner);
170 }
171
172{commentopen} {
173 startFontClass(yyscanner,"comment");
174 codifyLines(yyscanner,yytext);
175 BEGIN(COMMENT);
176 }
177
178<COMMENT>. {
179 codifyLines(yyscanner,yytext);
180
181 }
182<COMMENT>{nl} {
183 codifyLines(yyscanner,yytext);
184 }
185
186<COMMENT>{commentclose} {
187 codifyLines(yyscanner,yytext);
188 endFontClass(yyscanner);
189 BEGIN(INITIAL);
190 }
191
192{idchar} {
193 codifyLines(yyscanner,yytext);
194 }
195
196{nl} {
197 codifyLines(yyscanner,yytext);
198 }
199
200[\x80-\xFF]* { // keep utf8 characters together...
201 codifyLines(yyscanner,yytext);
202 }
203. {
204 codifyLines(yyscanner,yytext);
205 }
206
207%%

yyread()

int yyread (yyscan_t yyscanner, char * buf, int max_size)
static

Definition at line 364 of file sqlcode.l.

364static int yyread(yyscan_t yyscanner,char *buf,int max_size)
365{
366 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
367 int inputPosition = yyextra->inputPosition;
368 const char *s = yyextra->inputString + inputPosition;
369 int c=0;
370 while( c < max_size && *s )
371 {
372 *buf++ = *s++;
373 c++;
374 }
375 yyextra->inputPosition += c;
376 return c;
377}

Macro Definitions

YY_INPUT

#define YY_INPUT(buf, result, max_size)   result=yyread(yyscanner,buf,max_size);

Definition at line 89 of file sqlcode.l.

89#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);

YY_NEVER_INTERACTIVE

#define YY_NEVER_INTERACTIVE   1

Definition at line 48 of file sqlcode.l.

48#define YY_NEVER_INTERACTIVE 1

YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 49 of file sqlcode.l.

49#define YY_NO_INPUT 1

YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 50 of file sqlcode.l.

50#define YY_NO_UNISTD_H 1

YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 25 of file sqlcode.l.

25#define YY_TYPEDEF_YY_SCANNER_T

Generated via doxygen2docusaurus by Doxygen 1.14.0.