Doxygen
Loading...
Searching...
No Matches
scanner.l
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * Copyright (C) 1997-2021 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15%option never-interactive
16%option prefix="scannerYY"
17%option reentrant
18%option extra-type="struct scannerYY_state *"
19%top{
20#include <stdint.h>
21// forward declare yyscan_t to improve typesafety
22#define YY_TYPEDEF_YY_SCANNER_T
23struct yyguts_t;
24typedef yyguts_t *yyscan_t;
yyguts_t * yyscan_t
Definition code.l:24
25}
26
27%{
28
29/*
30 * includes
31 */
32
33#include <algorithm>
34#include <vector>
35#include <utility>
36#include <cstdint>
37#include <cstdio>
38#include <cstdlib>
39#include <cassert>
40#include <cctype>
41
42#include "scanner.h"
43#include "entry.h"
44#include "message.h"
45#include "config.h"
46#include "doxygen.h"
47#include "util.h"
48#include "defargs.h"
49#include "language.h"
50#include "commentscan.h"
51#include "arguments.h"
52#include "moduledef.h"
53#include "stringutil.h"
54
55#include "clangparser.h"
56#include "markdown.h"
57#include "regex.h"
58#include "trace.h"
59#include "debug.h"
60
61#define YY_NO_INPUT 1
62#define YY_NO_UNISTD_H 1
63
65{
68 const char * inputString = nullptr;
70 int lastContext = 0;
71 int lastCContext = 0;
98 bool exported = false;
99 int sharpCount = 0 ;
100 int roundCount = 0 ;
101 int curlyCount = 0 ;
102 int squareCount = 0 ;
103 int padCount = 0 ;
104 std::shared_ptr<Entry> current;
105 std::shared_ptr<Entry> current_root;
106 std::shared_ptr<Entry> previous;
107 std::shared_ptr<Entry> tempEntry;
108 std::shared_ptr<Entry> firstTypedefEntry;
109 std::shared_ptr<Entry> memspecEntry;
110 int yyLineNr = 1 ;
111 int yyBegLineNr = 1 ;
112 int yyColNr = 1 ;
113 int yyBegColNr = 1 ;
116 bool isStatic = false;
122 bool isTypedef = false;
127 QCString* specName = nullptr;
128
130 bool insideIDL = false; //!< processing IDL code?
131 bool insideJava = false; //!< processing Java code?
132 bool insideCS = false; //!< processing C# code?
133 bool insideD = false; //!< processing D code?
134 bool insidePHP = false; //!< processing PHP code?
135 bool insideObjC = false; //!< processing Objective C code?
136 bool insideCli = false; //!< processing C++/CLI code?
137 bool insideJS = false; //!< processing JavaScript code?
138 bool insideSlice = false; //!< processing Slice code?
139 bool insideCpp = true; //!< processing C/C++ code
141
142 bool insideCppQuote = false;
143 bool insideProtocolList = false;
144 bool doxygenComment = false;
145
156
158 char lastCopyArgChar = '\0';
159
174
175 bool insideFormula = false;
176 bool insideTryBlock = false;
177 bool insideCode = false;
178 bool needsSemi = false;
179
181
185
189 bool docBlockInBody = false;
190 bool docBlockAutoBrief = false;
191 char docBlockTerm = '\0';
192
195 bool odlProp = false;
196
197 bool lexInit = false;
198 bool externLinkage = false;
199
201
202 int column = 0;
203
204 size_t fencedSize = 0;
206 std::vector< std::pair<Entry*,std::shared_ptr<Entry> > > outerScopeEntries;
208
210
211 int fakeNS = 0; //<! number of file scoped namespaces in CSharp file
213
214 int anonCount = 0;
215 int anonNSCount = 0;
216};
217
218[[maybe_unused]] static const char *stateToString(int state);
219//-----------------------------------------------------------------------------
220
221// forward declarations for stateless functions
222static inline int computeIndent(const char *s,int startIndent);
223static inline void initMethodProtection(yyscan_t yyscanner,Protection prot);
224static QCString stripQuotes(const char *s);
225static QCString stripFuncPtr(const QCString &type);
226static bool nameIsOperator(QCString &name);
228static bool startOfRequiresExpression(const QCString &req);
229static QCString extractBeginRawStringDelimiter(const char *str);
230static QCString extractEndRawStringDelimiter(const char *str);
231
232// forward declarations for statefull functions
233static void initParser(yyscan_t yyscanner);
234static void initEntry(yyscan_t yyscanner);
235static void lineCount(yyscan_t yyscanner);
236static void addType(yyscan_t yyscanner);
237static void setContext(yyscan_t yyscanner);
238static void prependScope(yyscan_t yyscanner);
239static void startCommentBlock(yyscan_t yyscanner,bool);
240static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief);
241static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al);
242static bool checkForKnRstyleC(yyscan_t yyscanner);
243static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &oldStyleArgName);
244static void addKnRArgInfo(yyscan_t yyscanner,const QCString &type,const QCString &name,
245 const QCString &brief,const QCString &docs);
246static int yyread(yyscan_t yyscanner,char *buf,int max_size);
247static void setJavaProtection(yyscan_t yyscanner);
248static void storeClangId(yyscan_t yyscanner,const char *id);
249static void startVerbatimBlock(yyscan_t yyscanner,const QCString &blockName,size_t fencedSize=0);
250static bool endVerbatimBlock(yyscan_t yyscanner,const QCString &blockName,size_t fencedSize=0);
251
252
253/* ----------------------------------------------------------------- */
254#undef YY_INPUT
255#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
256
257// otherwise the filename would be the name of the converted file (*.cpp instead of *.l)
258static inline const char *getLexerFILE() {return __FILE__;}
259#include "doxygen_lex.h"
260
This class represents an function or template argument list.
Definition arguments.h:65
Clang parser object for a single translation unit, which consists of a source file and the directly o...
Definition clangparser.h:25
Abstract interface for outline parsers.
Definition parserintf.h:42
This is an alternative implementation of QCString.
Definition qcstring.h:101
Text streaming class that buffers data.
Definition textstream.h:36
Interface for the comment block scanner.
#define lineCount(s, len)
static QCString stripFuncPtr(const QCString &type)
Definition scanner.l:7675
static void storeClangId(yyscan_t yyscanner, const char *id)
Definition scanner.l:7569
static QCString extractBeginRawStringDelimiter(const char *str)
Definition scanner.l:7616
static void startCommentBlock(yyscan_t yyscanner, bool)
Definition scanner.l:7942
static void setContext(yyscan_t yyscanner)
Definition scanner.l:7739
static QCString stripQuotes(const char *s)
Definition scanner.l:7663
static void addKnRArgInfo(yyscan_t yyscanner, const QCString &type, const QCString &name, const QCString &brief, const QCString &docs)
Definition scanner.l:7899
static void initParser(yyscan_t yyscanner)
Definition scanner.l:7524
static bool checkForKnRstyleC(yyscan_t yyscanner)
Definition scanner.l:7779
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
Definition scanner.l:7510
static void initMethodProtection(yyscan_t yyscanner, Protection prot)
Definition scanner.l:7630
static const char * stateToString(int state)
static bool endVerbatimBlock(yyscan_t yyscanner, const QCString &blockName, size_t fencedSize=0)
Definition scanner.l:7701
static QCString extractEndRawStringDelimiter(const char *str)
Definition scanner.l:7624
void fixArgumentListForJavaScript(ArgumentList &al)
Definition scanner.l:7928
static void startVerbatimBlock(yyscan_t yyscanner, const QCString &blockName, size_t fencedSize=0)
Definition scanner.l:7688
static int computeIndent(const char *s, int startIndent)
Definition scanner.l:7601
static bool startOfRequiresExpression(const QCString &req)
Definition scanner.l:7720
static void handleCommentBlock(yyscan_t yyscanner, const QCString &doc, bool brief)
Definition scanner.l:7979
static void handleParametersCommentBlocks(yyscan_t yyscanner, ArgumentList &al)
Definition scanner.l:8039
static void prependScope(yyscan_t yyscanner)
Definition scanner.l:7761
static const char * getLexerFILE()
Definition scanner.l:258
static bool nameIsOperator(QCString &name)
Definition scanner.l:7728
static void setJavaProtection(yyscan_t yyscanner)
Definition scanner.l:7793
static void splitKnRArg(yyscan_t yyscanner, QCString &oldStyleArgPtr, QCString &oldStyleArgName)
Definition scanner.l:7810
static void addType(yyscan_t yyscanner)
Definition scanner.l:7642
static void initEntry(yyscan_t yyscanner)
Definition scanner.l:7548
Some helper functions for std::string.
QCString msArgs
Definition scanner.l:121
TextStream * pSkipInterpString
Definition scanner.l:172
QCString * pCopyRoundString
Definition scanner.l:161
bool docBlockAutoBrief
Definition scanner.l:190
int lastCopyArgStringContext
Definition scanner.l:150
Specifier baseVirt
Definition scanner.l:118
std::shared_ptr< Entry > firstTypedefEntry
Definition scanner.l:108
QCString funcPtrType
Definition scanner.l:123
QCString docBackup
Definition scanner.l:183
int lastDeprecatedContext
Definition scanner.l:77
TextStream docBlock
Definition scanner.l:187
bool insideJS
processing JavaScript code?
Definition scanner.l:137
bool insideProtocolList
Definition scanner.l:143
QCString oldStyleArgType
Definition scanner.l:182
OutlineParserInterface * thisParser
Definition scanner.l:66
int lastDocContext
Definition scanner.l:72
QCString delimiter
Definition scanner.l:200
std::shared_ptr< Entry > tempEntry
Definition scanner.l:107
int lastStringContext
Definition scanner.l:76
std::shared_ptr< Entry > memspecEntry
Definition scanner.l:109
TextStream * pCopySquareGString
Definition scanner.l:167
int lastInitializerContext
Definition scanner.l:82
bool doxygenComment
Definition scanner.l:144
std::shared_ptr< Entry > previous
Definition scanner.l:106
int lastPreLineCtrlContext
Definition scanner.l:84
QCString msType
Definition scanner.l:119
int lastDefineContext
Definition scanner.l:92
MethodTypes mtype
Definition scanner.l:115
ClangTUParser * clangParser
Definition scanner.l:209
int lastSquareContext
Definition scanner.l:81
int lastAlignAsContext
Definition scanner.l:93
QCString baseName
Definition scanner.l:126
bool insideCS
processing C# code?
Definition scanner.l:132
ArgumentList * currentArgumentList
Definition scanner.l:157
TextStream * pCopyCurlyGString
Definition scanner.l:165
int lastCommentInArgContext
Definition scanner.l:88
int lastHereDocContext
Definition scanner.l:91
int lastSharpContext
Definition scanner.l:80
int lastRoundContext
Definition scanner.l:79
QCString fullArgString
Definition scanner.l:154
QCString idlProp
Definition scanner.l:194
std::vector< std::pair< Entry *, std::shared_ptr< Entry > > > outerScopeEntries
Definition scanner.l:206
Specifier virt
Definition scanner.l:117
int lastSkipInterpVerbStringContext
Definition scanner.l:87
bool stopAtInvalidString
Definition scanner.l:140
bool insideCppQuote
Definition scanner.l:142
QCString docBlockName
Definition scanner.l:188
bool externLinkage
Definition scanner.l:198
const char * inputString
Definition scanner.l:68
QCString programStr
Definition scanner.l:207
TextStream * pSkipVerbString
Definition scanner.l:171
SrcLangExt language
Definition scanner.l:129
int lastC11AttributeContext
Definition scanner.l:94
QCString * pCopyQuotedString
Definition scanner.l:160
Protection baseProt
Definition scanner.l:97
bool insidePHP
processing PHP code?
Definition scanner.l:134
std::shared_ptr< Entry > current_root
Definition scanner.l:105
QCString * pCopyCurlyString
Definition scanner.l:162
int lastCSConstraint
Definition scanner.l:90
int lastCurlyContext
Definition scanner.l:78
CommentScanner commentScanner
Definition scanner.l:67
QCString briefBackup
Definition scanner.l:184
QCString fileName
Definition scanner.l:114
int lastModifierContext
Definition scanner.l:95
bool insideIDL
processing IDL code?
Definition scanner.l:130
bool insideTryBlock
Definition scanner.l:176
Protection protection
Definition scanner.l:96
bool insideSlice
processing Slice code?
Definition scanner.l:138
int lastCPPContext
Definition scanner.l:73
TextStream * pCopyHereDocGString
Definition scanner.l:169
bool insideObjC
processing Objective C code?
Definition scanner.l:135
int lastSkipSharpContext
Definition scanner.l:74
bool insideCli
processing C++/CLI code?
Definition scanner.l:136
int currentArgumentContext
Definition scanner.l:149
int initBracketCount
Definition scanner.l:180
int requiresContext
Definition scanner.l:152
int lastSkipVerbStringContext
Definition scanner.l:85
QCString * pCopyRawString
Definition scanner.l:164
TextStream * pCopyRawGString
Definition scanner.l:170
QCString * copyArgString
Definition scanner.l:153
bool docBlockInBody
Definition scanner.l:189
int lastCopyArgContext
Definition scanner.l:151
int inputPosition
Definition scanner.l:69
TextStream * pCopyQuotedGString
Definition scanner.l:168
QCString aliasName
Definition scanner.l:125
TextStream * pSkipInterpVerbString
Definition scanner.l:173
std::shared_ptr< Entry > current
Definition scanner.l:104
char lastCopyArgChar
Definition scanner.l:158
int lastSkipInterpStringContext
Definition scanner.l:86
bool insideD
processing D code?
Definition scanner.l:133
char docBlockTerm
Definition scanner.l:191
size_t fencedSize
Definition scanner.l:204
QCString msName
Definition scanner.l:120
QCString * pCopySharpString
Definition scanner.l:163
TextStream * pCopyRoundGString
Definition scanner.l:166
QCString templateStr
Definition scanner.l:124
bool insideCpp
processing C/C++ code
Definition scanner.l:139
int docBlockContext
Definition scanner.l:186
TextStream dummyTextStream
Definition scanner.l:212
QCString * specName
Definition scanner.l:127
int lastClassTemplSpecContext
Definition scanner.l:83
bool insideFormula
Definition scanner.l:175
QCString dummyRawString
Definition scanner.l:155
int lastSkipRoundContext
Definition scanner.l:75
bool insideJava
processing Java code?
Definition scanner.l:131
QCString idlAttr
Definition scanner.l:193
int lastRawStringContext
Definition scanner.l:89
MethodTypes
Kind of method.
Definition types.h:32
Protection
Protection level of members.
Definition types.h:26
@ Public
Definition types.h:26
SrcLangExt
Language as given by extension.
Definition types.h:42
@ Unknown
Definition types.h:43
Specifier
Virtualness of a member.
Definition types.h:29
@ Normal
Definition types.h:29
A bunch of utility functions.
261%}
262
263 /* start command character */
264CMD ("\\"|"@")
265BN [ \t\n\r]
266BNopt {BN}*
267BL [ \t\r]*"\n"
268B [ \t]
269Bopt {B}*
270NOTopt (("!"{BNopt})|("not"{BN}+))?
271DIGIT [0-9]
272HEXDIGIT ({DIGIT}|[a-f]|[A-F])
273ID [$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*
274SCOPENAME "$"?(({ID}?{BN}*"::"{BN}*)*)(((~|!){BN}*)?{ID})
275TSCOPE {ID}("<"[a-z_A-Z0-9 \t\*\&,:]*">")?
276CSSCOPENAME (({ID}?{BN}*"."{BN}*)*)((~{BN}*)?{ID})
277PRE [pP][rR][eE]
278CODE [cC][oO][dD][eE]
279CHARLIT (("'"\\x[0-9a-fA-F]{1,2}"'")|("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
280PHPKW ("require"|"require_once"|"include"|"include_once"|"echo")[^a-zA-Z0-9_;]
281PHPUSEKW ("public"|"private"|"protected")
282IDLATTR ("["[^\]]*"]"){BN}*
283TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?)
284RAWBEGIN (u|U|L|u8)?R\"[^ \t\‍(\‍)\\]{0,16}"("
285RAWEND ")"[^ \t\‍(\‍)\\]{0,16}\"
286ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++"
287ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|="
288LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!"|"<=>"
289BITOP "&"|"|"|"^"|"<<"|">>"|"~"
290OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
291FUNCOP "operator"("()"|"[]"|{B}+[^;\n]+)
292MODULE_ID ({ID}".")*{ID}
293LINENR {B}*[1-9][0-9]*
294FILEICHAR [a-z_A-Z0-9\x80-\xFF\\:\\\/\-\+=&#@~]
295FILEECHAR [a-z_A-Z0-9\x80-\xFF\-\+=&#@~]
296FILECHARS {FILEICHAR}*{FILEECHAR}+
297HFILEMASK {FILEICHAR}*("."{FILEICHAR}+)+{FILECHARS}*
298VFILEMASK {FILECHARS}("."{FILECHARS})*
299FILEMASK {VFILEMASK}|{HFILEMASK}
300
301 /* no comment start / end signs inside square brackets */
302NCOMM [^/\*]
303 // C start comment
304CCS "/\*"
305 // C end comment
306CCE "*\/"
307 // Cpp comment
308CPPC "/\/"
309 // doxygen C start comment
310DCOMMC ("/\*!"|"/\**")
311 // doxygen Cpp start comment
312DCOMMCPP ("/\/!"|"/\/\/")
313 // doxygen start comment
314DCOMM {DCOMMC}|{DCOMMCPP}
315
316 // Optional any character
317ANYopt .*
318 // Optional all but newline
319NONLopt [^\n]*
320
321%option noyywrap
322
323 /* language parsing states */
324
325%x AlignAs
326%x AlignAsEnd
327%x SDefine
328%x DefineEnd
329%x CompoundName
330%x ClassVar
331%x CSConstraintName
332%x CSConstraintType
333%x CSIndexer
334%x ClassCategory
335%x ClassTemplSpec
336%x CliPropertyType
337%x CliPropertyIndex
338%x CliOverride
339%x Bases
340%x BasesProt
341%x NextSemi
342%x BitFields
343%x EnumBaseType
344%x FindMembers
345%x FindMembersPHP
346%x FindMemberName
347%x FindFields
348%x SFunction
349%x FuncRound
350%x ExcpRound
351%x ExcpList
352%x FuncQual
353%x TrailingReturn
354%x Operator
355%x Array
356%x ReadBody
357%x ReadNSBody
358%x ReadBodyIntf
359%x Using
360%x UsingAlias
361%x UsingDirective
362%x SkipCurly
363%x SkipCurlyCpp
364%x SkipCurlyEndDoc
365%x SkipString
366%x SkipPHPString
367%x SkipInits
368%x SkipC11Inits
369%x SkipC11Attribute
370%x SkipCPP
371%x SkipComment
372%x SkipCxxComment
373%x SkipCurlyBlock
374%x SkipRoundBlock
375%x Sharp
376%x SkipRound
377%x SkipSquare
378%x StaticAssert
379%x DeclType
380%x TypedefName
381%x TryFunctionBlock
382%x TryFunctionBlockEnd
383%x Comment
384%x PackageName
385%x JavaImport
386%x IDLImport
387%x PHPUse
388%x PHPUseAs
389%x CSAccessorDecl
390%x CSGeneric
391%x PreLineCtrl
392%x DefinePHP
393%x DefinePHPEnd
394%x OldStyleArgs
395%x SkipVerbString
396%x SkipInterpString
397%x SkipInterpVerbString
398%x ObjCMethod
399%x ObjCReturnType
400%x ObjCParams
401%x ObjCParamType
402%x ObjCProtocolList
403%x ObjCPropAttr
404%x ObjCSkipStatement
405%x QtPropType
406%x QtPropAttr
407%x QtPropRead
408%x QtPropWrite
409%x ReadInitializer
410%x ReadInitializerPtr
411%x UNOIDLAttributeBlock
412%x GetCallType
413%x CppQuote
414%x EndCppQuote
415%x MemberSpec
416%x MemberSpecSkip
417%x EndTemplate
418%x FuncPtr
419%x FuncPtrOperator
420%x EndFuncPtr
421%x ReadFuncArgType
422%x ReadTempArgs
423%x IDLUnionCase
424%x NSAliasName
425%x NSAliasArg
426%x CopyString
427%x CopyPHPString
428%x CopyGString
429%x CopyPHPGString
430%x CopyRound
431%x CopySharp
432%x CopyCurly
433%x GCopyRound
434%x GCopySquare
435%x GCopyCurly
436%x SkipUnionSwitch
437%x Specialization
438%x SpecializationSingleQuote
439%x SpecializationDoubleQuote
440%x FuncFunc
441%x FuncFuncEnd
442%x FuncFuncType
443%x FuncFuncArray
444%x CopyArgString
445%x CopyArgPHPString
446%x CopyArgRound
447%x CopyArgSquare
448%x CopyArgSharp
449%x CopyArgComment
450%x CopyArgCommentLine
451%x CopyArgVerbatim
452%x HereDoc
453%x HereDocEnd
454%x CopyHereDoc
455%x CopyHereDocEnd
456%x RawString
457%x RawGString
458%x CSString
459%x CppProt
460
461%x IDLAttribute
462%x IDLProp
463%x IDLPropName
464
465 /** Slice states */
466
467%x SliceOptional
468%x SliceMetadata
469%x SliceSequence
470%x SliceSequenceName
471%x SliceDictionary
472%x SliceDictionaryName
473
474 /** Prototype scanner states */
475
476%x Prototype
477%x PrototypePtr
478%x PrototypeQual
479%x PrototypeExc
480%x PrototypeSkipLine
481
482 /** comment parsing states */
483
484%x DocLine
485%x DocBlock
486%x DocCopyBlock
487
488 /** C++20 concepts */
489
490%x RequiresClause
491%x RequiresExpression
492%x ConceptName
493
494 /** Object-C Deprecated */
495%x Deprecated_round
496
497
498 /** C++20 modules */
499%x ModuleName
500%x ModuleImport
502
503<*>"DEPRECATED_ATTRIBUTE" { // Object-C attribute
504 if (!yyextra->insideObjC) REJECT;
505 }
506<*>"DEPRECATED_MSG_ATTRIBUTE(\"" { // Object-C attribute
507 if (!yyextra->insideObjC) REJECT;
508 yyextra->lastDeprecatedContext=YY_START;
509 yyextra->lastStringContext=Deprecated_round;
510 BEGIN(SkipString);
511 }
512<Deprecated_round>")" {
513 BEGIN(yyextra->lastDeprecatedContext);
514 }
515<Deprecated_round>{BNopt} {
516 lineCount(yyscanner);
517 }
518<Deprecated_round>. { }
519<NextSemi>"{" {
520 yyextra->curlyCount=0;
521 yyextra->needsSemi = TRUE;
522 BEGIN(SkipCurlyBlock);
523 }
#define TRUE
Definition qcstring.h:37
524<NextSemi>"(" {
525 yyextra->roundCount=0;
526 BEGIN(SkipRoundBlock);
527 }
528<SkipRoundBlock>"(" {
529 ++yyextra->roundCount;
530 }
531<SkipRoundBlock>")" {
532 if (yyextra->roundCount )
533 --yyextra->roundCount ;
534 else
535 BEGIN( NextSemi ) ;
536 }
537<SkipCurlyBlock>"{" {
538 ++yyextra->curlyCount ;
539 }
540<SkipCurlyBlock>"}" {
541 if( yyextra->curlyCount )
542 {
543 --yyextra->curlyCount ;
544 }
545 else if (yyextra->needsSemi)
546 {
547 BEGIN( NextSemi );
548 }
549 else
550 {
551 BEGIN( FindMembers );
552 }
553 }
554<NextSemi>\' {
555 if (yyextra->insidePHP)
556 {
557 yyextra->lastStringContext=NextSemi;
558 BEGIN(SkipPHPString);
559 }
560 }
561<NextSemi>{CHARLIT} { if (yyextra->insidePHP) REJECT; }
562<NextSemi>\" {
563 yyextra->lastStringContext=NextSemi;
564 BEGIN(SkipString);
565 }
566<NextSemi>[;,] {
567 unput(*yytext);
568 BEGIN( FindMembers );
569 }
570<BitFields>[;,] {
571 unput(*yytext);
572 BEGIN( FindMembers );
573 }
574<EnumBaseType>[{;,] {
575 yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
576 unput(*yytext);
577 BEGIN( ClassVar );
578 }
579<FindMembers>"<?php" { // PHP code with unsupported extension?
580 yyextra->insidePHP = TRUE;
581 }
582<FindMembersPHP>"<?"("php"?) { // PHP code start
583 BEGIN( FindMembers );
584 }
585<FindMembersPHP>"<script"{BN}+"language"{BN}*"="{BN}*['"]?"php"['"]?{BN}*">" { // PHP code start
586 lineCount(yyscanner) ;
587 BEGIN( FindMembers );
588 }
589<FindMembers>"?>"|"</script>" { // PHP code end
590 if (yyextra->insidePHP)
591 BEGIN( FindMembersPHP );
592 else
593 REJECT;
594 }
595<FindMembersPHP>[^\n<]+ { // Non-PHP code text, ignore
596 }
597<FindMembersPHP>\n { // Non-PHP code text, ignore
598 lineCount(yyscanner);
599 }
600<FindMembersPHP>. { // Non-PHP code text, ignore
601 }
602<FindMembers>{PHPKW} { if (yyextra->insidePHP)
603 BEGIN( NextSemi );
604 else
605 REJECT;
606 }
607<FindMembers>"%{"[^\n]* { // Mozilla XPIDL lang-specific block
608 if (!yyextra->insideIDL)
609 REJECT;
610 }
611<FindMembers>"%}" { // Mozilla XPIDL lang-specific block end
612 if (!yyextra->insideIDL)
613 REJECT;
614 }
615<FindMembers>{B}*("properties"){BN}*":"{BN}* { // IDL or Borland C++ builder property
617 yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
618 }
@ Property
Definition types.h:32
619
620<FindMembers>{B}*"k_dcop"{BN}*":"{BN}* {
622 yyextra->current->mtype = yyextra->mtype = MethodTypes::DCOP;
623 }
624
625<FindMembers>{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* {
627 yyextra->current->mtype = yyextra->mtype = MethodTypes::Signal;
628 }
629
630<FindMembers>{B}*"public"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
632 yyextra->current->mtype = yyextra->mtype = MethodTypes::Slot;
633 }
634
635<FindMembers>{B}*"protected"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
637 yyextra->current->mtype = yyextra->mtype = MethodTypes::Slot;
638 }
@ Protected
Definition types.h:26
639
640<FindMembers>{B}*"private"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
642 yyextra->current->mtype = yyextra->mtype = MethodTypes::Slot;
643 }
@ Private
Definition types.h:26
644<FindMembers>{B}*("public"|"methods"|"__published"){BN}*":"{BN}* {
646 }
647<FindMembers>{B}*"internal"{BN}*":"{BN}* { // for now treat C++/CLI's internal as package...
648 if (yyextra->insideCli)
649 {
651 }
652 else
653 {
654 REJECT;
655 }
656 }
@ Package
Definition types.h:26
657<FindMembers>{B}*"protected"{BN}*":"{BN}* {
659 }
660<FindMembers>{B}*"private"{BN}*":"{BN}* {
662 }
663<FindMembers>{B}*"public"/({BN}|{CCS}|{CPPC}) {
664 if (!yyextra->insideCpp) REJECT;
666 BEGIN(CppProt);
667 }
668<FindMembers>{B}*"protected"/({BN}|{CCS}|{CPPC}) {
669 if (!yyextra->insideCpp) REJECT;
671 BEGIN(CppProt);
672 }
673<FindMembers>{B}*"private"/({BN}|{CCS}|{CPPC}) {
674 if (!yyextra->insideCpp) REJECT;
676 BEGIN(CppProt);
677 }
678<CppProt>":" {
679 BEGIN(FindMembers);
680 }
681<CppProt>. {
682 unput(*yytext);
683 BEGIN(FindMembers);
684 }
685<CppProt>{BN}+ { lineCount(yyscanner); }
686<CppProt>{CPPC}.*\n { lineCount(yyscanner); }
687<CppProt>{CCS} { yyextra->lastCContext = YY_START ;
688 BEGIN( SkipComment ) ;
689 }
690<CppProt>("slots"|"Q_SLOTS") {
691 yyextra->current->mtype = yyextra->mtype = MethodTypes::Slot;
692 }
693<FindMembers>{B}*"event"{BN}+ {
694 if (yyextra->insideCli)
695 {
696 // C++/CLI event
697 lineCount(yyscanner) ;
698 yyextra->current->mtype = yyextra->mtype = MethodTypes::Event;
699 yyextra->current->bodyLine = yyextra->yyLineNr;
700 yyextra->current->bodyColumn = yyextra->yyColNr;
701 yyextra->curlyCount=0;
702 BEGIN( CliPropertyType );
703 }
704 else if (yyextra->insideCS)
705 {
706 lineCount(yyscanner) ;
707 yyextra->current->mtype = MethodTypes::Event;
708 yyextra->current->bodyLine = yyextra->yyLineNr;
709 yyextra->current->bodyColumn = yyextra->yyColNr;
710 }
711 else
712 {
713 REJECT;
714 }
715 }
716<FindMembers>{B}*"property"{BN}+ {
717 if (yyextra->insideCli)
718 {
719 // C++/CLI property
720 lineCount(yyscanner) ;
721 yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
722 yyextra->current->bodyLine = yyextra->yyLineNr;
723 yyextra->current->bodyColumn = yyextra->yyColNr;
724 yyextra->curlyCount=0;
725 BEGIN( CliPropertyType );
726 }
727 else
728 {
729 REJECT;
730 }
731 }
732<CliPropertyType>{ID} {
733 addType(yyscanner);
734 yyextra->current->name = yytext;
735 }
static void addType(yyscan_t yyscanner)
Definition code.l:2603
736<CliPropertyType>"[" { // C++/CLI indexed property
737 yyextra->current->args = "[";
738 BEGIN( CliPropertyIndex );
739 }
740<CliPropertyType>"{" {
741 yyextra->curlyCount=0;
742 //printf("event: '%s' '%s'\n",qPrint(yyextra->current->type),qPrint(yyextra->current->name));
743 BEGIN( CSAccessorDecl );
744 }
745<CliPropertyType>";" {
746 unput(*yytext);
747 BEGIN( FindMembers );
748 }
749<CliPropertyType>\n {
750 lineCount(yyscanner);
751 }
752<CliPropertyType>{B}* {
753 }
754<CliPropertyType>. {
755 addType(yyscanner);
756 yyextra->current->type += yytext;
757 }
758<CliPropertyIndex>"]" {
759 BEGIN( CliPropertyType );
760 yyextra->current->args+=yytext;
761 }
762<CliPropertyIndex>. {
763 yyextra->current->args+=yytext;
764 }
765 /*
766<FindMembers>{B}*"property"{BN}+ {
767 if (!yyextra->current->type.isEmpty())
768 {
769 REJECT;
770 }
771 else
772 {
773 yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
774 lineCount(yyscanner);
775 }
776 }
777 */
778<FindMembers>{B}*"@private"{BN}+ {
780 }
781<FindMembers>{B}*"@protected"{BN}+ {
783 }
784<FindMembers>{B}*"@public"{BN}+ {
786 }
787<FindMembers>[\-+]{BN}* {
788 if (!yyextra->insideObjC)
789 {
790 REJECT;
791 }
792 else
793 {
794 yyextra->current->fileName = yyextra->fileName;
795 yyextra->current->startLine = yyextra->yyLineNr;
796 yyextra->current->startColumn = yyextra->yyColNr;
797 yyextra->current->bodyLine = yyextra->yyLineNr;
798 yyextra->current->bodyColumn = yyextra->yyColNr;
799 yyextra->current->section = EntryType::makeFunction();
800 yyextra->language = yyextra->current->lang = SrcLangExt::ObjC;
801 yyextra->insideObjC = TRUE;
802 yyextra->yyBegColNr = yyextra->yyColNr;
803 yyextra->yyBegLineNr = yyextra->yyLineNr;
804 yyextra->current->virt = Specifier::Virtual;
805
806 yyextra->current->isStatic=yytext[0]=='+';
808 BEGIN( ObjCMethod );
809 }
810 }
@ Virtual
Definition types.h:29
811<ObjCMethod>"(" { // start of method's return type
812 BEGIN( ObjCReturnType );
813 yyextra->current->type.clear();
814 yyextra->roundCount=0;
815 }
816<ObjCMethod>{ID} { // found method name
817 if (yyextra->current->type.isEmpty())
818 {
819 yyextra->current->type += "id";
820 }
821 yyextra->current->name = yytext;
822 storeClangId(yyscanner,yytext);
823 }
824<ObjCMethod>":"{B}* { // start of parameter list
825 yyextra->current->name += ':';
826 Argument a;
827 yyextra->current->argList.push_back(a);
828 BEGIN( ObjCParams );
829 }
This class contains the information about the argument of a function or template.
Definition arguments.h:27
830<ObjCReturnType>[^()]* {
831 yyextra->current->type += yytext;
832 }
833<ObjCReturnType>"(^)(" { // Block return type
834 yyextra->current->type += yytext;
835 yyextra->roundCount++;
836 }
837<ObjCReturnType>"(" {
838 yyextra->current->type += yytext;
839 yyextra->roundCount++;
840 }
841<ObjCReturnType>")" {
842 if (yyextra->roundCount<=0)
843 {
844 BEGIN( ObjCMethod );
845 }
846 else
847 {
848 yyextra->current->type += yytext;
849 yyextra->roundCount--;
850 }
851 }
852<ObjCParams>({ID})?{BN}*":" { // Keyword of parameter
853 QCString keyw = yytext;
854 keyw=keyw.left(keyw.length()-1).stripWhiteSpace(); // strip :
855 if (keyw.isEmpty())
856 {
857 yyextra->current->name += " :";
858 }
859 else
860 {
861 yyextra->current->name += keyw+":";
862 }
863 if (yyextra->current->argList.back().type.isEmpty())
864 {
865 yyextra->current->argList.back().type="id";
866 }
867 Argument a;
868 a.attrib=(QCString)"["+keyw+"]";
869 yyextra->current->argList.push_back(a);
870 }
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
QCString left(size_t len) const
Definition qcstring.h:214
QCString attrib
Definition arguments.h:41
871<ObjCParams>{ID}{BN}* { // name of parameter
872 lineCount(yyscanner);
873 yyextra->current->argList.back().name=QCString(yytext).stripWhiteSpace();
874 }
875<ObjCParams>","{BN}*"..." { // name of parameter
876 lineCount(yyscanner);
877 // do we want the comma as part of the name?
878 //yyextra->current->name += ",";
879 Argument a;
880 a.attrib="[,]";
881 a.type="...";
882 yyextra->current->argList.push_back(a);
883 }
QCString type
Definition arguments.h:42
884 /*
885<ObjCParams>":" {
886 yyextra->current->name += ':';
887 }
888 */
889<ObjCParams>"(" {
890 yyextra->roundCount=0;
891 yyextra->current->argList.back().type.clear();
892 BEGIN( ObjCParamType );
893 }
894<ObjCParamType>"(" {
895 yyextra->roundCount++;
896 yyextra->current->argList.back().type+=yytext;
897 }
898<ObjCParamType>")"/{B}* {
899 if (yyextra->roundCount<=0)
900 {
901 BEGIN( ObjCParams );
902 }
903 else
904 {
905 yyextra->current->argList.back().type+=yytext;
906 yyextra->roundCount--;
907 }
908 }
909<ObjCParamType>[^()]* {
910 yyextra->current->argList.back().type+=QCString(yytext).stripWhiteSpace();
911 }
912<ObjCMethod,ObjCParams>";" { // end of method declaration
913 if (!yyextra->current->argList.empty() && yyextra->current->argList.back().type.isEmpty())
914 {
915 yyextra->current->argList.back().type="id";
916 }
917 if (yyextra->current->argList.empty()) // method without parameters
918 {
919 yyextra->current->argList.setNoParameters(TRUE);
920 }
921 yyextra->current->args = argListToString(yyextra->current->argList);
922 //printf("argList=%s\n",qPrint(yyextra->current->args));
923 unput(';');
924 BEGIN( SFunction );
925 }
QCString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
Definition util.cpp:1201
926<ObjCMethod,ObjCParams>(";"{BN}+)?"{" { // start of a method body
927 lineCount(yyscanner);
928 //printf("Type=%s Name=%s args=%s\n",
929 // qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(argListToString(yyextra->current->argList))
930 // );
931 if (!yyextra->current->argList.empty() && yyextra->current->argList.back().type.isEmpty())
932 {
933 yyextra->current->argList.back().type="id";
934 }
935 if (yyextra->current->argList.empty()) // method without parameters
936 {
937 yyextra->current->argList.setNoParameters(TRUE);
938 }
939 yyextra->current->args = argListToString(yyextra->current->argList);
940 unput('{');
941 BEGIN( SFunction );
942 }
943<FindMembers>{B}*"sequence"{BN}*"<"{BN}* {
944 if (yyextra->insideSlice)
945 {
946 lineCount(yyscanner);
947 yyextra->current->bodyLine = yyextra->yyLineNr;
948 yyextra->current->bodyColumn = yyextra->yyColNr;
949 yyextra->current->fileName = yyextra->fileName ;
950 yyextra->current->startLine = yyextra->yyLineNr ;
951 yyextra->current->startColumn = yyextra->yyColNr;
952 yyextra->current->args.clear();
953 yyextra->current->section = EntryType::makeTypedef();
954 yyextra->isTypedef = TRUE;
955 BEGIN( SliceSequence );
956 }
957 else
958 REJECT;
959 }
960<FindMembers>{B}*"dictionary"{BN}*"<"{BN}* {
961 if (yyextra->insideSlice)
962 {
963 lineCount(yyscanner);
964 yyextra->current->bodyLine = yyextra->yyLineNr;
965 yyextra->current->bodyColumn = yyextra->yyColNr;
966 yyextra->current->fileName = yyextra->fileName ;
967 yyextra->current->startLine = yyextra->yyLineNr ;
968 yyextra->current->startColumn = yyextra->yyColNr;
969 yyextra->current->args.clear();
970 yyextra->current->section = EntryType::makeTypedef() ;
971 yyextra->isTypedef = TRUE;
972 BEGIN( SliceDictionary );
973 }
974 else
975 REJECT;
976 }
977<FindMembers>{BN}{1,80} {
978 lineCount(yyscanner);
979 }
980<FindMembers>"@"({ID}".")*{ID}{BN}*"(" {
981 if (yyextra->insideJava) // Java annotation
982 {
983 lineCount(yyscanner);
984 yyextra->lastSkipRoundContext = YY_START;
985 yyextra->roundCount=0;
986 BEGIN( SkipRound );
987 }
988 else if (literal_at(yytext,"@property")) // ObjC 2.0 property
989 {
990 yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
991 yyextra->current->spec.setReadable(true).setWritable(true).setAssign(true);
992 yyextra->current->protection = Protection::Public ;
993 unput('(');
994 BEGIN( ObjCPropAttr );
995 }
996 else
997 {
998 REJECT;
999 }
1000 }
bool literal_at(const char *data, const char(&str)[N])
returns TRUE iff data points to a substring that matches string literal str
Definition stringutil.h:98
1001<ObjCPropAttr>"getter="{ID} {
1002 yyextra->current->read = yytext+7;
1003 }
1004<ObjCPropAttr>"setter="{ID} {
1005 yyextra->current->write = yytext+7;
1006 }
1007<ObjCPropAttr>"readonly" {
1008 yyextra->current->spec.setWritable(false);
1009 }
1010<ObjCPropAttr>"readwrite" { // default
1011 }
1012<ObjCPropAttr>"assign" { // default
1013 }
1014<ObjCPropAttr>"unsafe_unretained" {
1015 yyextra->current->spec.setAssign(false);
1016 yyextra->current->spec.setUnretained(true);
1017 }
1018<ObjCPropAttr>"retain" {
1019 yyextra->current->spec.setAssign(false);
1020 yyextra->current->spec.setRetain(true);
1021 }
1022<ObjCPropAttr>"copy" {
1023 yyextra->current->spec.setAssign(false);
1024 yyextra->current->spec.setCopy(true);
1025 }
1026<ObjCPropAttr>"weak" {
1027 yyextra->current->spec.setAssign(false);
1028 yyextra->current->spec.setWeak(true);
1029 }
1030<ObjCPropAttr>"strong" {
1031 yyextra->current->spec.setAssign(false);
1032 yyextra->current->spec.setStrong(true);
1033 }
1034<ObjCPropAttr>"nonatomic" {
1035 yyextra->current->spec.setNonAtomic(true);
1036 }
1037<ObjCPropAttr>")" {
1038 BEGIN(FindMembers);
1039 }
1040<FindMembers>"@"{ID}("."{ID})+ {
1041 if (yyextra->insideJava) // Java annotation
1042 {
1043 // skip annotation
1044 }
1045 else
1046 {
1047 REJECT;
1048 }
1049 }
1050<FindMembers>"@"{ID} {
1051 if (yyextra->insideJava) // Java annotation
1052 {
1053 // skip annotation
1054 }
1055 else if (qstrcmp(yytext,"@property")==0) // ObjC 2.0 property
1056 {
1057 yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
1058 yyextra->current->spec.setWritable(true).setReadable(true);
1059 yyextra->current->protection = Protection::Public ;
1060 }
1061 else if (qstrcmp(yytext,"@synthesize")==0)
1062 {
1063 BEGIN( ObjCSkipStatement );
1064 }
1065 else if (qstrcmp(yytext,"@dynamic")==0)
1066 {
1067 BEGIN( ObjCSkipStatement );
1068 }
1069 else
1070 {
1071 REJECT;
1072 }
1073 }
int qstrcmp(const char *str1, const char *str2)
Definition qcstring.h:69
1074<ObjCSkipStatement>";" {
1075 BEGIN(FindMembers);
1076 }
1077<PackageName>{ID}(("."|"\\"){ID})* {
1078 yyextra->isTypedef=FALSE;
1079 //printf("Found namespace %s lang=%d\n",yytext,yyextra->current->lang);
1080 yyextra->current->name = yytext;
1081 yyextra->current->name = substitute(yyextra->current->name,".","::");
1082 yyextra->current->name = substitute(yyextra->current->name,"\\","::");
1083 yyextra->current->section = EntryType::makeNamespace();
1084 yyextra->current->type = "namespace" ;
1085 yyextra->current->fileName = yyextra->fileName;
1086 yyextra->current->startLine = yyextra->yyLineNr;
1087 yyextra->current->startColumn = yyextra->yyColNr;
1088 yyextra->current->bodyLine = yyextra->yyLineNr;
1089 yyextra->current->bodyColumn = yyextra->yyColNr;
1090 lineCount(yyscanner);
1091 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477
#define FALSE
Definition qcstring.h:34
1092<PackageName>";" {
1093 std::shared_ptr<Entry> tmp = yyextra->current;
1094 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
1095 yyextra->current_root = std::move(tmp);
1096 initEntry(yyscanner);
1097 BEGIN(FindMembers);
1098 }
static void initEntry(yyscan_t yyscanner)
1099<PackageName>"{" {
1100 yyextra->curlyCount=0;
1101 BEGIN( ReadNSBody );
1102 }
1103<FindMembers>{B}*"export"{BN}+"module"{BN}+ { // primary module interface unit
1104 if (!yyextra->insideCpp) REJECT;
1105 //printf("Interface module unit\n");
1106 yyextra->current->exported = true;
1107 lineCount(yyscanner);
1108 BEGIN( ModuleName );
1109 }
1110<FindMembers>{B}*"module"{BN}*";" { // global module section
1111 if (!yyextra->insideCpp) REJECT;
1112 if (!yyextra->current->type.isEmpty() || !yyextra->current->name.isEmpty()) REJECT;
1113 //printf("Implementation module unit\n");
1114 lineCount(yyscanner);
1115 BEGIN( FindMembers );
1116 }
1117<FindMembers>{B}*"module"{BN}+ { // module implementation unit
1118 if (!yyextra->insideCpp) REJECT;
1119 //printf("Implementation module unit\n");
1120 yyextra->current->exported = false;
1121 lineCount(yyscanner);
1122 BEGIN( ModuleName );
1123 }
1124<FindMembers>{B}*"export"{BN}+"import"{BN}+ { // export an imported module
1125 if (!yyextra->insideCpp) REJECT;
1126 yyextra->current->exported = true;
1127 lineCount(yyscanner);
1128 BEGIN( ModuleImport );
1129 }
1130<FindMembers>{B}*"import"{BN}+ { // start of a module import
1131 if (!yyextra->insideCpp) REJECT;
1132 lineCount(yyscanner);
1133 BEGIN( ModuleImport );
1134 }
1135<ModuleName>{MODULE_ID}{BN}*":"{BN}*{MODULE_ID} { // module partition name, e.g. A.B:C.D'
1136 QCString name = yytext;
1137 int i = name.find(':');
1138 QCString partition = name.mid(i+1).stripWhiteSpace();
1139 name = name.left(i).stripWhiteSpace();
1140 ModuleManager::instance().createModuleDef(yyextra->fileName,
1141 yyextra->yyLineNr,
1142 yyextra->yyColNr,
1143 yyextra->current->exported,
1144 name,
1145 partition);
1146 yyextra->current->section = EntryType::makeModuleDoc();
1147 yyextra->isTypedef=FALSE;
1148 addType(yyscanner);
1149 yyextra->current->type += " module";
1150 yyextra->current->fileName = yyextra->fileName;
1151 yyextra->current->startLine = yyextra->yyLineNr;
1152 yyextra->current->startColumn = yyextra->yyColNr;
1153 yyextra->current->bodyLine = yyextra->yyLineNr;
1154 yyextra->current->bodyColumn = yyextra->yyColNr;
1155 yyextra->current->name = name+":"+partition;
1156 lineCount(yyscanner);
1157 }
static ModuleManager & instance()
void createModuleDef(const QCString &fileName, int line, int column, bool exported, const QCString &moduleName, const QCString &partitionName=QCString())
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
1158<ModuleName>{MODULE_ID} { // primary module name, e.g. A.B
1159 ModuleManager::instance().createModuleDef(yyextra->fileName,
1160 yyextra->yyLineNr,
1161 yyextra->yyColNr,
1162 yyextra->current->exported,
1163 yytext);
1164 yyextra->current->section = EntryType::makeModuleDoc();
1165 yyextra->isTypedef=FALSE;
1166 addType(yyscanner);
1167 yyextra->current->type += " module";
1168 yyextra->current->fileName = yyextra->fileName;
1169 yyextra->current->startLine = yyextra->yyLineNr;
1170 yyextra->current->startColumn = yyextra->yyColNr;
1171 yyextra->current->bodyLine = yyextra->yyLineNr;
1172 yyextra->current->bodyColumn = yyextra->yyColNr;
1173 yyextra->current->name = yytext;
1174 lineCount(yyscanner);
1175 }
1176<ModuleName>":"{BN}+"private" { // start of private section of the module interface
1177 yyextra->current->exported = yyextra->exported = false;
1178 lineCount(yyscanner);
1179 }
1180<ModuleName>";" { unput(';');
1181 BEGIN(FindMembers);
1182 }
1183<ModuleName>\n { lineCount(yyscanner); }
1184<ModuleName>. {}
1185<ModuleImport>"\""[^"\n]*"\"" { // local header import
1186 ModuleManager::instance().addHeader(yyextra->fileName,
1187 yyextra->yyLineNr,
1188 QCString(yytext).mid(1,yyleng-2),
1189 false);
1190 }
void addHeader(const QCString &moduleFile, int line, const QCString &headerName, bool isSystem)
1191<ModuleImport>"<"[^>\n]*">" { // system header import
1192 ModuleManager::instance().addHeader(yyextra->fileName,
1193 yyextra->yyLineNr,
1194 QCString(yytext).mid(1,yyleng-2),
1195 true);
1196 }
1197<ModuleImport>{MODULE_ID}?{BN}*":"{BN}*{MODULE_ID} { // module partition import
1198 QCString name = yytext; // can be 'M:P' or ':P'
1199 int i = name.find(':');
1200 QCString partition = name.mid(i+1).stripWhiteSpace();
1201 name = name.left(i).stripWhiteSpace();
1202 ModuleManager::instance().addImport(yyextra->fileName,
1203 yyextra->yyLineNr,
1204 name,
1205 yyextra->current->exported,
1206 partition);
1207 lineCount(yyscanner);
1208 }
void addImport(const QCString &moduleFile, int line, const QCString &importName, bool isExported, const QCString &partitionName=QCString())
1209<ModuleImport>{MODULE_ID} { // module import
1210 ModuleManager::instance().addImport(yyextra->fileName,
1211 yyextra->yyLineNr,
1212 yytext,
1213 yyextra->current->exported);
1214 lineCount(yyscanner);
1215 }
1216<ModuleImport>";" { BEGIN(FindMembers); }
1217<ModuleImport>\n { lineCount(yyscanner); }
1218<ModuleImport>. {}
1219<FindMembers>{B}*"export"{BN}+"{" {
1220 yyextra->current->exported = yyextra->exported = true; // export block
1221 }
1222<FindMembers>{B}*"export"{BN}+ {
1223 if (!yyextra->insideCpp) REJECT;
1224 yyextra->current->exported=true;
1225 }
1226<FindMembers>{B}*"initonly"{BN}+ { if (yyextra->insideJava || yyextra->insideCpp) REJECT;
1227 yyextra->current->type += " initonly ";
1228 if (yyextra->insideCli) yyextra->current->spec.setInitonly(true);
1229 lineCount(yyscanner);
1230 }
1231<FindMembers>{B}*"static"{BN}*/"{" { yyextra->current->type += " static ";
1232 yyextra->current->isStatic = TRUE;
1233 lineCount(yyscanner);
1234 }
1235<FindMembers>{B}*"static"{BN}+ { yyextra->current->type += " static ";
1236 yyextra->current->isStatic = TRUE;
1237 lineCount(yyscanner);
1238 }
1239<FindMembers>{B}*"extern"{BN}+ { if (yyextra->insideJava) REJECT;
1240 yyextra->current->isStatic = FALSE;
1241 yyextra->current->explicitExternal = TRUE;
1242 lineCount(yyscanner);
1243 }
1244<FindMembers>{B}*"const"{BN}+ { if (yyextra->insideCS)
1245 {
1246 yyextra->current->type += " const ";
1247 if (yyextra->insideCS) yyextra->current->isStatic = TRUE;
1248 lineCount(yyscanner);
1249 }
1250 else
1251 {
1252 REJECT;
1253 }
1254 }
1255<FindMembers>{B}*"virtual"{BN}+ { if (yyextra->insideJava) REJECT;
1256 yyextra->current->type += " virtual ";
1257 yyextra->current->virt = Specifier::Virtual;
1258 lineCount(yyscanner);
1259 }
1260<FindMembers>{B}*"constexpr"{BN}+ {
1261 if (yyextra->insideCpp)
1262 {
1263 yyextra->current->spec.setConstExpr(true);
1264 }
1265 REJECT;
1266 }
1267<FindMembers>{B}*"consteval"{BN}+ {
1268 if (yyextra->insideCpp)
1269 {
1270 yyextra->current->spec.setConstEval(true);
1271 }
1272 REJECT;
1273 }
1274<FindMembers>{B}*"constinit"{BN}+ {
1275 if (yyextra->insideCpp)
1276 {
1277 yyextra->current->spec.setConstInit(true);
1278 }
1279 REJECT;
1280 }
1281<FindMembers>{B}*"published"{BN}+ { // UNO IDL published keyword
1282 if (yyextra->insideIDL)
1283 {
1284 lineCount(yyscanner);
1285 yyextra->current->spec.setPublished(true);
1286 }
1287 else
1288 {
1289 REJECT;
1290 }
1291 }
1292<FindMembers>{B}*"sealed"{BN}+ {
1293 if (yyextra->insideCS)
1294 {
1295 yyextra->current->spec.setSealed(true);
1296 }
1297 else
1298 {
1299 REJECT;
1300 }
1301 }
1302<FindMembers>{B}*"abstract"{BN}+ {
1303 if (yyextra->insidePHP || yyextra->insideCS)
1304 {
1305 yyextra->current->spec.setAbstract(true);
1306 }
1307 else
1308 {
1309 if (yyextra->insideCpp) REJECT;
1310 yyextra->current->type += " abstract ";
1311 if (!yyextra->insideJava)
1312 {
1313 yyextra->current->virt = Specifier::Pure;
1314 }
1315 else
1316 {
1317 yyextra->current->spec.setAbstract(true);
1318 }
1319 }
1320 lineCount(yyscanner);
1321 }
@ Pure
Definition types.h:29
1322<FindMembers>{B}*"inline"{BN}+ { if (yyextra->insideJava) REJECT;
1323 yyextra->current->spec.setInline(true);
1324 lineCount(yyscanner);
1325 }
1326<FindMembers>{B}*"mutable"{BN}+ { if (yyextra->insideJava) REJECT;
1327 yyextra->current->spec.setMutable(true);
1328 lineCount(yyscanner);
1329 }
1330<FindMembers>{B}*"explicit"{BN}+ { if (yyextra->insideJava) REJECT;
1331 yyextra->current->spec.setExplicit(true);
1332 lineCount(yyscanner);
1333 }
1334<FindMembers>{B}*"local"{BN}+ { if (yyextra->insideJava || yyextra->insideCpp) REJECT;
1335 yyextra->current->spec.setLocal(true);
1336 lineCount(yyscanner);
1337 }
1338<FindMembers>{B}*"@required"{BN}+ { // Objective C 2.0 protocol required section
1339 yyextra->current->spec.setOptional(false).setRequired(true);
1340 lineCount(yyscanner);
1341 }
1342<FindMembers>{B}*"@optional"{BN}+ { // Objective C 2.0 protocol optional section
1343 yyextra->current->spec.setRequired(false).setOptional(true);
1344 lineCount(yyscanner);
1345 }
1346 /*
1347<FindMembers>{B}*"import"{BN}+ { // IDL import keyword
1348 BEGIN( NextSemi );
1349 }
1350 */
1351<FindMembers>{B}*"typename"{BN}+ { lineCount(yyscanner); }
1352<FindMembers>{B}*"namespace"{BNopt}/[^a-z_A-Z0-9] { if (yyextra->insideJava) REJECT;
1353 yyextra->isTypedef=FALSE;
1354 yyextra->current->section = EntryType::makeNamespace();
1355 yyextra->current->type = "namespace" ;
1356 yyextra->current->fileName = yyextra->fileName;
1357 yyextra->current->startLine = yyextra->yyLineNr;
1358 yyextra->current->startColumn = yyextra->yyColNr;
1359 yyextra->current->bodyLine = yyextra->yyLineNr;
1360 yyextra->current->bodyColumn = yyextra->yyColNr;
1361 lineCount(yyscanner);
1362 if (yyextra->insidePHP)
1363 {
1364 BEGIN( PackageName );
1365 }
1366 else
1367 {
1368 BEGIN( CompoundName );
1369 }
1370 }
1371<FindMembers>{B}*"module"{BN}+ {
1372 lineCount(yyscanner);
1373 if (yyextra->insideIDL || yyextra->insideSlice)
1374 {
1375 yyextra->isTypedef=FALSE;
1376 yyextra->current->section = EntryType::makeNamespace();
1377 yyextra->current->type = "module" ;
1378 yyextra->current->fileName = yyextra->fileName;
1379 yyextra->current->startLine = yyextra->yyLineNr;
1380 yyextra->current->startColumn = yyextra->yyColNr;
1381 yyextra->current->bodyLine = yyextra->yyLineNr;
1382 yyextra->current->bodyColumn = yyextra->yyColNr;
1383 BEGIN( CompoundName );
1384 }
1385 else if (yyextra->insideD)
1386 {
1387 lineCount(yyscanner);
1388 BEGIN(PackageName);
1389 }
1390 else
1391 {
1392 addType(yyscanner);
1393 yyextra->current->name = QCString(yytext).stripWhiteSpace();
1394 }
1395 }
1396<FindMembers>{B}*"library"{BN}+ {
1397 lineCount(yyscanner);
1398 if (yyextra->insideIDL)
1399 {
1400 yyextra->isTypedef=FALSE;
1401 yyextra->current->section = EntryType::makeNamespace();
1402 yyextra->current->type = "library" ;
1403 yyextra->current->fileName = yyextra->fileName;
1404 yyextra->current->startLine = yyextra->yyLineNr;
1405 yyextra->current->startColumn = yyextra->yyColNr;
1406 yyextra->current->bodyLine = yyextra->yyLineNr;
1407 yyextra->current->bodyColumn = yyextra->yyColNr;
1408 BEGIN( CompoundName );
1409 }
1410 else
1411 {
1412 addType(yyscanner);
1413 yyextra->current->name = QCString(yytext).stripWhiteSpace();
1414 }
1415 }
1416<FindMembers>{B}*"constants"{BN}+ { // UNO IDL constant group
1417 lineCount(yyscanner);
1418 if (yyextra->insideIDL)
1419 {
1420 yyextra->isTypedef=FALSE;
1421 yyextra->current->section = EntryType::makeNamespace();
1422 yyextra->current->type = "constants";
1423 yyextra->current->fileName = yyextra->fileName;
1424 yyextra->current->startLine = yyextra->yyLineNr;
1425 yyextra->current->startColumn = yyextra->yyColNr;
1426 yyextra->current->bodyLine = yyextra->yyLineNr;
1427 yyextra->current->bodyColumn = yyextra->yyColNr;
1428 BEGIN( CompoundName );
1429 }
1430 else
1431 {
1432 addType(yyscanner);
1433 yyextra->current->name = QCString(yytext).stripWhiteSpace();
1434 }
1435 }
1436<FindMembers>{BN}*("service"){BN}+ { // UNO IDL service
1437 lineCount(yyscanner);
1438 if (yyextra->insideIDL)
1439 {
1440 yyextra->isTypedef=FALSE;
1441 yyextra->current->section = EntryType::makeClass();
1442 TypeSpecifier spec = yyextra->current->spec;
1443 yyextra->current->spec = TypeSpecifier().setService(true).
1444 // preserve UNO IDL [optional] or published
1445 setOptional(spec.isOptional()).setPublished(spec.isPublished());
1446 addType(yyscanner);
1447 yyextra->current->type += " service " ;
1448 yyextra->current->fileName = yyextra->fileName;
1449 yyextra->current->startLine = yyextra->yyLineNr;
1450 yyextra->current->bodyLine = yyextra->yyLineNr;
1451 yyextra->current->bodyColumn = yyextra->yyColNr;
1452 BEGIN( CompoundName );
1453 }
1454 else // TODO is addType right? just copy/pasted
1455 {
1456 addType(yyscanner);
1457 yyextra->current->name = QCString(yytext).stripWhiteSpace();
1458 }
1459 }
Wrapper class for a number of boolean properties.
Definition types.h:492
1460<FindMembers>{BN}*("singleton"){BN}+ { // UNO IDL singleton
1461 lineCount(yyscanner);
1462 if (yyextra->insideIDL)
1463 {
1464 yyextra->isTypedef=FALSE;
1465 yyextra->current->section = EntryType::makeClass();
1466 TypeSpecifier spec = yyextra->current->spec;
1467 yyextra->current->spec = TypeSpecifier().setSingleton(true).
1468 setPublished(spec.isPublished()); // preserve
1469 addType(yyscanner);
1470 yyextra->current->type += " singleton " ;
1471 yyextra->current->fileName = yyextra->fileName;
1472 yyextra->current->startLine = yyextra->yyLineNr;
1473 yyextra->current->bodyLine = yyextra->yyLineNr;
1474 yyextra->current->bodyColumn = yyextra->yyColNr;
1475 BEGIN( CompoundName );
1476 }
1477 else // TODO is addType right? just copy/pasted
1478 {
1479 addType(yyscanner);
1480 yyextra->current->name = QCString(yytext).stripWhiteSpace();
1481 }
1482 }
1483<FindMembers>{BN}*((("disp")?"interface")|"valuetype"){BN}+ { // M$/Corba/UNO IDL/Java/Slice interface
1484 lineCount(yyscanner);
1485 if (yyextra->insideIDL || yyextra->insideJava || yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideSlice)
1486 {
1487 yyextra->isTypedef=FALSE;
1488 yyextra->current->section = EntryType::makeClass();
1489 TypeSpecifier spec = yyextra->current->spec;
1490 yyextra->current->spec = TypeSpecifier().setInterface(true).
1491 // preserve UNO IDL [optional], published, Slice local
1492 setOptional(spec.isOptional()).
1493 setPublished(spec.isPublished()).
1494 setLocal(spec.isLocal());
1495 addType(yyscanner);
1496 yyextra->current->type += " interface" ;
1497 yyextra->current->fileName = yyextra->fileName;
1498 yyextra->current->startLine = yyextra->yyLineNr;
1499 yyextra->current->startColumn = yyextra->yyColNr;
1500 yyextra->current->bodyLine = yyextra->yyLineNr;
1501 yyextra->current->bodyColumn = yyextra->yyColNr;
1502 setJavaProtection(yyscanner);
1503 BEGIN( CompoundName );
1504 }
1505 else
1506 {
1507 addType(yyscanner);
1508 yyextra->current->name = QCString(yytext).stripWhiteSpace();
1509 }
1510 }
1511<FindMembers>{B}*"@implementation"{BN}+ { // Objective-C class implementation
1512 lineCount(yyscanner);
1513 yyextra->isTypedef=FALSE;
1514 yyextra->current->section = EntryType::makeObjcImpl();
1515 yyextra->language = yyextra->current->lang = SrcLangExt::ObjC;
1516 yyextra->insideObjC = TRUE;
1517 yyextra->current->protection = yyextra->protection = Protection::Public ;
1518 addType(yyscanner);
1519 yyextra->current->type += " implementation" ;
1520 yyextra->current->fileName = yyextra->fileName;
1521 yyextra->current->startLine = yyextra->yyLineNr;
1522 yyextra->current->bodyLine = yyextra->yyLineNr;
1523 yyextra->current->bodyColumn = yyextra->yyColNr;
1524 BEGIN( CompoundName );
1525 }
1526<FindMembers>{B}*"@interface"{BN}+ { // Objective-C class interface, or Java attribute
1527 lineCount(yyscanner);
1528 yyextra->isTypedef=FALSE;
1529 yyextra->current->section = EntryType::makeClass();
1530 yyextra->current->spec = TypeSpecifier().setInterface(true);
1531 if (!yyextra->insideJava)
1532 {
1533 yyextra->language = yyextra->current->lang = SrcLangExt::ObjC;
1534 yyextra->insideObjC = TRUE;
1535 }
1536 yyextra->current->protection = yyextra->protection = Protection::Public ;
1537 addType(yyscanner);
1538 yyextra->current->type += " interface" ;
1539 yyextra->current->fileName = yyextra->fileName;
1540 yyextra->current->startLine = yyextra->yyLineNr;
1541 yyextra->current->startColumn = yyextra->yyColNr;
1542 yyextra->current->bodyLine = yyextra->yyLineNr;
1543 yyextra->current->bodyColumn = yyextra->yyColNr;
1544 BEGIN( CompoundName );
1545 }
1546<FindMembers>{B}*"@protocol"{BN}+ { // Objective-C protocol definition
1547 lineCount(yyscanner);
1548 yyextra->isTypedef=FALSE;
1549 yyextra->current->section = EntryType::makeClass();
1550 yyextra->current->spec = TypeSpecifier().setProtocol(true);
1551 yyextra->language = yyextra->current->lang = SrcLangExt::ObjC;
1552 yyextra->insideObjC = TRUE;
1553 yyextra->current->protection = yyextra->protection = Protection::Public ;
1554 addType(yyscanner);
1555 yyextra->current->type += " protocol" ;
1556 yyextra->current->fileName = yyextra->fileName;
1557 yyextra->current->startLine = yyextra->yyLineNr;
1558 yyextra->current->startColumn = yyextra->yyColNr;
1559 yyextra->current->bodyLine = yyextra->yyLineNr;
1560 yyextra->current->bodyColumn = yyextra->yyColNr;
1561 BEGIN( CompoundName );
1562 }
1563<FindMembers>{B}*"exception"{BN}+ { // Corba IDL/Slice exception
1564 if (yyextra->insideJava || yyextra->insideCpp) REJECT;
1565 yyextra->isTypedef=FALSE;
1566 yyextra->current->section = EntryType::makeClass();
1567 TypeSpecifier spec = yyextra->current->spec;
1568 // preserve UNO IDL, Slice local
1569 yyextra->current->spec = TypeSpecifier().setException(true).
1570 setPublished(spec.isPublished()).setLocal(spec.isLocal());
1571 addType(yyscanner);
1572 yyextra->current->type += " exception" ;
1573 yyextra->current->fileName = yyextra->fileName;
1574 yyextra->current->startLine = yyextra->yyLineNr;
1575 yyextra->current->startColumn = yyextra->yyColNr;
1576 yyextra->current->bodyLine = yyextra->yyLineNr;
1577 yyextra->current->bodyColumn = yyextra->yyColNr;
1578 lineCount(yyscanner);
1579 BEGIN( CompoundName );
1580 }
1581<FindMembers>"@class" | // for Objective C class declarations
1582<FindMembers>{B}*{TYPEDEFPREFIX}"class{" |
1583<FindMembers>{B}*{TYPEDEFPREFIX}"class"{BN}+ {
1584 QCString decl = yytext;
1585 yyextra->isTypedef=decl.find("typedef")!=-1;
1586 bool isConst=decl.find("const")!=-1;
1587 bool isVolatile=decl.find("volatile")!=-1;
1588 yyextra->current->section = EntryType::makeClass();
1589 addType(yyscanner);
1590 if (yyextra->insidePHP && yyextra->current->spec.isAbstract())
1591 {
1592 // convert Abstract to AbstractClass
1593 yyextra->current->spec.setAbstract(false).setAbstractClass(true);
1594 }
1595 if (yyextra->insideSlice && yyextra->current->spec.isLocal())
1596 {
1597 yyextra->current->spec.setLocal(true);
1598 }
1599 if (isConst)
1600 {
1601 yyextra->current->type += " const";
1602 }
1603 else if (isVolatile)
1604 {
1605 yyextra->current->type += " volatile";
1606 }
1607 yyextra->current->type += " class" ;
1608 yyextra->current->fileName = yyextra->fileName;
1609 yyextra->current->startLine = yyextra->yyLineNr;
1610 yyextra->current->startColumn = yyextra->yyColNr;
1611 yyextra->current->bodyLine = yyextra->yyLineNr;
1612 yyextra->current->bodyColumn = yyextra->yyColNr;
1613 if (yytext[0]=='@')
1614 {
1615 yyextra->language = yyextra->current->lang = SrcLangExt::ObjC;
1616 yyextra->insideObjC = TRUE;
1617 }
1618 lineCount(yyscanner) ;
1619 if (yytext[yyleng-1]=='{') unput('{');
1620 BEGIN( CompoundName ) ;
1621 }
1622<FindMembers>{B}*"value class{" | // C++/CLI extension
1623<FindMembers>{B}*"value class"{BN}+ {
1624 yyextra->isTypedef=FALSE;
1625 yyextra->current->section = EntryType::makeClass();
1626 yyextra->current->spec = TypeSpecifier().setValue(true);
1627 addType(yyscanner);
1628 yyextra->current->type += " value class" ;
1629 yyextra->current->fileName = yyextra->fileName;
1630 yyextra->current->startLine = yyextra->yyLineNr;
1631 yyextra->current->startColumn = yyextra->yyColNr;
1632 yyextra->current->bodyLine = yyextra->yyLineNr;
1633 yyextra->current->bodyColumn = yyextra->yyColNr;
1634 lineCount(yyscanner) ;
1635 if (yytext[yyleng-1]=='{') unput('{');
1636 BEGIN( CompoundName ) ;
1637 }
1638<FindMembers>{B}*"ref class{" | // C++/CLI extension
1639<FindMembers>{B}*"ref class"{BN}+ {
1640 yyextra->isTypedef=FALSE;
1641 yyextra->current->section = EntryType::makeClass();
1642 yyextra->current->spec = TypeSpecifier().setRef(true);
1643 addType(yyscanner);
1644 yyextra->current->type += " ref class" ;
1645 yyextra->current->fileName = yyextra->fileName;
1646 yyextra->current->startLine = yyextra->yyLineNr;
1647 yyextra->current->startColumn = yyextra->yyColNr;
1648 yyextra->current->bodyLine = yyextra->yyLineNr;
1649 yyextra->current->bodyColumn = yyextra->yyColNr;
1650 lineCount(yyscanner) ;
1651 if (yytext[yyleng-1]=='{') unput('{');
1652 BEGIN( CompoundName ) ;
1653 }
1654<FindMembers>{B}*"interface class{" | // C++/CLI extension
1655<FindMembers>{B}*"interface class"{BN}+ {
1656 yyextra->isTypedef=FALSE;
1657 yyextra->current->section = EntryType::makeClass();
1658 yyextra->current->spec = TypeSpecifier().setInterface(true);
1659 addType(yyscanner);
1660 yyextra->current->type += " interface class" ;
1661 yyextra->current->fileName = yyextra->fileName;
1662 yyextra->current->startLine = yyextra->yyLineNr;
1663 yyextra->current->startColumn = yyextra->yyColNr;
1664 yyextra->current->bodyLine = yyextra->yyLineNr;
1665 yyextra->current->bodyColumn = yyextra->yyColNr;
1666 lineCount(yyscanner) ;
1667 if (yytext[yyleng-1]=='{') unput('{');
1668 BEGIN( CompoundName ) ;
1669 }
1670<FindMembers>{B}*"coclass"{BN}+ {
1671 if (yyextra->insideIDL)
1672 {
1673 yyextra->isTypedef=FALSE;
1674 yyextra->current->section = EntryType::makeClass();
1675 addType(yyscanner);
1676 yyextra->current->type += " coclass" ;
1677 yyextra->current->fileName = yyextra->fileName;
1678 yyextra->current->startLine = yyextra->yyLineNr;
1679 yyextra->current->startColumn = yyextra->yyColNr;
1680 yyextra->current->bodyLine = yyextra->yyLineNr;
1681 yyextra->current->bodyColumn = yyextra->yyColNr;
1682 lineCount(yyscanner) ;
1683 BEGIN( CompoundName ) ;
1684 }
1685 else
1686 {
1687 addType(yyscanner);
1688 yyextra->current->name = yytext;
1689 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
1690 lineCount(yyscanner);
1691 }
1692 }
1693<FindMembers>{B}*{TYPEDEFPREFIX}"struct{" |
1694<FindMembers>{B}*{TYPEDEFPREFIX}"struct"/{BN}+ {
1695 if (yyextra->insideJava) REJECT;
1696 QCString decl = yytext;
1697 yyextra->isTypedef=decl.find("typedef")!=-1;
1698 bool isConst=decl.find("const")!=-1;
1699 bool isVolatile=decl.find("volatile")!=-1;
1700 yyextra->current->section = EntryType::makeClass() ;
1701 TypeSpecifier spec = yyextra->current->spec;
1702 yyextra->current->spec = TypeSpecifier().setStruct(true).
1703 // preserve UNO IDL & Inline attributes, Slice local
1704 setPublished(spec.isPublished()).
1705 setInline(spec.isInline()).
1706 setLocal(spec.isLocal());
1707 // bug 582676: can be a struct nested in an interface so keep yyextra->insideObjC state
1708 //yyextra->current->objc = yyextra->insideObjC = FALSE;
1709 addType(yyscanner);
1710 if (isConst)
1711 {
1712 yyextra->current->type += " const";
1713 }
1714 else if (isVolatile)
1715 {
1716 yyextra->current->type += " volatile";
1717 }
1718 yyextra->current->type += " struct" ;
1719 yyextra->current->fileName = yyextra->fileName;
1720 yyextra->current->startLine = yyextra->yyLineNr;
1721 yyextra->current->startColumn = yyextra->yyColNr;
1722 yyextra->current->bodyLine = yyextra->yyLineNr;
1723 yyextra->current->bodyColumn = yyextra->yyColNr;
1724 lineCount(yyscanner) ;
1725 if (yytext[yyleng-1]=='{') unput('{');
1726 BEGIN( CompoundName ) ;
1727 }
1728<FindMembers>{B}*"value struct{" | // C++/CLI extension
1729<FindMembers>{B}*"value struct"{BN}+ {
1730 yyextra->isTypedef=FALSE;
1731 yyextra->current->section = EntryType::makeClass();
1732 yyextra->current->spec = TypeSpecifier().setStruct(true).setValue(true);
1733 addType(yyscanner);
1734 yyextra->current->type += " value struct" ;
1735 yyextra->current->fileName = yyextra->fileName;
1736 yyextra->current->startLine = yyextra->yyLineNr;
1737 yyextra->current->startColumn = yyextra->yyColNr;
1738 yyextra->current->bodyLine = yyextra->yyLineNr;
1739 yyextra->current->bodyColumn = yyextra->yyColNr;
1740 lineCount(yyscanner) ;
1741 if (yytext[yyleng-1]=='{') unput('{');
1742 BEGIN( CompoundName ) ;
1743 }
1744<FindMembers>{B}*"ref struct{" | // C++/CLI extension
1745<FindMembers>{B}*"ref struct"{BN}+ {
1746 yyextra->isTypedef=FALSE;
1747 yyextra->current->section = EntryType::makeClass();
1748 yyextra->current->spec = TypeSpecifier().setStruct(true).setRef(true);
1749 addType(yyscanner);
1750 yyextra->current->type += " ref struct" ;
1751 yyextra->current->fileName = yyextra->fileName;
1752 yyextra->current->startLine = yyextra->yyLineNr;
1753 yyextra->current->startColumn = yyextra->yyColNr;
1754 yyextra->current->bodyLine = yyextra->yyLineNr;
1755 yyextra->current->bodyColumn = yyextra->yyColNr;
1756 lineCount(yyscanner) ;
1757 if (yytext[yyleng-1]=='{') unput('{');
1758 BEGIN( CompoundName ) ;
1759 }
1760<FindMembers>{B}*"interface struct{" | // C++/CLI extension
1761<FindMembers>{B}*"interface struct"{BN}+ {
1762 yyextra->isTypedef=FALSE;
1763 yyextra->current->section = EntryType::makeClass();
1764 yyextra->current->spec = TypeSpecifier().setStruct(true).setInterface(true);
1765 addType(yyscanner);
1766 yyextra->current->type += " interface struct";
1767 yyextra->current->fileName = yyextra->fileName;
1768 yyextra->current->startLine = yyextra->yyLineNr;
1769 yyextra->current->startColumn = yyextra->yyColNr;
1770 yyextra->current->bodyLine = yyextra->yyLineNr;
1771 yyextra->current->bodyColumn = yyextra->yyColNr;
1772 lineCount(yyscanner) ;
1773 if (yytext[yyleng-1]=='{') unput('{');
1774 BEGIN( CompoundName ) ;
1775 }
1776<FindMembers>{B}*{TYPEDEFPREFIX}"union{" |
1777<FindMembers>{B}*{TYPEDEFPREFIX}"union"{BN}+ {
1778 if (yyextra->insideJava) REJECT;
1779 QCString decl=yytext;
1780 yyextra->isTypedef=decl.find("typedef")!=-1;
1781 bool isConst=decl.find("const")!=-1;
1782 bool isVolatile=decl.find("volatile")!=-1;
1783 yyextra->current->section = EntryType::makeClass();
1784 yyextra->current->spec = TypeSpecifier().setUnion(true);
1785 // bug 582676: can be a struct nested in an interface so keep yyextra->insideObjC state
1786 //yyextra->current->objc = yyextra->insideObjC = FALSE;
1787 addType(yyscanner);
1788 if (isConst)
1789 {
1790 yyextra->current->type += " const";
1791 }
1792 else if (isVolatile)
1793 {
1794 yyextra->current->type += " volatile";
1795 }
1796 yyextra->current->type += " union" ;
1797 yyextra->current->fileName = yyextra->fileName;
1798 yyextra->current->startLine = yyextra->yyLineNr;
1799 yyextra->current->startColumn = yyextra->yyColNr;
1800 yyextra->current->bodyLine = yyextra->yyLineNr;
1801 yyextra->current->bodyColumn = yyextra->yyColNr;
1802 lineCount(yyscanner) ;
1803 if (yytext[yyleng-1]=='{') unput('{');
1804 BEGIN( CompoundName ) ;
1805 }
1806<FindMembers>{B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?"{" |
1807<FindMembers>{B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?{BN}+ { // for IDL: typedef [something] enum
1808 QCString text=yytext;
1809 yyextra->isTypedef = text.find("typedef")!=-1;
1810 bool isStrongEnum = text.find("class")!=-1 || yyextra->insideCS;
1811 bool isEnumSytruct = text.find("struct")!=-1;
1812 if (yyextra->insideJava)
1813 {
1814 yyextra->current->section = EntryType::makeClass();
1815 setJavaProtection(yyscanner);
1816 yyextra->current->spec = TypeSpecifier().setEnum(true);
1817 }
1818 else
1819 {
1820 yyextra->current->section = EntryType::makeEnum() ;
1821 }
1822 addType(yyscanner);
1823 yyextra->current->type += " enum";
1824 if (isStrongEnum)
1825 {
1826 yyextra->current->spec.setStrong(true);
1827 }
1828 if (isEnumSytruct)
1829 {
1830 yyextra->current->spec.setStrong(true).setEnumStruct(true);
1831 }
1832 yyextra->current->fileName = yyextra->fileName;
1833 yyextra->current->startLine = yyextra->yyLineNr;
1834 yyextra->current->startColumn = yyextra->yyColNr;
1835 yyextra->current->bodyLine = yyextra->yyLineNr;
1836 yyextra->current->bodyColumn = yyextra->yyColNr;
1837 lineCount(yyscanner) ;
1838 if (yytext[yyleng-1]=='{') unput('{');
1839 BEGIN( CompoundName ) ;
1840 }
1841<FindMembers>{B}*"concept"{BN}+ { // C++20 concept
1842 if (yyextra->insideJava) REJECT;
1843 yyextra->isTypedef=FALSE;
1844 yyextra->current->section = EntryType::makeConcept();
1845 addType(yyscanner);
1846 yyextra->current->type += " concept";
1847 yyextra->current->fileName = yyextra->fileName;
1848 yyextra->current->startLine = yyextra->yyLineNr;
1849 yyextra->current->startColumn = yyextra->yyColNr;
1850 yyextra->current->bodyLine = yyextra->yyLineNr;
1851 yyextra->current->bodyColumn = yyextra->yyColNr;
1852 lineCount(yyscanner) ;
1853 BEGIN( ConceptName ) ;
1854 }
1855<Operator>"("{BN}*")"({BN}*"<"[^>]*">"){BNopt}/"(" { // A::operator()<int>(int arg)
1856 lineCount(yyscanner);
1857 yyextra->current->name += "()";
1858 BEGIN( FindMembers );
1859 }
1860<Operator>"("{BN}*")"{BNopt}/"(" {
1861 lineCount(yyscanner);
1862 yyextra->current->name += yytext ;
1863 yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
1864 BEGIN( FindMembers ) ;
1865 }
1866<Operator>";" { // can occur when importing members
1867 unput(';');
1868 BEGIN( FindMembers ) ;
1869 }
1870<Operator>[^(] {
1871 lineCount(yyscanner);
1872 yyextra->current->name += *yytext ;
1873 }
1874<Operator>"<"({B}*{ID}{B}*(","{B}*{BN})*{B}*)?">" { /* skip guided templ specifiers */
1875 if (!yyextra->current->type.startsWith("friend "))
1876 {
1877 yyextra->current->name += yytext;
1878 }
1879 }
1880<Operator>"(" {
1881 yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
1882 unput(*yytext);
1883 BEGIN( FindMembers ) ;
1884 }
1885<FindMembers>("template"|"generic")({BN}*)"<"/[>]? { // generic is a C++/CLI extension
1886 lineCount(yyscanner);
1887 ArgumentList al;
1888 yyextra->current->tArgLists.push_back(al);
1889 yyextra->currentArgumentList = &yyextra->current->tArgLists.back();
1890 yyextra->templateStr="<";
1891 yyextra->fullArgString = yyextra->templateStr;
1892 yyextra->copyArgString = &yyextra->templateStr;
1893 yyextra->currentArgumentContext = FindMembers;
1894 BEGIN( ReadTempArgs );
1895 }
void push_back(const Argument &a)
Definition arguments.h:102
1896<FindMembers>"namespace"{BN}+/{ID}{BN}*"=" { // namespace alias
1897 if (yyextra->insideJava) REJECT;
1898 lineCount(yyscanner);
1899 BEGIN( NSAliasName );
1900 }
1901<NSAliasName>{ID} {
1902 yyextra->aliasName = yytext;
1903 BEGIN( NSAliasArg );
1904 }
1905<NSAliasArg>({ID}"::")*{ID} {
1906 //printf("Inserting namespace alias %s::%s->%s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->aliasName),yytext);
1907 std::string ctx = yyextra->current_root->name.str();
1908 if (ctx.empty())
1909 {
1910 Doxygen::namespaceAliasMap.emplace(yyextra->aliasName.str(),NamespaceAliasInfo(std::string(yytext),std::string()));
1911 }
1912 else
1913 {
1914 Doxygen::namespaceAliasMap.emplace(ctx+"::"+yyextra->aliasName.str(),NamespaceAliasInfo(std::string(yytext),ctx));
1915 }
1916 }
static NamespaceAliasInfoMap namespaceAliasMap
Definition doxygen.h:113
1917<NSAliasArg>";" {
1918 BEGIN( FindMembers );
1919 }
1920<PHPUse>({ID}{BN}*"\\"{BN}*)*{ID}/{BN}+"as" {
1921 lineCount(yyscanner);
1922 yyextra->aliasName=yytext;
1923 BEGIN(PHPUseAs);
1924 }
1925<PHPUse>({ID}{BN}*"\\"{BN}*)*{ID} {
1926 lineCount(yyscanner);
1927 yyextra->current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::"));
1928 //printf("PHP: adding use relation: %s\n",qPrint(yyextra->current->name));
1929 yyextra->current->fileName = yyextra->fileName;
1930 // add a using declaration
1931 yyextra->current->section = EntryType::makeUsingDecl();
1932 yyextra->current_root->copyToSubEntry(yyextra->current);
1933 // also add it as a using directive
1934 yyextra->current->section = EntryType::makeUsingDir();
1935 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
1936 initEntry(yyscanner);
1937 yyextra->aliasName.clear();
1938 }
QCString removeRedundantWhiteSpace(const QCString &s)
Definition util.cpp:578
1939<PHPUseAs>{BN}+"as"{BN}+ {
1940 lineCount(yyscanner);
1941 }
1942<PHPUseAs>{PHPUSEKW} {
1943 }
1944<PHPUseAs>{ID} {
1945 //printf("PHP: adding use as relation: %s->%s\n",yytext,qPrint(yyextra->aliasName));
1946 if (!yyextra->aliasName.isEmpty())
1947 {
1948 std::string aliasValue = removeRedundantWhiteSpace(substitute(yyextra->aliasName,"\\","::")).str();
1949 Doxygen::namespaceAliasMap.emplace(yytext,NamespaceAliasInfo(aliasValue));
1950 }
1951 yyextra->aliasName.clear();
1952 }
const std::string & str() const
Definition qcstring.h:537
1953<PHPUse,PHPUseAs>[,;] {
1954 if (*yytext==',')
1955 {
1956 BEGIN(PHPUse);
1957 }
1958 else
1959 {
1960 BEGIN(FindMembers);
1961 }
1962 }
1963<JavaImport>({ID}{BN}*"."{BN}*)+"*" { // package import => add as a using directive
1964 lineCount(yyscanner);
1965 QCString scope=yytext;
1966 yyextra->current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::"));
1967 yyextra->current->fileName = yyextra->fileName;
1968 bool ambig = false;
1969 FileDef *incFd = findFileDef(Doxygen::inputNameLinkedMap,yyextra->fileName,ambig);
1970 if (incFd)
1971 {
1972 incFd->addIncludeDependency(nullptr,scope,IncludeKind::ImportModule);
1973 }
1974 yyextra->current->section = EntryType::makeUsingDir();
1975 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
1976 initEntry(yyscanner);
1977 BEGIN(Using);
1978 }
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:105
A model of a file symbol.
Definition filedef.h:99
virtual void addIncludeDependency(const FileDef *fd, const QCString &incName, IncludeKind kind)=0
@ ImportModule
Definition filedef.h:55
FileDef * findFileDef(const FileNameLinkedMap *fnMap, const QCString &n, bool &ambig)
Definition util.cpp:3408
1979<JavaImport>({ID}{BN}*"."{BN}*)+{ID} { // class import => add as a using declaration
1980 lineCount(yyscanner);
1981 QCString scope=yytext;
1982 yyextra->current->name=removeRedundantWhiteSpace(substitute(scope,".","::"));
1983 yyextra->current->fileName = yyextra->fileName;
1984 bool ambig = false;
1985 FileDef *fromFd = findFileDef(Doxygen::inputNameLinkedMap,yyextra->fileName,ambig);
1986 FileDef *toFd = findFileDef(Doxygen::inputNameLinkedMap,scope,ambig);
1987 if (fromFd)
1988 {
1990 }
1991 if (toFd && fromFd)
1992 {
1994 }
1995 if (yyextra->insideD)
1996 {
1997 yyextra->current->section = EntryType::makeUsingDir();
1998 }
1999 else
2000 {
2001 //printf("import name = %s -> %s\n",yytext,qPrint(yyextra->current->name));
2002 yyextra->current->section = EntryType::makeUsingDecl();
2003 }
2004 yyextra->previous = yyextra->current;
2005 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2006 initEntry(yyscanner);
2007 BEGIN(Using);
2008 }
virtual void addIncludedByDependency(const FileDef *fd, const QCString &incName, IncludeKind kind)=0
virtual const QCString & docName() const =0
2009<IDLImport>"\""[^"]*"\"" {
2010 QCString fileName(&yytext[1],yyleng-2);
2011 bool ambig = false;
2012 FileDef *fromFd = findFileDef(Doxygen::inputNameLinkedMap,yyextra->fileName,ambig);
2013 FileDef *toFd = findFileDef(Doxygen::inputNameLinkedMap,fileName,ambig);
2014 if (fromFd)
2015 {
2016 fromFd->addIncludeDependency(toFd,fileName,IncludeKind::ImportModule);
2017 }
2018 if (toFd && fromFd)
2019 {
2021 }
2022 }
2023<IDLImport>";" {
2024 BEGIN(FindMembers);
2025 }
2026<FindMembers>"using"{BN}+/("::"{ID}("::"{ID})*)? {
2027 if (yyextra->insideJava) REJECT;
2028 yyextra->current->startLine=yyextra->yyLineNr;
2029 yyextra->current->startColumn = yyextra->yyColNr;
2030 lineCount(yyscanner);
2031 BEGIN(Using);
2032 }
2033<Using>"namespace"{BN}+ { lineCount(yyscanner); BEGIN(UsingDirective); }
2034<Using>("::")?({ID}{BN}*("::"|"."){BN}*)*({ID}|{OPERATOR}|{FUNCOP}) {
2035 lineCount(yyscanner);
2036 yyextra->current->name=yytext;
2037 yyextra->current->fileName = yyextra->fileName;
2038 yyextra->current->section = EntryType::makeUsingDecl();
2039 yyextra->current->startLine = yyextra->yyLineNr;
2040 yyextra->previous = yyextra->current;
2041 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2042 initEntry(yyscanner);
2043 if (yyextra->insideCS) /* Hack: in C# a using declaration and
2044 directive have the same syntax, so we
2045 also add it as a using directive here
2046 */
2047 {
2048 yyextra->current->name=yytext;
2049 yyextra->current->fileName = yyextra->fileName;
2050 yyextra->current->startLine = yyextra->yyLineNr;
2051 yyextra->current->startColumn = yyextra->yyColNr;
2052 yyextra->current->section = EntryType::makeUsingDir();
2053 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2054 initEntry(yyscanner);
2055 }
2056 BEGIN(Using);
2057 }
2058<Using>({ID}{BN}*("::"|"."){BN}*)*({ID}|{OPERATOR}){BN}*"=" { // C++11 style using alias
2059 yyextra->current->name=QCString(yytext).left(yyleng-1).stripWhiteSpace();
2060 yyextra->current->fileName = yyextra->fileName;
2061 yyextra->current->section = EntryType::makeUsingDecl();
2062 yyextra->current->startLine = yyextra->yyLineNr;
2063 yyextra->current->bodyLine = yyextra->yyLineNr;
2064 yyextra->current->bodyColumn = yyextra->yyColNr;
2065 yyextra->lastInitializerContext = UsingAlias;
2066 yyextra->initBracketCount=0;
2067 BEGIN(ReadInitializer);
2068 }
2069<UsingAlias>";" {
2070 yyextra->current->section = EntryType::makeVariable();
2071 QCString init = yyextra->current->initializer.str();
2072 init.stripPrefix("class ");
2073 init.stripPrefix("struct ");
2074 init = init.stripWhiteSpace();
2075 yyextra->current->type = "typedef "+init;
2076 yyextra->current->args.clear();
2077 yyextra->current->spec.setAlias(true);
2078 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2079 initEntry(yyscanner);
2080 BEGIN(FindMembers);
2081 }
void init()
2082<UsingAlias>. {
2083 yyextra->current->initializer << yytext;
2084 }
2085<UsingAlias>\n {
2086 yyextra->current->initializer << yytext;
2087 lineCount(yyscanner);
2088 }
2089<UsingDirective>{SCOPENAME} { yyextra->current->name=removeRedundantWhiteSpace(yytext);
2090 yyextra->current->fileName = yyextra->fileName;
2091 yyextra->current->section = EntryType::makeUsingDir();
2092 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2093 initEntry(yyscanner);
2094 BEGIN(Using);
2095 }
2096<Using>";" { BEGIN(FindMembers); }
2097<FindMembers>{SCOPENAME}{BN}*"<>" { // guided template decl
2098 QCString n=yytext;
2099 addType(yyscanner);
2100 yyextra->current->name=n.left(n.length()-2);
2101 }
2102<FindMembers>{SCOPENAME}{BNopt}/"<" { // Note: this could be a return type!
2103 QCString name = QCString(yytext).stripWhiteSpace();
2104 if (yyextra->insideCpp && name=="import") REJECT; // C++20 module header import
2105 yyextra->roundCount=0;
2106 yyextra->sharpCount=0;
2107 lineCount(yyscanner);
2108 addType(yyscanner);
2109 yyextra->current->name=name;
2110 //yyextra->current->scopeSpec.clear();
2111 // yyextra->currentTemplateSpec = &yyextra->current->scopeSpec;
2112 if (nameIsOperator(yyextra->current->name))
2113 BEGIN( Operator );
2114 else
2115 BEGIN( EndTemplate );
2116 }
2117<FindMemberName>{SCOPENAME}{BNopt}/"<" {
2118 yyextra->sharpCount=0;
2119 yyextra->roundCount=0;
2120 lineCount(yyscanner);
2121 yyextra->current->name+=((QCString)yytext).stripWhiteSpace();
2122 //yyextra->current->memberSpec.clear();
2123 // yyextra->currentTemplateSpec = &yyextra->current->memberSpec;
2124 if (nameIsOperator(yyextra->current->name))
2125 BEGIN( Operator );
2126 else
2127 BEGIN( EndTemplate );
2128 }
std::string_view stripWhiteSpace(std::string_view s)
Given a string view s, returns a new, narrower view on that string, skipping over any leading or trai...
Definition stringutil.h:72
2129<EndTemplate>"<<<" {
2130 if (!yyextra->insidePHP)
2131 {
2132 REJECT;
2133 }
2134 else
2135 {
2136 yyextra->lastHereDocContext = YY_START;
2137 BEGIN(HereDoc);
2138 }
2139 }
2140<ClassTemplSpec,EndTemplate>("<<"|"<=") {
2141 yyextra->current->name+=yytext;
2142 // *yyextra->currentTemplateSpec+=yytext;
2143 }
2144<EndTemplate>"<" {
2145 if (yyextra->roundCount==0)
2146 {
2147 // *yyextra->currentTemplateSpec+='<';
2148 yyextra->sharpCount++;
2149 }
2150 yyextra->current->name+=yytext;
2151 }
2152<ClassTemplSpec,EndTemplate>">=" {
2153 yyextra->current->name+=yytext;
2154 }
2155<ClassTemplSpec,EndTemplate>(">>") {
2156 if (yyextra->insideJava || yyextra->insideCS || yyextra->insideCli || yyextra->roundCount==0)
2157 {
2158 unput('>');
2159 unput(' ');
2160 unput('>');
2161 }
2162 else
2163 {
2164 yyextra->current->name+=yytext;
2165 }
2166 // *yyextra->currentTemplateSpec+=yytext;
2167 }
2168<EndTemplate>">" {
2169 yyextra->current->name+='>';
2170 // *yyextra->currentTemplateSpec+='>';
2171 if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
2172 {
2173 yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
2174 //printf("Found %s\n",qPrint(yyextra->current->name));
2175 BEGIN(FindMembers);
2176 }
2177 }
2178<EndTemplate>">"{BN}*"(" {
2179 lineCount(yyscanner);
2180 yyextra->current->name+='>';
2181 // *yyextra->currentTemplateSpec+='>';
2182 if (yyextra->roundCount==0)
2183 {
2184 --yyextra->sharpCount;
2185 }
2186 if (yyextra->roundCount==0 && yyextra->sharpCount<=0)
2187 {
2188 yyextra->current->bodyLine = yyextra->yyLineNr;
2189 yyextra->current->bodyColumn = yyextra->yyColNr;
2190 yyextra->current->args = "(";
2191 yyextra->currentArgumentContext = FuncQual;
2192 yyextra->fullArgString = yyextra->current->args;
2193 yyextra->copyArgString = &yyextra->current->args;
2194 //printf("Found %s\n",qPrint(yyextra->current->name));
2195 BEGIN( ReadFuncArgType ) ;
2196 }
2197 else
2198 {
2199 yyextra->current->name+="(";
2200 yyextra->roundCount++;
2201 }
2202 }
2203<EndTemplate>">"{BNopt}/"("({BN}*{TSCOPE}{BN}*"::")*({BN}*"*"{BN}*)+ { // function pointer returning a template instance
2204 lineCount(yyscanner);
2205 yyextra->current->name+='>';
2206 if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
2207 {
2208 BEGIN(FindMembers);
2209 }
2210 }
2211<EndTemplate>">"{BNopt}/"::" {
2212 lineCount(yyscanner);
2213 yyextra->current->name+='>';
2214 // *yyextra->currentTemplateSpec+='>';
2215 if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
2216 {
2217 BEGIN(FindMemberName);
2218 }
2219 }
2220<ClassTemplSpec,EndTemplate>"(" { yyextra->current->name+=*yytext;
2221 yyextra->roundCount++;
2222 }
2223<ClassTemplSpec,EndTemplate>")" { yyextra->current->name+=*yytext;
2224 if (yyextra->roundCount>0) yyextra->roundCount--;
2225 }
2226<EndTemplate>. {
2227 yyextra->current->name+=*yytext;
2228 // *yyextra->currentTemplateSpec+=*yytext;
2229 }
2230<FindMembers>"define"{BN}*"("{BN}*["'] {
2231 if (yyextra->insidePHP)
2232 {
2233 yyextra->current->bodyLine = yyextra->yyLineNr;
2234 yyextra->current->bodyColumn = yyextra->yyColNr;
2235 BEGIN( DefinePHP );
2236 }
2237 else
2238 REJECT;
2239 }
2240<CopyHereDoc>{ID} { // PHP heredoc
2241 yyextra->delimiter = yytext;
2242 *yyextra->pCopyHereDocGString << yytext;
2243 BEGIN(CopyHereDocEnd);
2244 }
2245<CopyHereDoc>"\""{ID}/"\"" { // PHP quoted heredoc
2246 yyextra->delimiter = &yytext[1];
2247 *yyextra->pCopyHereDocGString << yytext;
2248 BEGIN(CopyHereDocEnd);
2249 }
2250<CopyHereDoc>"'"{ID}/"'" { // PHP nowdoc
2251 yyextra->delimiter = &yytext[1];
2252 *yyextra->pCopyHereDocGString << yytext;
2253 BEGIN(CopyHereDocEnd);
2254 }
2255<HereDoc>{ID} { // PHP heredoc
2256 yyextra->delimiter = yytext;
2257 BEGIN(HereDocEnd);
2258 }
2259<HereDoc>"\""{ID}/"\"" { // PHP quoted heredoc
2260 yyextra->delimiter = &yytext[1];
2261 BEGIN(HereDocEnd);
2262 }
2263<HereDoc>"'"{ID}/"'" { // PHP nowdoc
2264 yyextra->delimiter = &yytext[1];
2265 BEGIN(HereDocEnd);
2266 }
2267<HereDocEnd>^{ID} { // id at start of the line could mark the end of the block
2268 if (yyextra->delimiter==yytext) // it is the end marker
2269 {
2270 BEGIN(yyextra->lastHereDocContext);
2271 }
2272 }
2273<HereDocEnd>. { }
2274<CopyHereDocEnd>^{Bopt}{ID} { // id at start of the line could mark the end of the block
2275 *yyextra->pCopyHereDocGString << yytext;
2276 if (yyextra->delimiter==QCString(yytext).stripWhiteSpace()) // it is the end marker
2277 {
2278 BEGIN(yyextra->lastHereDocContext);
2279 }
2280 }
2281<CopyHereDocEnd>\n {
2282 lineCount(yyscanner);
2283 *yyextra->pCopyHereDocGString << yytext;
2284 }
2285<CopyHereDocEnd>{ID} {
2286 *yyextra->pCopyHereDocGString << yytext;
2287 }
2288<CopyHereDocEnd>. {
2289 *yyextra->pCopyHereDocGString << yytext;
2290 }
2291<FindMembers>"Q_OBJECT"|"Q_GADGET" { // Qt object / gadget macro
2292 }
2293<FindMembers>"Q_PROPERTY" { // Qt property declaration
2294 yyextra->yyBegLineNr = yyextra->yyLineNr;
2295 yyextra->yyBegColNr = yyextra->yyColNr;
2296 yyextra->current->protection = Protection::Public ; // see bug734245 & bug735462
2297 yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
2298 yyextra->current->type.clear();
2299 BEGIN(QtPropType);
2300 }
2301<QtPropType>"(" { // start of property arguments
2302 }
2303<QtPropAttr>")" { // end of property arguments
2304 unput(';');
2305 BEGIN(FindMembers);
2306 }
2307<QtPropType>{B}+ {
2308 yyextra->current->name+=yytext;
2309 }
2310<QtPropType>"*" {
2311 yyextra->current->type+= yyextra->current->name;
2312 yyextra->current->type+= yytext;
2313 yyextra->current->name="";
2314 }
2315<QtPropType>({TSCOPE}"::")*{TSCOPE} {
2316 yyextra->current->type+= yyextra->current->name;
2317 yyextra->current->name=yytext;
2318 }
2319<QtPropType,QtPropAttr>{B}+"READ"{B}+ {
2320 yyextra->current->spec.setReadable(true);
2321 BEGIN(QtPropRead);
2322 }
2323<QtPropType,QtPropAttr>{B}+"WRITE"{B}+ {
2324 yyextra->current->spec.setWritable(true);
2325 BEGIN(QtPropWrite);
2326 }
2327<QtPropType,QtPropAttr>{B}+"MEMBER"{B}+{ID} | // member property => not supported yet
2328<QtPropType,QtPropAttr>{B}+"RESET"{B}+{ID} | // reset method => not supported yet
2329<QtPropType,QtPropAttr>{B}+"SCRIPTABLE"{B}+{ID} | // scriptable property => not supported yet
2330<QtPropType,QtPropAttr>{B}+"DESIGNABLE"{B}+{ID} | // designable property => not supported yet
2331<QtPropType,QtPropAttr>{B}+"NOTIFY"{B}+{ID} | // notify property => not supported yet
2332<QtPropType,QtPropAttr>{B}+"REVISION"{B}+{ID} | // revision property => not supported yet
2333<QtPropType,QtPropAttr>{B}+"STORED"{B}+{ID} | // stored property => not supported yet
2334<QtPropType,QtPropAttr>{B}+"USER"{B}+{ID} | // user property => not supported yet
2335<QtPropType,QtPropAttr>{B}+"CONSTANT"{B} | // constant property => not supported yet
2336<QtPropType,QtPropAttr>{B}+"FINAL"{B} { // final property => not supported yet
2337 BEGIN(QtPropAttr);
2338 }
2339<QtPropRead>{ID} {
2340 yyextra->current->read = yytext;
2341 BEGIN(QtPropAttr);
2342 }
2343<QtPropWrite>{ID} {
2344 yyextra->current->write = yytext;
2345 BEGIN(QtPropAttr);
2346 }
2347<FindMembers>"friend"{BN}+("class"|"union"|"struct"){BN}+ {
2348 yyextra->current->name=yytext;
2349 lineCount(yyscanner) ;
2350 BEGIN(FindMembers);
2351 }
2352<FindMembers>"requires" { // C++20 requires clause
2353 if (yyextra->insideJava) REJECT;
2354 yyextra->current->req.clear();
2355 yyextra->requiresContext = YY_START;
2356 BEGIN(RequiresClause);
2357 }
2358<RequiresClause>"requires"{BN}*/"{" { // requires requires { ... }
2359 if (yyextra->insideJava) REJECT;
2360 lineCount(yyscanner) ;
2361 yyextra->current->req+=yytext;
2362 BEGIN( RequiresExpression ) ;
2363 }
2364<RequiresClause>"requires"{BN}*"(" { // requires requires(T x) { ... }
2365 if (yyextra->insideJava) REJECT;
2366 lineCount(yyscanner) ;
2367 yyextra->current->req+=yytext;
2368 yyextra->lastRoundContext=RequiresExpression;
2369 yyextra->pCopyRoundString=&yyextra->current->req;
2370 yyextra->roundCount=0;
2371 BEGIN( CopyRound ) ;
2372 }
2373<RequiresExpression>"{" {
2374 yyextra->current->req+=yytext;
2375 yyextra->lastCurlyContext=RequiresClause;
2376 yyextra->pCopyCurlyString=&yyextra->current->req;
2377 yyextra->curlyCount=0;
2378 BEGIN( CopyCurly ) ;
2379 }
2380<RequiresExpression>\n {
2381 yyextra->current->req+=' ';
2382 lineCount(yyscanner);
2383 }
2384<RequiresExpression>. {
2385 yyextra->current->req+=yytext;
2386 }
2387<RequiresClause>"(" { // requires "(A && B)"
2388 yyextra->current->req+=yytext;
2389 yyextra->lastRoundContext=RequiresClause;
2390 yyextra->pCopyRoundString=&yyextra->current->req;
2391 yyextra->roundCount=0;
2392 BEGIN( CopyRound ) ;
2393 }
2394<RequiresClause>{NOTopt}{SCOPENAME}{BNopt}"(" { // "requires func(x)"
2395 if (startOfRequiresExpression(yyextra->current->req))
2396 {
2397 lineCount(yyscanner);
2398 yyextra->current->req+=yytext;
2399 yyextra->lastRoundContext=RequiresClause;
2400 yyextra->pCopyRoundString=&yyextra->current->req;
2401 yyextra->roundCount=0;
2402 BEGIN( CopyRound );
2403 }
2404 else
2405 {
2406 REJECT;
2407 }
2408 }
2409<RequiresClause>{NOTopt}{SCOPENAME}{BNopt}"<" { // "requires C<S,T>"
2410 if (startOfRequiresExpression(yyextra->current->req))
2411 {
2412 lineCount(yyscanner);
2413 yyextra->current->req+=yytext;
2414 yyextra->lastSharpContext=RequiresClause;
2415 yyextra->pCopySharpString=&yyextra->current->req;
2416 yyextra->sharpCount=0;
2417 BEGIN( CopySharp );
2418 }
2419 else
2420 {
2421 REJECT
2422 }
2423 }
2424<RequiresClause>{NOTopt}{SCOPENAME} { // something like "requires true" or "requires !my::value"
2425 if (startOfRequiresExpression(yyextra->current->req))
2426 {
2427 lineCount(yyscanner);
2428 yyextra->current->req=yytext;
2429 BEGIN(yyextra->requiresContext);
2430 }
2431 else
2432 {
2433 REJECT;
2434 }
2435 }
2436<RequiresClause>{NOTopt}"::"{ID} {
2437 lineCount(yyscanner);
2438 yyextra->current->req+=yytext;
2439 }
2440<RequiresClause>"||"|"&&"|"!"|("or"{BN}+)|("and"{BN}+)|("not"{BN}+) { // "requires A || B" or "requires A && B"
2441 lineCount(yyscanner);
2442 yyextra->current->req+=yytext;
2443 }
2444<RequiresClause>{BN}+ {
2445 yyextra->current->req+=' ';
2446 lineCount(yyscanner) ;
2447 }
2448<RequiresClause>. {
2449 unput(*yytext);
2450 yyextra->current->req=yyextra->current->req.simplifyWhiteSpace();
2451 BEGIN(yyextra->requiresContext);
2452 }
2453<FindMembers,FindMemberName>{SCOPENAME} {
2454 storeClangId(yyscanner,yytext);
2455 yyextra->yyBegColNr=yyextra->yyColNr;
2456 yyextra->yyBegLineNr=yyextra->yyLineNr;
2457 lineCount(yyscanner);
2458 if (yyextra->insideIDL && yyleng==9 && qstrcmp(yytext,"cpp_quote")==0)
2459 {
2460 BEGIN(CppQuote);
2461 }
2462 else if ((yyextra->insideIDL || yyextra->insideJava || yyextra->insideD) && yyleng==6 && qstrcmp(yytext,"import")==0)
2463 {
2464 if (yyextra->insideIDL)
2465 BEGIN(IDLImport);
2466 else // yyextra->insideJava or yyextra->insideD
2467 BEGIN(JavaImport);
2468 }
2469 else if (yyextra->insidePHP && qstrcmp(yytext,"use")==0)
2470 {
2471 BEGIN(PHPUse);
2472 }
2473 else if (yyextra->insideJava && qstrcmp(yytext,"package")==0)
2474 {
2475 lineCount(yyscanner);
2476 BEGIN(PackageName);
2477 }
2478 else if (yyextra->insideIDL && qstrcmp(yytext,"case")==0)
2479 {
2480 BEGIN(IDLUnionCase);
2481 }
2482 else if (yyextra->insideTryBlock && qstrcmp(yytext,"catch")==0)
2483 {
2484 yyextra->insideTryBlock=FALSE;
2485 BEGIN(TryFunctionBlock);
2486 }
2487 else if (yyextra->insideCpp && qstrcmp(yytext,"alignas")==0)
2488 {
2489 yyextra->lastAlignAsContext = YY_START;
2490 BEGIN(AlignAs);
2491 }
2492 else if (yyextra->insideJS && qstrcmp(yytext,"var")==0)
2493 { // javascript variable
2494 yyextra->current->type="var";
2495 }
2496 else if (yyextra->insideJS && qstrcmp(yytext,"function")==0)
2497 { // javascript function
2498 yyextra->current->type="function";
2499 }
2500 else if (yyextra->insideCS && qstrcmp(yytext,"this")==0)
2501 {
2502 // C# indexer
2503 addType(yyscanner);
2504 yyextra->current->name="this";
2505 BEGIN(CSIndexer);
2506 }
2507 else if (yyextra->insideCpp && (qstrcmp(yytext,"static_assert")==0 || qstrcmp(yytext,"_Static_assert")==0))
2508 {
2509 // C/C++11 static_assert
2510 BEGIN(StaticAssert);
2511 }
2512 else if (yyextra->insideCpp && qstrcmp(yytext,"decltype")==0)
2513 {
2514 // C++11 decltype(x)
2515 addType(yyscanner);
2516 if (!yyextra->current->type.isEmpty()) yyextra->current->type+=' ';
2517 yyextra->current->type+=yytext;
2518 BEGIN(DeclType);
2519 }
2520 else if (yyextra->insideSlice && qstrcmp(yytext,"optional")==0)
2521 {
2522 if (yyextra->current->type.isEmpty())
2523 {
2524 yyextra->current->type = "optional";
2525 }
2526 else
2527 {
2528 yyextra->current->type += " optional";
2529 }
2530 yyextra->lastModifierContext = YY_START;
2531 BEGIN(SliceOptional);
2532 }
2533 else
2534 {
2535 if (YY_START==FindMembers)
2536 {
2537 addType(yyscanner);
2538 }
2539 bool javaLike = yyextra->insideJava || yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideJS;
2540 if (javaLike && qstrcmp(yytext,"public")==0)
2541 {
2542 yyextra->current->protection = Protection::Public;
2543 }
2544 else if (javaLike && qstrcmp(yytext,"protected")==0)
2545 {
2546 yyextra->current->protection = Protection::Protected;
2547 }
2548 else if ((yyextra->insideCS || yyextra->insideD || yyextra->insidePHP || yyextra->insideJS) && qstrcmp(yytext,"internal")==0)
2549 {
2550 yyextra->current->protection = Protection::Package;
2551 }
2552 else if (javaLike && qstrcmp(yytext,"private")==0)
2553 {
2554 yyextra->current->protection = Protection::Private;
2555 }
2556 else if (javaLike && qstrcmp(yytext,"static")==0)
2557 {
2558 if (YY_START==FindMembers)
2559 yyextra->current->name = yytext;
2560 else
2561 yyextra->current->name += yytext;
2562 yyextra->current->isStatic = TRUE;
2563 }
2564 else
2565 {
2566 if (YY_START==FindMembers)
2567 yyextra->current->name = yytext;
2568 else
2569 yyextra->current->name += yytext;
2570 if (yyextra->current->name.startsWith("static "))
2571 {
2572 yyextra->current->isStatic = TRUE;
2573 yyextra->current->name= yyextra->current->name.mid(7);
2574 }
2575 else if (yyextra->current->name.startsWith("inline "))
2576 {
2577 if (yyextra->current->type.isEmpty())
2578 {
2579 yyextra->current->type="inline";
2580 }
2581 else
2582 {
2583 yyextra->current->type+="inline ";
2584 }
2585 yyextra->current->name= yyextra->current->name.mid(7);
2586 }
2587 else if (yyextra->current->name.startsWith("constexpr "))
2588 {
2589 if (yyextra->current->type.isEmpty())
2590 {
2591 yyextra->current->type="constexpr";
2592 }
2593 else
2594 {
2595 yyextra->current->type+="constexpr ";
2596 }
2597 yyextra->current->name=yyextra->current->name.mid(10);
2598 }
2599 else if (yyextra->current->name.startsWith("consteval "))
2600 {
2601 if (yyextra->current->type.isEmpty())
2602 {
2603 yyextra->current->type="consteval";
2604 }
2605 else
2606 {
2607 yyextra->current->type+="consteval ";
2608 }
2609 yyextra->current->name=yyextra->current->name.mid(10);
2610 }
2611 else if (yyextra->current->name.startsWith("constinit "))
2612 {
2613 if (yyextra->current->type.isEmpty())
2614 {
2615 yyextra->current->type="constinit";
2616 }
2617 else
2618 {
2619 yyextra->current->type+="constinit ";
2620 }
2621 yyextra->current->name=yyextra->current->name.mid(10);
2622 }
2623 else if (yyextra->current->name.startsWith("const "))
2624 {
2625 if (yyextra->current->type.isEmpty())
2626 {
2627 yyextra->current->type="const";
2628 }
2629 else
2630 {
2631 yyextra->current->type+="const ";
2632 }
2633 yyextra->current->name=yyextra->current->name.mid(6);
2634 }
2635 else if (yyextra->current->name.startsWith("volatile "))
2636 {
2637 if (yyextra->current->type.isEmpty())
2638 {
2639 yyextra->current->type="volatile";
2640 }
2641 else
2642 {
2643 yyextra->current->type+="volatile ";
2644 }
2645 yyextra->current->name=yyextra->current->name.mid(9);
2646 }
2647 else if (yyextra->current->name.startsWith("typedef "))
2648 {
2649 if (yyextra->current->type.isEmpty())
2650 {
2651 yyextra->current->type="typedef";
2652 }
2653 else
2654 {
2655 yyextra->current->type+="typedef ";
2656 }
2657 yyextra->current->name=yyextra->current->name.mid(8);
2658 }
2659 }
2660 QCString tmp=yytext;
2661 if (nameIsOperator(tmp))
2662 {
2663 BEGIN( Operator );
2664 }
2665 else
2666 {
2667 yyextra->externLinkage=FALSE; // see bug759247
2668 BEGIN(FindMembers);
2669 }
2670 }
2671 yyextra->current->name = yyextra->current->name.removeWhiteSpace();
2672 }
2673<StaticAssert>"(" {
2674 yyextra->lastSkipRoundContext = FindMembers;
2675 yyextra->roundCount=0;
2676 BEGIN(SkipRound);
2677 }
2678<StaticAssert>{BN}+ { lineCount(yyscanner); }
2679<StaticAssert>. { // variable with static_assert as name?
2680 unput(*yytext);
2681 BEGIN(FindMembers);
2682 }
2683<DeclType>"(" {
2684 yyextra->current->type+=yytext;
2685 yyextra->lastRoundContext=FindMembers;
2686 yyextra->pCopyRoundString=&yyextra->current->type;
2687 yyextra->roundCount=0;
2688 BEGIN(CopyRound);
2689 }
2690<DeclType>{BN}+ { lineCount(yyscanner); }
2691<DeclType>. {
2692 unput(*yytext);
2693 BEGIN(FindMembers);
2694 }
2695<CSIndexer>"["[^\n\]]*"]" {
2696 yyextra->current->name+=removeRedundantWhiteSpace(yytext);
2697 BEGIN(FindMembers);
2698 }
2699<FindMembers>[0-9]{ID} { // some number where we did not expect one
2700 }
2701<FindMembers>"." {
2702 if (yyextra->insideJava || yyextra->insideCS || yyextra->insideD)
2703 {
2704 yyextra->current->name+=".";
2705 }
2706 }
2707<FindMembers>"::" {
2708 yyextra->current->name+=yytext;
2709 }
2710<CppQuote>"("{B}*"\"" {
2711 yyextra->insideCppQuote=TRUE;
2712 BEGIN(FindMembers);
2713 }
2714<IDLUnionCase>"::"
2715<IDLUnionCase>":" { BEGIN(FindMembers); }
2716<IDLUnionCase>\n { lineCount(yyscanner); }
2717<IDLUnionCase>.
2718<TryFunctionBlock>\n { lineCount(yyscanner); }
2719<TryFunctionBlock>"{" {
2720 yyextra->curlyCount=0;
2721 yyextra->lastCurlyContext = TryFunctionBlockEnd ;
2722 BEGIN( SkipCurly );
2723 }
2724<TryFunctionBlock>.
2725<TryFunctionBlockEnd>{BN}*"catch" { lineCount(yyscanner); BEGIN(TryFunctionBlock); // {BN}* added to fix bug 611193
2726 }
2727<TryFunctionBlockEnd>\n { unput(*yytext); // rule added to fix bug id 601138
2728 BEGIN( FindMembers );
2729 }
2730<TryFunctionBlockEnd>. { unput(*yytext);
2731 BEGIN( FindMembers );
2732 }
2733<EndCppQuote>")" {
2734 yyextra->insideCppQuote=FALSE;
2735 BEGIN(FindMembers);
2736 }
2737<FindMembers,FindFields>{B}*"#" { if (yyextra->insidePHP)
2738 REJECT;
2739 yyextra->lastCPPContext = YY_START;
2740 BEGIN( SkipCPP ) ;
2741 }
2742<FindMembers,FindFields>{B}*"#"{B}*"cmakedefine01" |
2743<FindMembers,FindFields>{B}*"#"{B}*("cmake")?"define" {
2744 if (yyextra->insidePHP)
2745 REJECT;
2746 yyextra->current->bodyLine = yyextra->yyLineNr;
2747 yyextra->current->bodyColumn = yyextra->yyColNr;
2748 yyextra->current->fileName = yyextra->fileName;
2749 yyextra->current->startLine = yyextra->yyLineNr;
2750 yyextra->current->startColumn = yyextra->yyColNr;
2751 yyextra->current->type.clear();
2752 yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
2753 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
2754 yyextra->current->section = EntryType::makeDefine();
2755 yyextra->lastDefineContext = YY_START;
2756 BEGIN( SDefine );
2757 }
2758<FindMembers,ReadBody,ReadNSBody,ReadBodyIntf,SkipCurly,SkipCurlyCpp>{B}*"#"{B}+[0-9]+{B}+/"\"" { /* line control directive */
2759 yyextra->yyLineNr = atoi(&yytext[1]);
2760 //printf("setting line number to %d\n",yyextra->yyLineNr);
2761 yyextra->lastPreLineCtrlContext = YY_START;
2762 if (YY_START==ReadBody ||
2763 YY_START==ReadNSBody ||
2764 YY_START==ReadBodyIntf)
2765 {
2766 yyextra->current->program << yytext;
2767 }
2768 BEGIN( PreLineCtrl );
2769 }
2770<PreLineCtrl>"\""[^\n\"]*"\"" {
2771 yyextra->fileName = stripQuotes(yytext);
2772 if (yyextra->lastPreLineCtrlContext==ReadBody ||
2773 yyextra->lastPreLineCtrlContext==ReadNSBody ||
2774 yyextra->lastPreLineCtrlContext==ReadBodyIntf)
2775 {
2776 yyextra->current->program << yytext;
2777 }
2778 }
static QCString stripQuotes(const char *s)
2779<PreLineCtrl>. {
2780 if (yyextra->lastPreLineCtrlContext==ReadBody ||
2781 yyextra->lastPreLineCtrlContext==ReadNSBody ||
2782 yyextra->lastPreLineCtrlContext==ReadBodyIntf)
2783 {
2784 yyextra->current->program << yytext;
2785 }
2786 }
2787<PreLineCtrl>\n {
2788 if (yyextra->lastPreLineCtrlContext==ReadBody ||
2789 yyextra->lastPreLineCtrlContext==ReadNSBody ||
2790 yyextra->lastPreLineCtrlContext==ReadBodyIntf)
2791 {
2792 yyextra->current->program << yytext;
2793 }
2794 lineCount(yyscanner);
2795 BEGIN( yyextra->lastPreLineCtrlContext );
2796 }
2797<SkipCPP>.
2798<SkipCPP>\\[\r]*"\n"[\r]* { lineCount(yyscanner); }
2799<SkipCPP>[\r]*\n[\r]* { lineCount(yyscanner);
2800 BEGIN( yyextra->lastCPPContext) ;
2801 }
2802<SDefine>{ID}{B}*"(" {
2803 yyextra->current->name = yytext;
2804 yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
2805 yyextra->current->args = "(";
2806 yyextra->current->bodyLine = yyextra->yyLineNr;
2807 yyextra->current->bodyColumn = yyextra->yyColNr;
2808 yyextra->currentArgumentContext = DefineEnd;
2809 yyextra->fullArgString=yyextra->current->args;
2810 yyextra->copyArgString=&yyextra->current->args;
2811 BEGIN( ReadFuncArgType ) ;
2812 }
2813 /*
2814<DefineArg>")" {
2815 //printf("Define with args\n");
2816 yyextra->current->args += ')';
2817 BEGIN( DefineEnd );
2818 }
2819<DefineArg>. {
2820 yyextra->current->args += *yytext;
2821 }
2822 */
2823<SDefine>{ID} {
2824 //printf("Define '%s' without args\n",yytext);
2825 storeClangId(yyscanner,yytext);
2826 yyextra->current->bodyLine = yyextra->yyLineNr;
2827 yyextra->current->bodyColumn = yyextra->yyColNr;
2828 yyextra->current->name = yytext;
2829 BEGIN(DefineEnd);
2830 }
2831<DefineEnd><<EOF>> |
2832<DefineEnd>\n {
2833 //printf("End define: doc=%s docFile=%s docLine=%d\n",qPrint(yyextra->current->doc),qPrint(yyextra->current->docFile),yyextra->current->docLine);
2834 lineCount(yyscanner);
2835 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2836 initEntry(yyscanner);
2837 BEGIN(yyextra->lastDefineContext);
2838 }
2839<DefinePHPEnd>";" {
2840 //printf("End define\n");
2841 yyextra->current->fileName = yyextra->fileName;
2842 yyextra->current->startLine = yyextra->yyLineNr;
2843 yyextra->current->startColumn = yyextra->yyColNr;
2844 yyextra->current->type.clear();
2845 yyextra->current->type = "const";
2846 QCString init = yyextra->current->initializer.str();
2847 init = init.simplifyWhiteSpace();
2848 init = init.left(init.length()-1);
2849 yyextra->current->initializer.str(init.str());
2850 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
2851 yyextra->current->section = EntryType::makeVariable();
2852 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2853 initEntry(yyscanner);
2854 BEGIN(FindMembers);
2855 }
2856<DefinePHPEnd>.
2857<DefineEnd>\\[\r]?\n {
2858 lineCount(yyscanner);
2859 yyextra->current->endBodyLine = yyextra->yyLineNr;
2860 }
2861<DefineEnd>\" {
2862 if (yyextra->insideIDL && yyextra->insideCppQuote)
2863 {
2864 BEGIN(EndCppQuote);
2865 }
2866 else
2867 {
2868 yyextra->lastStringContext=DefineEnd;
2869 BEGIN(SkipString);
2870 }
2871 }
2872<DefineEnd>.
2873<DefinePHP>{ID}["']{BN}*","{BN}* {
2874 yyextra->current->name = yytext;
2875 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
2876 yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
2877 yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1);
2878 yyextra->current->bodyLine = yyextra->yyLineNr;
2879 yyextra->current->bodyColumn = yyextra->yyColNr;
2880 yyextra->lastRoundContext = DefinePHPEnd;
2881 yyextra->pCopyRoundGString = &yyextra->current->initializer;
2882 yyextra->roundCount = 0;
2883 BEGIN( GCopyRound );
2884 }
2885
2886<FindMembers>[\^%] { // ^ and % are C++/CLI extensions
2887 if (yyextra->insideCli)
2888 {
2889 addType(yyscanner);
2890 yyextra->current->name = yytext ;
2891 }
2892 else
2893 {
2894 REJECT;
2895 }
2896 }
2897<FindMembers>[*&]+ {
2898 yyextra->current->name += yytext ;
2899 addType(yyscanner);
2900 }
2901<FindMembers,MemberSpec,SFunction,NextSemi,EnumBaseType,BitFields,ReadInitializer,ReadInitializerPtr,OldStyleArgs,DefinePHPEnd>";"{BN}*{DCOMM}"<" {
2902 if (yyextra->current->bodyLine==-1)
2903 {
2904 yyextra->current->bodyLine=yyextra->yyLineNr;
2905 yyextra->current->bodyColumn = yyextra->yyColNr;
2906 }
2907 yyextra->docBlockContext = YY_START;
2908 yyextra->docBlockInBody = FALSE;
2909 yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
2910 ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
2911
2912 QCString indent;
2913 indent.fill(' ',computeIndent(yytext,yyextra->column));
2914 yyextra->docBlock.str(indent.str());
2915 //printf("indent=%d\n",computeIndent(yytext+1,yyextra->column));
2916 lineCount(yyscanner);
2917
2918 yyextra->docBlockTerm = ';';
2919 if (YY_START==EnumBaseType && yyextra->current->section.isEnum())
2920 {
2921 yyextra->current->bitfields = ":"+yyextra->current->args;
2922 yyextra->current->args.clear();
2923 yyextra->current->section = EntryType::makeVariable();
2924 }
2925 if (yytext[yyleng-3]=='/')
2926 {
2927 startCommentBlock(yyscanner,TRUE);
2928 BEGIN( DocLine );
2929 }
2930 else
2931 {
2932 startCommentBlock(yyscanner,FALSE);
2933 BEGIN( DocBlock );
2934 }
2935 }
void fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:180
static int computeIndent(const char *s)
#define Config_getBool(name)
Definition config.h:33
static void startCommentBlock(yyscan_t yyscanner, bool)
2936<MemberSpec,FindFields,FindMembers,NextSemi,EnumBaseType,BitFields,ReadInitializer,ReadInitializerPtr,OldStyleArgs>","{BN}*{DCOMM}"<" {
2937 yyextra->docBlockContext = YY_START;
2938 yyextra->docBlockInBody = FALSE;
2939 yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
2940 ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
2941
2942 QCString indent;
2943 indent.fill(' ',computeIndent(yytext,yyextra->column));
2944 yyextra->docBlock.str(indent.str());
2945 lineCount(yyscanner);
2946
2947 yyextra->docBlockTerm = ',';
2948 if (YY_START==EnumBaseType && yyextra->current->section.isEnum())
2949 {
2950 yyextra->current->bitfields = ":"+yyextra->current->args;
2951 yyextra->current->args.clear();
2952 yyextra->current->section = EntryType::makeVariable();
2953 }
2954 if (yytext[yyleng-3]=='/')
2955 {
2956 startCommentBlock(yyscanner,TRUE);
2957 BEGIN( DocLine );
2958 }
2959 else
2960 {
2961 startCommentBlock(yyscanner,FALSE);
2962 BEGIN( DocBlock );
2963 }
2964 }
2965<DefineEnd,FindFields,ReadInitializer,ReadInitializerPtr,OldStyleArgs>{BN}*{DCOMM}"<" {
2966 if (yyextra->current->bodyLine==-1)
2967 {
2968 yyextra->current->bodyLine=yyextra->yyLineNr;
2969 yyextra->current->bodyColumn = yyextra->yyColNr;
2970 }
2971 yyextra->docBlockContext = YY_START;
2972 yyextra->docBlockInBody = FALSE;
2973 yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
2974 ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
2975 QCString indent;
2976 indent.fill(' ',computeIndent(yytext,yyextra->column));
2977 yyextra->docBlock.str(indent.str());
2978 lineCount(yyscanner);
2979
2980 yyextra->docBlockTerm = 0;
2981 if (yytext[yyleng-3]=='/')
2982 {
2983 startCommentBlock(yyscanner,TRUE);
2984 BEGIN( DocLine );
2985 }
2986 else
2987 {
2988 startCommentBlock(yyscanner,FALSE);
2989 BEGIN( DocBlock );
2990 }
2991 }
2992
2993<FindMembers,FindFields>({CPPC}([!/]){B}*{CMD}"{")|({CCS}([!*]){B}*{CMD}"{") {
2994 //handleGroupStartCommand(yyextra->current->name);
2995 if (yyextra->previous && yyextra->previous->section.isGroupDoc())
2996 {
2997 // link open command to the group defined in the yyextra->previous entry
2998 yyextra->commentScanner.open(yyextra->previous.get(),yyextra->fileName,yyextra->yyLineNr);
2999 }
3000 else
3001 {
3002 // link open command to the yyextra->current entry
3003 yyextra->commentScanner.open(yyextra->current.get(),yyextra->fileName,yyextra->yyLineNr);
3004 }
3005 //yyextra->current = tmp;
3006 initEntry(yyscanner);
3007 if (yytext[1]=='/')
3008 {
3009 if (yytext[2]=='!' || yytext[2]=='/')
3010 {
3011 yyextra->docBlockContext = YY_START;
3012 yyextra->docBlockInBody = FALSE;
3013 yyextra->docBlockAutoBrief = FALSE;
3014 yyextra->docBlock.str(std::string());
3015 yyextra->docBlockTerm = 0;
3016 startCommentBlock(yyscanner,TRUE);
3017 BEGIN(DocLine);
3018 }
3019 else
3020 {
3021 yyextra->lastCContext=YY_START;
3022 BEGIN(SkipCxxComment);
3023 }
3024 }
3025 else
3026 {
3027 if (yytext[2]=='!' || yytext[2]=='*')
3028 {
3029 yyextra->docBlockContext = YY_START;
3030 yyextra->docBlockInBody = FALSE;
3031 yyextra->docBlock.str(std::string());
3032 yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
3033 ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
3034 yyextra->docBlockTerm = 0;
3035 startCommentBlock(yyscanner,FALSE);
3036 BEGIN(DocBlock);
3037 }
3038 else
3039 {
3040 yyextra->lastCContext=YY_START;
3041 BEGIN(SkipComment);
3042 }
3043 }
3044 }
3045<FindMembers,FindFields,ReadInitializer,ReadInitializerPtr>{CPPC}([!/]){B}*{CMD}"}".*|{CCS}([!*]){B}*{CMD}"}"[^*]*{CCE} {
3046 bool insideEnum = YY_START==FindFields || ((YY_START==ReadInitializer || YY_START==ReadInitializerPtr) && yyextra->lastInitializerContext==FindFields); // see bug746226
3047 yyextra->commentScanner.close(yyextra->current.get(),yyextra->fileName,yyextra->yyLineNr,insideEnum);
3048 lineCount(yyscanner);
3049 }
3050<FindMembers>"=>" {
3051 if (!yyextra->insideCS) REJECT;
3052 yyextra->current->bodyLine = yyextra->yyLineNr;
3053 yyextra->current->bodyColumn = yyextra->yyColNr;
3054 yyextra->current->initializer.str(yytext);
3055 yyextra->lastInitializerContext = YY_START;
3056 yyextra->initBracketCount=0;
3057 yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
3058 yyextra->current->spec.setGettable(true);
3059 BEGIN(ReadInitializerPtr);
3060 }
3061<FindMembers>"=" { // in PHP code this could also be due to "<?="
3062 yyextra->current->bodyLine = yyextra->yyLineNr;
3063 yyextra->current->bodyColumn = yyextra->yyColNr;
3064 yyextra->current->initializer.str(yytext);
3065 yyextra->lastInitializerContext = YY_START;
3066 yyextra->initBracketCount=0;
3067 BEGIN(ReadInitializer);
3068 }
3069<UNOIDLAttributeBlock>{BN}*[gs]"et"{BN}+"raises"{BN}*"("{BN}*{SCOPENAME}{BN}*(","{BN}*{SCOPENAME}{BN}*)*")"{BN}*";" {
3070 lineCount(yyscanner);
3071 yyextra->current->exception += " ";
3072 yyextra->current->exception += removeRedundantWhiteSpace(yytext);
3073 }
3074<UNOIDLAttributeBlock>"}" {
3075 yyextra->current->exception += " }";
3076 BEGIN(FindMembers);
3077 }
3078 /* Read initializer rules */
3079<ReadInitializer,ReadInitializerPtr>"(" {
3080 yyextra->lastRoundContext=YY_START;
3081 yyextra->pCopyRoundGString=&yyextra->current->initializer;
3082 yyextra->roundCount=0;
3083 yyextra->current->initializer << *yytext;
3084 BEGIN(GCopyRound);
3085 }
3086<ReadInitializer,ReadInitializerPtr>"[" {
3087 if (!yyextra->insidePHP) REJECT;
3088 yyextra->lastSquareContext=YY_START;
3089 yyextra->pCopySquareGString=&yyextra->current->initializer;
3090 yyextra->squareCount=0;
3091 yyextra->current->initializer << *yytext;
3092 BEGIN(GCopySquare);
3093 }
3094<ReadInitializer,ReadInitializerPtr>"{" {
3095 yyextra->lastCurlyContext=YY_START;
3096 yyextra->pCopyCurlyGString=&yyextra->current->initializer;
3097 yyextra->curlyCount=0;
3098 yyextra->current->initializer << *yytext;
3099 BEGIN(GCopyCurly);
3100 }
3101<ReadInitializer,ReadInitializerPtr>[;,] {
3102 //printf(">> initializer '%s' <<\n",qPrint(yyextra->current->initializer));
3103 if (*yytext==';' && yyextra->current_root->spec.isEnum())
3104 {
3105 yyextra->current->fileName = yyextra->fileName;
3106 yyextra->current->startLine = yyextra->yyLineNr;
3107 yyextra->current->startColumn = yyextra->yyColNr;
3108 yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
3109 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
3110 yyextra->current->section = EntryType::makeVariable();
3111 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
3112 initEntry(yyscanner);
3113 BEGIN(FindMembers);
3114 }
3115 else if (*yytext==';' || (yyextra->lastInitializerContext==FindFields && yyextra->initBracketCount==0)) // yyextra->initBracketCount==0 was added for bug 665778
3116 {
3117 unput(*yytext);
3118 if (YY_START == ReadInitializerPtr) yyextra->current->initializer.str(std::string());
3119 BEGIN(yyextra->lastInitializerContext);
3120 }
3121 else if (*yytext==',' && yyextra->initBracketCount==0) // for "int a=0,b=0"
3122 {
3123 unput(*yytext);
3124 if (YY_START == ReadInitializerPtr) yyextra->current->initializer.str(std::string());
3125 BEGIN(yyextra->lastInitializerContext);
3126 }
3127 else
3128 {
3129 yyextra->current->initializer << *yytext;
3130 }
3131 }
3132<ReadInitializer,ReadInitializerPtr>{RAWBEGIN} { // C++11 raw string
3133 if (!yyextra->insideCpp)
3134 {
3135 REJECT;
3136 }
3137 else
3138 {
3139 yyextra->current->initializer << yytext;
3140 yyextra->delimiter = extractBeginRawStringDelimiter(yytext);
3141 yyextra->lastRawStringContext = YY_START;
3142 yyextra->pCopyRawGString = &yyextra->current->initializer;
3143 BEGIN(RawGString);
3144 //printf("RawGString delimiter='%s'\n",qPrint(delimiter));
3145 }
3146 }
3147<RawGString>{RAWEND} {
3148 if (extractEndRawStringDelimiter(yytext)==yyextra->delimiter)
3149 {
3150 *yyextra->pCopyRawGString << yytext;
3151 BEGIN(yyextra->lastRawStringContext);
3152 }
3153 else
3154 {
3155 REJECT;
3156 }
3157 }
3158<RawGString>[^)\n]+ {
3159 *yyextra->pCopyRawGString << yytext;
3160 }
3161<RawGString>. {
3162 *yyextra->pCopyRawGString << yytext;
3163 }
3164<RawGString>\n {
3165 *yyextra->pCopyRawGString << yytext;
3166 lineCount(yyscanner);
3167 }
3168<RawString>{RAWEND} {
3169 *yyextra->pCopyRawString+=yytext;
3170 yyextra->fullArgString+=yytext;
3171 if (extractEndRawStringDelimiter(yytext)==yyextra->delimiter)
3172 {
3173 BEGIN(yyextra->lastRawStringContext);
3174 }
3175 }
3176<RawString>[^)]+ {
3177 *yyextra->pCopyRawString += yytext;
3178 yyextra->fullArgString+=yytext;
3179 }
3180<RawString>. {
3181 *yyextra->pCopyRawString += yytext;
3182 yyextra->fullArgString+=yytext;
3183 }
3184<RawString>\n {
3185 *yyextra->pCopyRawString += yytext;
3186 yyextra->fullArgString+=yytext;
3187 lineCount(yyscanner);
3188 }
3189<ReadInitializer,ReadInitializerPtr>\" {
3190 if (yyextra->insideIDL && yyextra->insideCppQuote)
3191 {
3192 BEGIN(EndCppQuote);
3193 }
3194 else
3195 {
3196 yyextra->lastStringContext=YY_START;
3197 yyextra->current->initializer << yytext;
3198 yyextra->pCopyQuotedGString=&yyextra->current->initializer;
3199 yyextra->stopAtInvalidString=false;
3200 BEGIN(CopyGString);
3201 }
3202 }
3203<ReadInitializer,ReadInitializerPtr>"->" {
3204 yyextra->current->initializer << yytext;
3205 }
3206<ReadInitializer,ReadInitializerPtr>("<<"|"<=") {
3207 yyextra->current->initializer << yytext;
3208 }
3209<ReadInitializer,ReadInitializerPtr>(">>"|">=") {
3210 yyextra->current->initializer << yytext;
3211 }
3212<ReadInitializer,ReadInitializerPtr>[<\[{(] {
3213 yyextra->initBracketCount++;
3214 yyextra->current->initializer << *yytext;
3215 }
3216<ReadInitializer,ReadInitializerPtr>[>\]})] {
3217 yyextra->initBracketCount--;
3218 if (*yytext=='}')
3219 {
3220 yyextra->current->endBodyLine=yyextra->yyLineNr;
3221 }
3222 yyextra->current->initializer << *yytext;
3223 }
3224<ReadInitializer,ReadInitializerPtr>\' {
3225 if (yyextra->insidePHP)
3226 {
3227 yyextra->current->initializer << yytext;
3228 yyextra->pCopyQuotedGString = &yyextra->current->initializer;
3229 yyextra->lastStringContext=YY_START;
3230 BEGIN(CopyPHPGString);
3231 }
3232 else
3233 {
3234 yyextra->current->initializer << yytext;
3235 }
3236 }
3237<ReadInitializer,ReadInitializerPtr>{CHARLIT} {
3238 if (yyextra->insidePHP)
3239 {
3240 REJECT;
3241 }
3242 else
3243 {
3244 yyextra->current->initializer << yytext;
3245 }
3246 }
3247<ReadInitializer,ReadInitializerPtr>\n {
3248 yyextra->current->initializer << *yytext;
3249 lineCount(yyscanner);
3250 }
3251<ReadInitializer,ReadInitializerPtr>"@\"" {
3252 //printf("yyextra->insideCS=%d\n",yyextra->insideCS);
3253 yyextra->current->initializer << yytext;
3254 if (!yyextra->insideCS && !yyextra->insideObjC)
3255 {
3256 REJECT;
3257 }
3258 else
3259 {
3260 // C#/ObjC verbatim string
3261 yyextra->lastSkipVerbStringContext=YY_START;
3262 yyextra->pSkipVerbString=&yyextra->current->initializer;
3263 BEGIN(SkipVerbString);
3264 }
3265 }
3266<SkipVerbString>[^\n"\\]+ {
3267 *yyextra->pSkipVerbString << yytext;
3268 }
3269<SkipVerbString>"\\\\" { // escaped backslash
3270 if (yyextra->insideCS) REJECT
3271 *yyextra->pSkipVerbString << yytext;
3272 }
3273<SkipVerbString>"\\\"" { // backslash escaped quote
3274 if (yyextra->insideCS) REJECT
3275 *yyextra->pSkipVerbString << yytext;
3276 }
3277<SkipVerbString>"\"\"" { // quote escape
3278 *yyextra->pSkipVerbString << yytext;
3279 }
3280<SkipVerbString>"\"" {
3281 *yyextra->pSkipVerbString << *yytext;
3282 BEGIN(yyextra->lastSkipVerbStringContext);
3283 }
3284<SkipVerbString>\n {
3285 *yyextra->pSkipVerbString << *yytext;
3286 lineCount(yyscanner);
3287 }
3288<SkipVerbString>. {
3289 *yyextra->pSkipVerbString << *yytext;
3290 }
3291<ReadInitializer,ReadInitializerPtr>"?>" {
3292 if (yyextra->insidePHP)
3293 BEGIN( FindMembersPHP );
3294 else
3295 yyextra->current->initializer << yytext;
3296 }
3297<ReadInitializer,ReadInitializerPtr>. {
3298 yyextra->current->initializer << *yytext;
3299 }
3300
3301 /* generic quoted string copy rules */
3302<CopyString,CopyPHPString>\\. {
3303 *yyextra->pCopyQuotedString+=yytext;
3304 }
3305<CopyString>\" {
3306 *yyextra->pCopyQuotedString+=*yytext;
3307 BEGIN( yyextra->lastStringContext );
3308 }
3309<CopyPHPString>\' {
3310 *yyextra->pCopyQuotedString+=*yytext;
3311 BEGIN( yyextra->lastStringContext );
3312 }
3313<CopyString,CopyPHPString>{CCS}|{CCE}|{CPPC} {
3314 *yyextra->pCopyQuotedString+=yytext;
3315 }
3316<CopyString,CopyPHPString>\n {
3317 *yyextra->pCopyQuotedString+=*yytext;
3318 lineCount(yyscanner);
3319 }
3320<CopyString,CopyPHPString>. {
3321 *yyextra->pCopyQuotedString+=*yytext;
3322 }
3323
3324 /* generic quoted growable string copy rules */
3325<CopyGString,CopyPHPGString>\\. {
3326 *yyextra->pCopyQuotedGString << yytext;
3327 }
3328<CopyGString>\" {
3329 *yyextra->pCopyQuotedGString << *yytext;
3330 BEGIN( yyextra->lastStringContext );
3331 }
3332<CopyPHPGString>\' {
3333 *yyextra->pCopyQuotedGString << *yytext;
3334 BEGIN( yyextra->lastStringContext );
3335 }
3336<CopyGString,CopyPHPGString>"<?php" { // we had an odd number of quotes.
3337 *yyextra->pCopyQuotedGString << yytext;
3338 BEGIN( yyextra->lastStringContext );
3339 }
3340<CopyGString,CopyPHPGString>{CCS}|{CCE}|{CPPC} {
3341 *yyextra->pCopyQuotedGString << yytext;
3342 }
3343<CopyGString,CopyPHPGString>\n {
3344 *yyextra->pCopyQuotedGString << *yytext;
3345 if (yyextra->stopAtInvalidString)
3346 {
3347 BEGIN( yyextra->lastStringContext );
3348 }
3349 else
3350 {
3351 lineCount(yyscanner);
3352 }
3353 }
3354<CopyGString,CopyPHPGString>. {
3355 *yyextra->pCopyQuotedGString << *yytext;
3356 }
3357
3358 /* generic round bracket list copy rules */
3359<CopyRound>\" {
3360 *yyextra->pCopyRoundString += *yytext;
3361 yyextra->pCopyQuotedString=yyextra->pCopyRoundString;
3362 yyextra->lastStringContext=YY_START;
3363 BEGIN(CopyString);
3364 }
3365<CopyRound>"(" {
3366 *yyextra->pCopyRoundString += *yytext;
3367 yyextra->roundCount++;
3368 }
3369<CopyRound>")" {
3370 *yyextra->pCopyRoundString += *yytext;
3371 if (--yyextra->roundCount<0)
3372 BEGIN(yyextra->lastRoundContext);
3373 }
3374<CopyRound>\n {
3375 lineCount(yyscanner);
3376 *yyextra->pCopyRoundString += *yytext;
3377 }
3378<CopyRound>\' {
3379 if (yyextra->insidePHP)
3380 {
3381 yyextra->current->initializer << yytext;
3382 yyextra->pCopyQuotedString = yyextra->pCopyRoundString;
3383 yyextra->lastStringContext=YY_START;
3384 BEGIN(CopyPHPString);
3385 }
3386 else
3387 {
3388 *yyextra->pCopyRoundString += yytext;
3389 }
3390 }
3391<CopyRound>{CHARLIT} {
3392 if (yyextra->insidePHP)
3393 {
3394 REJECT;
3395 }
3396 else
3397 {
3398 *yyextra->pCopyRoundString+=yytext;
3399 }
3400 }
3401<CopyRound>[^"'()\n,]+ {
3402 *yyextra->pCopyRoundString+=yytext;
3403 }
3404<CopyRound>. {
3405 *yyextra->pCopyRoundString+=*yytext;
3406 }
3407
3408 /* generic sharp bracket list copy rules */
3409<CopySharp>\" {
3410 *yyextra->pCopySharpString += *yytext;
3411 yyextra->pCopyQuotedString=yyextra->pCopySharpString;
3412 yyextra->lastStringContext=YY_START;
3413 BEGIN(CopyString);
3414 }
3415<CopySharp>"<" {
3416 *yyextra->pCopySharpString += *yytext;
3417 yyextra->sharpCount++;
3418 }
3419<CopySharp>">" {
3420 *yyextra->pCopySharpString += *yytext;
3421 if (--yyextra->sharpCount<0)
3422 {
3423 BEGIN(yyextra->lastSharpContext);
3424 }
3425 }
3426<CopySharp>\n {
3427 lineCount(yyscanner);
3428 *yyextra->pCopySharpString += *yytext;
3429 }
3430<CopySharp>\' {
3431 if (yyextra->insidePHP)
3432 {
3433 yyextra->current->initializer << yytext;
3434 yyextra->pCopyQuotedString = yyextra->pCopySharpString;
3435 yyextra->lastStringContext=YY_START;
3436 BEGIN(CopyPHPString);
3437 }
3438 else
3439 {
3440 *yyextra->pCopySharpString += yytext;
3441 }
3442 }
3443<CopySharp>{CHARLIT} {
3444 if (yyextra->insidePHP)
3445 {
3446 REJECT;
3447 }
3448 else
3449 {
3450 *yyextra->pCopySharpString+=yytext;
3451 }
3452 }
3453<CopySharp>[^"'<>\n,]+ {
3454 *yyextra->pCopySharpString+=yytext;
3455 }
3456<CopySharp>. {
3457 *yyextra->pCopySharpString+=*yytext;
3458 }
3459
3460
3461 /* generic round bracket list copy rules for growable strings */
3462<GCopyRound>\" {
3463 *yyextra->pCopyRoundGString << *yytext;
3464 yyextra->pCopyQuotedGString=yyextra->pCopyRoundGString;
3465 yyextra->lastStringContext=YY_START;
3466 BEGIN(CopyGString);
3467 }
3468<GCopyRound>"(" {
3469 *yyextra->pCopyRoundGString << *yytext;
3470 yyextra->roundCount++;
3471 }
3472<GCopyRound>")" {
3473 *yyextra->pCopyRoundGString << *yytext;
3474 if (--yyextra->roundCount<0)
3475 BEGIN(yyextra->lastRoundContext);
3476 }
3477<GCopyRound>\n {
3478 lineCount(yyscanner);
3479 *yyextra->pCopyRoundGString << *yytext;
3480 }
3481<GCopyRound>\' {
3482 if (yyextra->insidePHP)
3483 {
3484 yyextra->current->initializer << yytext;
3485 yyextra->pCopyQuotedGString = yyextra->pCopyRoundGString;
3486 yyextra->lastStringContext=YY_START;
3487 BEGIN(CopyPHPGString);
3488 }
3489 else
3490 {
3491 *yyextra->pCopyRoundGString << yytext;
3492 }
3493 }
3494<GCopyRound>{CHARLIT} {
3495 if (yyextra->insidePHP)
3496 {
3497 REJECT;
3498 }
3499 else
3500 {
3501 *yyextra->pCopyRoundGString << yytext;
3502 }
3503 }
3504<GCopyRound>"@\"" {
3505 if (!yyextra->insideCS) REJECT;
3506 *yyextra->pCopyRoundGString << yytext;
3507 yyextra->lastSkipVerbStringContext=YY_START;
3508 yyextra->pSkipVerbString=yyextra->pCopyRoundGString;
3509 BEGIN(SkipVerbString);
3510 }
3511<GCopyRound>[^"'()\n\/,R]+ { // R because of raw string start
3512 *yyextra->pCopyRoundGString << yytext;
3513 }
3514<GCopyRound>{RAWBEGIN} {
3515 *yyextra->pCopyRoundGString << yytext;
3516 yyextra->delimiter = extractBeginRawStringDelimiter(yytext);
3517 yyextra->lastRawStringContext = YY_START;
3518 yyextra->pCopyRawGString = yyextra->pCopyRoundGString;
3519 BEGIN(RawGString);
3520 }
3521<GCopyRound>. {
3522 *yyextra->pCopyRoundGString << *yytext;
3523 }
3524
3525 /* generic square bracket list copy rules for growable strings, we should only enter here in case of php, left the test part as in GCopyRound to keep it compatible with the round bracket version */
3526<GCopySquare>\" {
3527 *yyextra->pCopySquareGString << *yytext;
3528 yyextra->pCopyQuotedGString=yyextra->pCopySquareGString;
3529 yyextra->lastStringContext=YY_START;
3530 BEGIN(CopyGString);
3531 }
3532<GCopySquare>\' {
3533 *yyextra->pCopySquareGString << *yytext;
3534 if (yyextra->insidePHP)
3535 {
3536 yyextra->pCopyQuotedGString=yyextra->pCopySquareGString;
3537 yyextra->lastStringContext=YY_START;
3538 BEGIN(CopyPHPGString);
3539 }
3540 }
3541<GCopySquare>"[" {
3542 *yyextra->pCopySquareGString << *yytext;
3543 yyextra->squareCount++;
3544 }
3545<GCopySquare>"]" {
3546 *yyextra->pCopySquareGString << *yytext;
3547 if (--yyextra->squareCount<0)
3548 BEGIN(yyextra->lastSquareContext);
3549 }
3550<GCopySquare>\n {
3551 lineCount(yyscanner);
3552 *yyextra->pCopySquareGString << *yytext;
3553 }
3554<GCopySquare>\' {
3555 if (yyextra->insidePHP)
3556 {
3557 yyextra->current->initializer << yytext;
3558 yyextra->pCopyQuotedGString = yyextra->pCopySquareGString;
3559 yyextra->lastStringContext=YY_START;
3560 BEGIN(CopyPHPGString);
3561 }
3562 else
3563 {
3564 *yyextra->pCopySquareGString << yytext;
3565 }
3566 }
3567<GCopySquare>{CHARLIT} {
3568 if (yyextra->insidePHP)
3569 {
3570 REJECT;
3571 }
3572 else
3573 {
3574 *yyextra->pCopySquareGString << yytext;
3575 }
3576 }
3577<GCopySquare>[^"'\[\]\n\/,]+ {
3578 *yyextra->pCopySquareGString << yytext;
3579 }
3580<GCopySquare>. {
3581 *yyextra->pCopySquareGString << *yytext;
3582 }
3583
3584 /* generic curly bracket list copy rules */
3585<CopyCurly>\" {
3586 *yyextra->pCopyCurlyString += *yytext;
3587 yyextra->pCopyQuotedString=yyextra->pCopyCurlyString;
3588 yyextra->lastStringContext=YY_START;
3589 BEGIN(CopyString);
3590 }
3591<CopyCurly>\' {
3592 *yyextra->pCopyCurlyString += *yytext;
3593 if (yyextra->insidePHP)
3594 {
3595 yyextra->pCopyQuotedString=yyextra->pCopyCurlyString;
3596 yyextra->lastStringContext=YY_START;
3597 BEGIN(CopyPHPString);
3598 }
3599 }
3600<CopyCurly>"{" {
3601 *yyextra->pCopyCurlyString += *yytext;
3602 yyextra->curlyCount++;
3603 }
3604<CopyCurly>"}" {
3605 *yyextra->pCopyCurlyString += *yytext;
3606 if (--yyextra->curlyCount<0)
3607 BEGIN(yyextra->lastCurlyContext);
3608 }
3609<CopyCurly>{CHARLIT} { if (yyextra->insidePHP)
3610 {
3611 REJECT;
3612 }
3613 else
3614 {
3615 *yyextra->pCopyCurlyString += yytext;
3616 }
3617 }
3618<CopyCurly>[^"'{}\/\n,]+ {
3619 *yyextra->pCopyCurlyString += yytext;
3620 }
3621<CopyCurly>"/" { *yyextra->pCopyCurlyString += yytext; }
3622<CopyCurly>\n {
3623 lineCount(yyscanner);
3624 *yyextra->pCopyCurlyString += *yytext;
3625 }
3626<CopyCurly>. {
3627 *yyextra->pCopyCurlyString += *yytext;
3628 }
3629
3630 /* generic curly bracket list copy rules for growable strings */
3631<GCopyCurly>^"#"{B}+[0-9]+{B}+"\""[^\"\n]+"\""{B}+"1"{B}*\n? { // start of included file marker
3632 }
3633<GCopyCurly>^"#"{B}+[0-9]+{B}+"\""[^\"\n]+"\""{B}+"2"{B}*\n? { // end of included file marker
3634 QCString line = QCString(yytext);
3635 int s = line.find(' ');
3636 int e = line.find('"',s);
3637 yyextra->yyLineNr = line.mid(s,e-s).toInt();
3638 if (yytext[yyleng-1]=='\n')
3639 {
3640 lineCount(yyscanner);
3641 yyextra->column=0;
3642 }
3643 }
int toInt(bool *ok=nullptr, int base=10) const
Definition qcstring.cpp:249
3644<GCopyCurly>\" {
3645 *yyextra->pCopyCurlyGString << *yytext;
3646 yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString;
3647 yyextra->lastStringContext=YY_START;
3648 BEGIN(CopyGString);
3649 }
3650<GCopyCurly>\' {
3651 *yyextra->pCopyCurlyGString << *yytext;
3652 if (yyextra->insidePHP)
3653 {
3654 yyextra->pCopyQuotedGString=yyextra->pCopyCurlyGString;
3655 yyextra->lastStringContext=YY_START;
3656 BEGIN(CopyPHPGString);
3657 }
3658 }
3659<GCopyCurly>"{" {
3660 *yyextra->pCopyCurlyGString << *yytext;
3661 yyextra->curlyCount++;
3662 }
3663<GCopyCurly>"}" {
3664 *yyextra->pCopyCurlyGString << *yytext;
3665 if (--yyextra->curlyCount<0)
3666 {
3667 yyextra->current->endBodyLine = yyextra->yyLineNr;
3668 BEGIN(yyextra->lastCurlyContext);
3669 }
3670 }
3671<GCopyCurly>{CHARLIT} { if (yyextra->insidePHP)
3672 {
3673 REJECT;
3674 }
3675 else
3676 {
3677 *yyextra->pCopyCurlyGString << yytext;
3678 }
3679 }
3680<GCopyCurly>[^"'{}\/\n,]+ {
3681 *yyextra->pCopyCurlyGString << yytext;
3682 }
3683<GCopyCurly>[,]+ {
3684 *yyextra->pCopyCurlyGString << yytext;
3685 }
3686<GCopyCurly>"/" { *yyextra->pCopyCurlyGString << yytext; }
3687<GCopyCurly>\n {
3688 lineCount(yyscanner);
3689 *yyextra->pCopyCurlyGString << *yytext;
3690 }
3691<GCopyCurly>. {
3692 *yyextra->pCopyCurlyGString << *yytext;
3693 }
3694
3695 /* ---------------------- */
3696
3697
3698<FindMembers>":" {
3699 if (yyextra->current->type.isEmpty() &&
3700 yyextra->current->name=="enum") // see bug 69041, C++11 style anon enum: 'enum : unsigned int {...}'
3701 {
3702 yyextra->current->section = EntryType::makeEnum();
3703 yyextra->current->name.clear();
3704 yyextra->current->args.clear();
3705 BEGIN(EnumBaseType);
3706 }
3707 else
3708 {
3709 if (yyextra->current->type.isEmpty()) // anonymous padding field, e.g. "int :7;"
3710 {
3711 addType(yyscanner);
3712 yyextra->current->name.sprintf("__pad%d__",yyextra->padCount++);
3713 }
3714 BEGIN(BitFields);
3715 yyextra->current->bitfields+=":";
3716 }
3717 }
3718<BitFields>. {
3719 yyextra->current->bitfields+=*yytext;
3720 }
3721<EnumBaseType>. {
3722 yyextra->current->args+=*yytext;
3723 }
3724<EnumBaseType>\n {
3725 lineCount(yyscanner);
3726 yyextra->current->args+=' ';
3727 }
3728<FindMembers>[;,] {
3729 QCString oldType = yyextra->current->type;
3730 if (yyextra->current->bodyLine==-1)
3731 {
3732 yyextra->current->bodyLine = yyextra->yyLineNr;
3733 yyextra->current->bodyColumn = yyextra->yyColNr;
3734 }
3735 if ( yyextra->insidePHP && yyextra->current->type.startsWith("var"))
3736 {
3737 yyextra->current->type = yyextra->current->type.mid(3);
3738 }
3739 if (yyextra->isTypedef && !yyextra->current->type.startsWith("typedef "))
3740 {
3741 yyextra->current->type.prepend("typedef ");
3742 }
3743 bool isStatic = yyextra->current->isStatic;
3744 Protection prot = yyextra->current->protection;
3745 bool isConcept = yyextra->current->section.isConcept();
3746 bool isModule = yyextra->current->section.isModuleDoc();
3747 if (isConcept) // C++20 concept
3748 {
3749 yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
3750 initEntry(yyscanner);
3751 }
3752 else if (isModule) // C++20 module
3753 {
3754 yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
3755 initEntry(yyscanner);
3756 }
3757 else if (!yyextra->current->name.isEmpty() && !yyextra->current->section.isEnum())
3758 {
3759 yyextra->current->type=yyextra->current->type.simplifyWhiteSpace();
3760 yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
3761 yyextra->current->name=yyextra->current->name.stripWhiteSpace();
3762 if (yyextra->current->section.isClass()) // remove spec for "struct Bla bla;"
3763 {
3764 yyextra->current->spec = TypeSpecifier();
3765 }
3766 yyextra->current->section = EntryType::makeVariable() ;
3767 yyextra->current->fileName = yyextra->fileName;
3768 yyextra->current->startLine = yyextra->yyBegLineNr;
3769 yyextra->current->startColumn = yyextra->yyBegColNr;
3770 yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
3771 initEntry(yyscanner);
3772 }
3773 if ( *yytext == ',')
3774 {
3775 yyextra->current->isStatic = isStatic; // the static attribute holds for all variables
3776 yyextra->current->protection = prot;
3777 yyextra->current->name.clear();
3778 yyextra->current->args.clear();
3779 yyextra->current->brief.clear();
3780 yyextra->current->doc.clear();
3781 yyextra->current->initializer.str(std::string());
3782 yyextra->current->bitfields.clear();
3783 yyextra->current->type = stripFuncPtr(oldType);
3784 }
3785 else
3786 {
3787 yyextra->mtype = MethodTypes::Method;
3788 yyextra->virt = Specifier::Normal;
3789 yyextra->current->bodyLine = -1;
3790 yyextra->current->bodyColumn = 1;
3791 yyextra->current->groups.clear();
3792 initEntry(yyscanner);
3793 }
3794 }
3795
3796<FindMembers>"[" {
3797 if (yyextra->insideSlice)
3798 {
3799 yyextra->squareCount=1;
3800 yyextra->lastSquareContext = YY_START;
3801 yyextra->current->metaData += "[";
3802 BEGIN( SliceMetadata );
3803 }
3804 else if (!yyextra->insideCS &&
3805 (yyextra->current->name.isEmpty() ||
3806 yyextra->current->name=="typedef"
3807 )
3808 ) // IDL function property
3809 {
3810 yyextra->squareCount=1;
3811 yyextra->lastSquareContext = YY_START;
3812 yyextra->idlAttr.clear();
3813 yyextra->idlProp.clear();
3814 yyextra->current->mtype = yyextra->mtype;
3815
3816 if (Config_getBool(IDL_PROPERTY_SUPPORT) &&
3817 yyextra->current->mtype == MethodTypes::Property)
3818 { // we are yyextra->inside the properties section of a dispinterface
3819 yyextra->odlProp = true;
3820 yyextra->current->spec.setGettable(true).setSettable(true);
3821 }
3822
3823 BEGIN( IDLAttribute );
3824 }
3825 else if (yyextra->insideCS &&
3826 yyextra->current->name.isEmpty())
3827 {
3828 yyextra->squareCount=1;
3829 yyextra->lastSquareContext = YY_START;
3830 // Skip the C# attribute
3831 // for this member
3832 yyextra->current->args.clear();
3833 BEGIN( SkipSquare );
3834 }
3835 else
3836 {
3837 yyextra->current->args += yytext ;
3838 yyextra->squareCount=1;
3839 yyextra->externLinkage=FALSE; // see bug759247
3840 BEGIN( Array ) ;
3841 }
3842 }
3843<SliceMetadata>"[" { // Global metadata.
3844 yyextra->squareCount++;
3845 yyextra->current->metaData += "[";
3846 }
3847<SliceMetadata>{BN}* {
3848 lineCount(yyscanner);
3849 }
3850<SliceMetadata>\"[^\"]*\" {
3851 yyextra->current->metaData += yytext;
3852 }
3853<SliceMetadata>"," {
3854 yyextra->current->metaData += yytext;
3855 }
3856<SliceMetadata>"]" {
3857 yyextra->current->metaData += yytext;
3858 if (--yyextra->squareCount<=0)
3859 {
3860 BEGIN (yyextra->lastSquareContext);
3861 }
3862 }
3863<SliceOptional>"(" {
3864 yyextra->current->type += "(";
3865 yyextra->roundCount++;
3866 }
3867<SliceOptional>[0-9]+ {
3868 yyextra->current->type += yytext;
3869 }
3870<SliceOptional>")" {
3871 yyextra->current->type += ")";
3872 if(--yyextra->roundCount<=0)
3873 {
3874 BEGIN (yyextra->lastModifierContext);
3875 }
3876 }
3877<IDLAttribute>"]" {
3878 // end of IDL function attribute
3879 if (--yyextra->squareCount<=0)
3880 {
3881 lineCount(yyscanner);
3882 if (yyextra->current->mtype == MethodTypes::Property)
3883 BEGIN( IDLPropName );
3884 else
3885 BEGIN( yyextra->lastSquareContext );
3886 }
3887 }
3888<IDLAttribute>"propput" {
3889 if (Config_getBool(IDL_PROPERTY_SUPPORT))
3890 {
3891 yyextra->current->mtype = MethodTypes::Property;
3892 }
3893 yyextra->current->spec.setSettable(true);
3894 }
3895<IDLAttribute>"propget" {
3896 if (Config_getBool(IDL_PROPERTY_SUPPORT))
3897 {
3898 yyextra->current->mtype = MethodTypes::Property;
3899 }
3900 yyextra->current->spec.setGettable(true);
3901 }
3902<IDLAttribute>"property" { // UNO IDL property
3903 yyextra->current->spec.setProperty(true);
3904 }
3905<IDLAttribute>"attribute" { // UNO IDL attribute
3906 yyextra->current->spec.setAttribute(true);
3907 }
3908<IDLAttribute>"optional" { // on UNO IDL interface/service/attribute/property
3909 yyextra->current->spec.setOptional(true);
3910 }
3911<IDLAttribute>"readonly" { // on UNO IDL attribute or property
3912 if (Config_getBool(IDL_PROPERTY_SUPPORT) && yyextra->odlProp)
3913 {
3914 yyextra->current->spec.setSettable(false);
3915 }
3916 else
3917 {
3918 yyextra->current->spec.setReadonly(true);
3919 }
3920 }
3921<IDLAttribute>"bound" { // on UNO IDL attribute or property
3922 yyextra->current->spec.setBound(true);
3923 }
3924<IDLAttribute>"removable" { // on UNO IDL property
3925 yyextra->current->spec.setRemovable(true);
3926 }
3927<IDLAttribute>"constrained" { // on UNO IDL property
3928 yyextra->current->spec.setConstrained(true);
3929 }
3930<IDLAttribute>"transient" { // on UNO IDL property
3931 yyextra->current->spec.setTransient(true);
3932 }
3933<IDLAttribute>"maybevoid" { // on UNO IDL property
3934 yyextra->current->spec.setMaybeVoid(true);
3935 }
3936<IDLAttribute>"maybedefault" { // on UNO IDL property
3937 yyextra->current->spec.setMaybeDefault(true);
3938 }
3939<IDLAttribute>"maybeambiguous" { // on UNO IDL property
3940 yyextra->current->spec.setMaybeAmbiguous(true);
3941 }
3942<IDLAttribute>. {
3943 }
3944<IDLPropName>{BN}*{ID}({BN}*[*]*{BN}*)? {
3945 // return type (probably HRESULT) - skip it
3946
3947 if (yyextra->odlProp)
3948 { // property type
3949 yyextra->idlProp = yytext;
3950 }
3951 }
3952<IDLPropName>{ID}{BN}*"(" {
3953 yyextra->current->name = yytext;
3954 yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
3955 yyextra->current->startLine = yyextra->yyLineNr;
3956 yyextra->current->startColumn = yyextra->yyColNr;
3957 BEGIN( IDLProp );
3958 }
3959<IDLPropName>{BN}*"("{BN}*{ID}{BN}*")"{BN}* {
3960 if (yyextra->odlProp)
3961 {
3962 yyextra->idlProp += yytext;
3963 }
3964 }
3965<IDLPropName>{ID}{BNopt}/";" {
3966 if (yyextra->odlProp)
3967 {
3968 yyextra->current->name = yytext;
3969 yyextra->idlProp = yyextra->idlProp.stripWhiteSpace();
3970 yyextra->odlProp = false;
3971
3972 BEGIN( IDLProp );
3973 }
3974 }
3975<IDLProp>{BN}*"["[^\]]*"]"{BN}* { // attribute of a parameter
3976 yyextra->idlAttr = yytext;
3977 yyextra->idlAttr=yyextra->idlAttr.stripWhiteSpace();
3978 }
3979<IDLProp>{ID} { // property type
3980 yyextra->idlProp = yytext;
3981 }
3982<IDLProp>{BN}*{ID}{BN}*"," { // Rare: Another parameter ([propput] HRESULT Item(int index, [in] Type theRealProperty);)
3983 if (yyextra->current->args.isEmpty())
3984 yyextra->current->args = "(";
3985 else
3986 yyextra->current->args += ", ";
3987 yyextra->current->args += yyextra->idlAttr;
3988 yyextra->current->args += " ";
3989 yyextra->current->args += yyextra->idlProp; // prop was actually type of extra parameter
3990 yyextra->current->args += " ";
3991 yyextra->current->args += yytext;
3992 yyextra->current->args = yyextra->current->args.left(yyextra->current->args.length() - 1); // strip comma
3993 yyextra->idlProp.clear();
3994 yyextra->idlAttr.clear();
3995 BEGIN( IDLProp );
3996 }
3997<IDLProp>{BN}*{ID}{BN}*")"{BN}* {
3998 // the parameter name for the property - just skip.
3999 }
4000<IDLProp>";" {
4001 yyextra->current->fileName = yyextra->fileName;
4002 yyextra->current->type = yyextra->idlProp;
4003 yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
4004 if (!yyextra->current->args.isEmpty())
4005 yyextra->current->args += ")";
4006 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
4007 yyextra->current->section = EntryType::makeVariable();
4008 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
4009 initEntry(yyscanner);
4010 BEGIN( FindMembers );
4011 }
4012<IDLProp>. { // spaces, *, or other stuff
4013 //yyextra->idlProp+=yytext;
4014 }
4015<Array>"]" { yyextra->current->args += *yytext ;
4016 if (--yyextra->squareCount<=0)
4017 BEGIN( FindMembers ) ;
4018 }
4019<FuncFuncArray>"]" { yyextra->current->args += *yytext ;
4020 if (--yyextra->squareCount<=0)
4021 BEGIN( SFunction ) ;
4022 }
4023<Array,FuncFuncArray>"[" { yyextra->current->args += *yytext ;
4024 yyextra->squareCount++;
4025 }
4026<Array,FuncFuncArray>. { yyextra->current->args += *yytext ; }
4027<SkipSquare>"[" { yyextra->squareCount++; }
4028<SkipSquare>"]" {
4029 if (--yyextra->squareCount<=0)
4030 BEGIN( yyextra->lastSquareContext );
4031 }
4032<SkipSquare>\" {
4033 yyextra->lastStringContext=YY_START;
4034 BEGIN( SkipString );
4035 }
4036<SkipSquare>[^\n\[\]\"]+
4037<FindMembers>"<" { addType(yyscanner);
4038 yyextra->current->type += yytext ;
4039 BEGIN( Sharp ) ;
4040 }
4041<Sharp>">" { yyextra->current->type += *yytext ;
4042 if (--yyextra->sharpCount<=0)
4043 BEGIN( FindMembers ) ;
4044 }
4045<Sharp>"<" { yyextra->current->type += *yytext ;
4046 yyextra->sharpCount++;
4047 }
4048<Sharp>{BN}+ {
4049 yyextra->current->type += ' ';
4050 lineCount(yyscanner);
4051 }
4052<Sharp>. { yyextra->current->type += *yytext ; }
4053<FindFields>{ID} {
4054 storeClangId(yyscanner,yytext);
4055 yyextra->current->bodyLine = yyextra->yyLineNr;
4056 yyextra->current->bodyColumn = yyextra->yyColNr;
4057 yyextra->current->name = yytext;
4058 }
4059<FindFields>[({] {
4060 // Java enum initializer
4061 unput(*yytext);
4062 yyextra->lastInitializerContext = YY_START;
4063 yyextra->initBracketCount=0;
4064 yyextra->current->initializer.str("=");
4065 BEGIN(ReadInitializer);
4066 }
4067<FindFields>"=" {
4068 yyextra->lastInitializerContext = YY_START;
4069 yyextra->initBracketCount=0;
4070 yyextra->current->initializer.str(yytext);
4071 BEGIN(ReadInitializer);
4072 }
4073<FindFields>";" {
4074 if (yyextra->insideJava) // yyextra->last enum field in Java class
4075 {
4076 if (!yyextra->current->name.isEmpty())
4077 {
4078 yyextra->current->fileName = yyextra->fileName;
4079 yyextra->current->startLine = yyextra->yyLineNr;
4080 yyextra->current->startColumn = yyextra->yyColNr;
4081 if (!yyextra->current_root->spec.isEnum())
4082 {
4083 yyextra->current->type = "@"; // enum marker
4084 }
4085 yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
4086 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
4087 yyextra->current->section = EntryType::makeVariable();
4088 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
4089 initEntry(yyscanner);
4090 }
4091
4092 BEGIN( FindMembers );
4093 }
4094 else
4095 {
4096 REJECT;
4097 }
4098 }
4099<FindFields>"," {
4100 //printf("adding '%s' '%s' '%s' to enum '%s' (mGrpId=%d)\n",
4101 // qPrint(yyextra->current->type), qPrint(yyextra->current->name),
4102 // qPrint(yyextra->current->args), qPrint(yyextra->current_root->name),yyextra->current->mGrpId);
4103 if (!yyextra->current->name.isEmpty())
4104 {
4105 yyextra->current->fileName = yyextra->fileName;
4106 if (yyextra->current_root->section.isEnum() || yyextra->current_root->spec.isEnum())
4107 {
4108 yyextra->current->startLine = yyextra->current->bodyLine;
4109 yyextra->current->startColumn = yyextra->current->bodyColumn;
4110 }
4111 else
4112 {
4113 yyextra->current->startLine = yyextra->yyLineNr;
4114 yyextra->current->startColumn = yyextra->yyColNr;
4115 }
4116 if (!yyextra->current_root->spec.isEnum())
4117 {
4118 yyextra->current->type = "@"; // enum marker
4119 }
4120 yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
4121 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
4122 yyextra->current->section = EntryType::makeVariable();
4123 // add to the scope of the enum
4124 if (!yyextra->insideCS && !yyextra->insideJava &&
4125 !yyextra->current_root->spec.isStrong())
4126 // for C# and Java 1.5+ enum values always have to be explicitly qualified,
4127 // same for C++11 style enums (enum class Name {})
4128 {
4129 // add to the scope surrounding the enum (copy!)
4130 // we cannot during it directly as that would invalidate the iterator in parseCompounds.
4131 //printf("*** adding outer scope entry for %s\n",qPrint(yyextra->current->name));
4132 yyextra->outerScopeEntries.emplace_back(yyextra->current_root->parent(), std::make_shared<Entry>(*yyextra->current));
4133 }
4134 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
4135 initEntry(yyscanner);
4136 }
4137 else // probably a redundant ,
4138 {
4139 yyextra->current->reset();
4140 initEntry(yyscanner);
4141 }
4142 }
4143<FindFields>"[" { // attribute list in IDL
4144 yyextra->squareCount=1;
4145 yyextra->lastSquareContext = YY_START;
4146 BEGIN(SkipSquare);
4147 }
4148<ReadBody,ReadNSBody,ReadBodyIntf>[^\r\n\#{}"@'/<\\\$R]* { yyextra->current->program << yytext ; } // R because of raw string start
4149<ReadBody,ReadNSBody,ReadBodyIntf>{CPPC}.* { yyextra->current->program << yytext ; }
4150<ReadBody,ReadNSBody,ReadBodyIntf>"#".* { if (!yyextra->insidePHP)
4151 REJECT;
4152 // append PHP comment.
4153 yyextra->current->program << yytext ;
4154 }
4155 /* Interpolated string C# */
4156<SkipCurly,ReadBody,ReadNSBody,ReadBodyIntf,FindMembers,FindMemberName>$\" { if (!yyextra->insideCS) REJECT
4157 yyextra->current->program << yytext ;
4158 yyextra->pSkipInterpString = &yyextra->current->program;
4159 yyextra->lastSkipInterpStringContext=YY_START;
4160 BEGIN( SkipInterpString );
4161 }
4162<SkipInterpString>([^"\\{}\x000D\x000A\x0085\x2028\x2029]|"{{"|"}}"|"\\'"|"\\\""|"\\\\"|"\\0"|"\\a"|"\\b"|"\\f"|"\\n"|"\\r"|"\\t"|"\\v"|"\\x"{HEXDIGIT}{HEXDIGIT}?{HEXDIGIT}?{HEXDIGIT}?|"\\"[uU]{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT}{HEXDIGIT})* {
4163 *yyextra->pSkipInterpString << yytext;
4164 }
4165<SkipInterpString>\" {
4166 *yyextra->pSkipInterpString << *yytext;
4167 BEGIN( yyextra->lastSkipInterpStringContext );
4168 }
4169 /* Verbatim Interpolated string C# */
4170<SkipCurly,ReadBody,ReadNSBody,ReadBodyIntf,FindMembers,FindMemberName>$@\" { if (!yyextra->insideCS) REJECT
4171 yyextra->current->program << yytext ;
4172 yyextra->pSkipInterpVerbString = &yyextra->current->program;
4173 yyextra->lastSkipInterpVerbStringContext=YY_START;
4174 BEGIN( SkipInterpVerbString );
4175 }
4176<SkipInterpVerbString>([^\"{}]|"{{"|"}}"|"\"\"")* {
4177 *yyextra->pSkipInterpVerbString << yytext;
4178 }
4179<SkipInterpString>"{"[^}]*"}" {
4180 *yyextra->pSkipInterpString << yytext;
4181 }
4182<SkipInterpVerbString>"{"[^}]*"}" {
4183 *yyextra->pSkipInterpVerbString << yytext;
4184 }
4185<SkipInterpVerbString>\" {
4186 *yyextra->pSkipInterpVerbString << *yytext;
4187 BEGIN( yyextra->lastSkipInterpVerbStringContext );
4188 }
4189<ReadBody,ReadNSBody,ReadBodyIntf>"\$" { yyextra->current->program << yytext ; }
4190<ReadBody,ReadNSBody,ReadBodyIntf>@\" { yyextra->current->program << yytext ;
4191 yyextra->pSkipVerbString = &yyextra->current->program;
4192 yyextra->lastSkipVerbStringContext=YY_START;
4193 BEGIN( SkipVerbString );
4194 }
4195<ReadBody,ReadNSBody,ReadBodyIntf>"<<<" { if (yyextra->insidePHP)
4196 {
4197 yyextra->current->program << yytext ;
4198 yyextra->pCopyHereDocGString = &yyextra->current->program;
4199 yyextra->lastHereDocContext=YY_START;
4200 BEGIN( CopyHereDoc );
4201 }
4202 else
4203 {
4204 REJECT;
4205 }
4206 }
4207<ReadBody,ReadNSBody,ReadBodyIntf>{RAWBEGIN} {
4208 yyextra->current->program << yytext;
4209 yyextra->delimiter = extractBeginRawStringDelimiter(yytext);
4210 yyextra->lastRawStringContext = YY_START;
4211 yyextra->pCopyRawGString = &yyextra->current->program;
4212 BEGIN(RawGString);
4213 }
4214<ReadBody,ReadNSBody,ReadBodyIntf>\" { yyextra->current->program << yytext ;
4215 yyextra->pCopyQuotedGString = &yyextra->current->program;
4216 yyextra->lastStringContext=YY_START;
4217 yyextra->stopAtInvalidString=false;
4218 BEGIN( CopyGString );
4219 }
4220<ReadBody,ReadNSBody,ReadBodyIntf>{DCOMMC} { yyextra->doxygenComment=true; REJECT;}
4221<ReadBody,ReadNSBody,ReadBodyIntf>{CCS}{B}* { yyextra->current->program << yytext ;
4222 yyextra->lastContext = YY_START ;
4223 BEGIN( Comment ) ;
4224 }
4225<ReadBody,ReadNSBody,ReadBodyIntf>{CCS}{BL} { yyextra->current->program << yytext ;
4226 ++yyextra->yyLineNr ;
4227 yyextra->lastContext = YY_START ;
4228 BEGIN( Comment ) ;
4229 }
4230<ReadBody,ReadNSBody,ReadBodyIntf>"'" {
4231 if (!yyextra->insidePHP)
4232 {
4233 yyextra->current->program << yytext;
4234 }
4235 else
4236 { // begin of single quoted string
4237 yyextra->current->program << yytext;
4238 yyextra->pCopyQuotedGString = &yyextra->current->program;
4239 yyextra->lastStringContext=YY_START;
4240 BEGIN(CopyPHPGString);
4241 }
4242 }
4243<ReadBody,ReadNSBody,ReadBodyIntf>{CHARLIT} {
4244 if (yyextra->insidePHP)
4245 {
4246 REJECT; // for PHP code single quotes
4247 // are used for strings of arbitrary length
4248 }
4249 else
4250 {
4251 yyextra->current->program << yytext;
4252 }
4253 }
4254<ReadBody,ReadNSBody,ReadBodyIntf>"{" { yyextra->current->program << yytext ;
4255 ++yyextra->curlyCount ;
4256 }
4257<ReadBodyIntf>"}" {
4258 yyextra->current->program << yytext ;
4259 --yyextra->curlyCount ;
4260 }
4261<ReadBody,ReadNSBody>"}" {
4262 if ( yyextra->curlyCount>0 )
4263 {
4264 yyextra->current->program << yytext ;
4265 --yyextra->curlyCount ;
4266 }
4267 else
4268 {
4269 yyextra->current->endBodyLine = yyextra->yyLineNr;
4270 std::shared_ptr<Entry> original_root = yyextra->current_root; // save root this namespace is in
4271 if (yyextra->current->section.isNamespace() && yyextra->current->type == "namespace")
4272 {
4273 int split_point;
4274 // save documentation values
4275 QCString doc = yyextra->current->doc;
4276 int docLine = yyextra->current->docLine;
4277 QCString docFile = yyextra->current->docFile;
4278 QCString brief = yyextra->current->brief;
4279 int briefLine = yyextra->current->briefLine;
4280 QCString briefFile = yyextra->current->briefFile;
4281 // reset documentation values
4282 yyextra->current->doc = "";
4283 yyextra->current->docLine = 0;
4284 yyextra->current->docFile = "";
4285 yyextra->current->brief = "";
4286 yyextra->current->briefLine = 0;
4287 yyextra->current->briefFile = "";
4288 while ((split_point = yyextra->current->name.find("::")) != -1)
4289 {
4290 std::shared_ptr<Entry> new_current = std::make_shared<Entry>(*yyextra->current);
4291 yyextra->current->program.str(std::string());
4292 new_current->name = yyextra->current->name.mid(split_point + 2);
4293 yyextra->current->name = yyextra->current->name.left(split_point);
4294 if (!yyextra->current_root->name.isEmpty()) yyextra->current->name.prepend(yyextra->current_root->name+"::");
4295
4296 yyextra->current_root->moveToSubEntryAndKeep(yyextra->current);
4297 yyextra->current_root = yyextra->current;
4298 yyextra->current = new_current;
4299 }
4300 // restore documentation values
4301 yyextra->current->doc = doc;
4302 yyextra->current->docLine = docLine;
4303 yyextra->current->docFile = docFile;
4304 yyextra->current->brief = brief;
4305 yyextra->current->briefLine = briefLine;
4306 yyextra->current->briefFile = briefFile;
4307 }
4308 QCString &cn = yyextra->current->name;
4309 QCString rn = yyextra->current_root->name;
4310 //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",qPrint(cn),qPrint(rn),yyextra->isTypedef);
4311 if (!cn.isEmpty() && !rn.isEmpty())
4312 {
4313 prependScope(yyscanner);
4314 }
4315 if (yyextra->isTypedef && cn.isEmpty())
4316 {
4317 //printf("Typedef Name\n");
4318 BEGIN( TypedefName );
4319 }
4320 else
4321 {
4322 if (yyextra->current->section.isEnum() || yyextra->current->spec.isEnum())
4323 {
4324 yyextra->current->program << ','; // add field terminator
4325 }
4326 // add compound definition to the tree
4327 yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
4328 // was: yyextra->current->args.simplifyWhiteSpace();
4329 yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
4330 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
4331 //printf("adding '%s' '%s' '%s' brief=%s yyextra->insideObjC=%d %x\n",qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args),qPrint(yyextra->current->brief),yyextra->insideObjC,yyextra->current->section);
4332 if (yyextra->insideObjC &&
4333 (yyextra->current->spec.isInterface() || yyextra->current->spec.isCategory())
4334 ) // method definition follows
4335 {
4336 BEGIN( ReadBodyIntf ) ;
4337 }
4338 else
4339 {
4340 yyextra->memspecEntry = yyextra->current;
4341 yyextra->current_root->moveToSubEntryAndKeep( yyextra->current ) ;
4342 yyextra->current = std::make_shared<Entry>(*yyextra->current);
4343 if (yyextra->current->section.isNamespace() ||
4344 yyextra->current->spec.isInterface() ||
4345 yyextra->insideJava || yyextra->insidePHP || yyextra->insideCS || yyextra->insideD || yyextra->insideJS ||
4346 yyextra->insideSlice
4347 )
4348 { // namespaces and interfaces and java classes ends with a closing bracket without semicolon
4349 yyextra->current->reset();
4350 yyextra->current_root = std::move(original_root); // restore scope from before namespace descent
4351 initEntry(yyscanner);
4352 yyextra->memspecEntry.reset();
4353 BEGIN( FindMembers ) ;
4354 }
4355 else
4356 {
4357 static const reg::Ex re(R"(@\d+$)");
4358 if (!yyextra->isTypedef && yyextra->memspecEntry &&
4359 !reg::search(yyextra->memspecEntry->name.str(),re)) // not typedef or anonymous type (see bug691071)
4360 {
4361 // enabled the next two lines for bug 623424
4362 yyextra->current->doc.clear();
4363 yyextra->current->brief.clear();
4364 }
4365 BEGIN( MemberSpec ) ;
4366 }
4367 }
4368 }
4369 }
4370 }
Class representing a regular expression.
Definition regex.h:39
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition regex.cpp:748
4371<ReadBody>"}"{BN}+"typedef"{BN}+ {
4372 lineCount(yyscanner);
4373 if ( yyextra->curlyCount>0 )
4374 {
4375 yyextra->current->program << yytext ;
4376 --yyextra->curlyCount ;
4377 }
4378 else
4379 {
4380 yyextra->isTypedef = TRUE;
4381 yyextra->current->endBodyLine = yyextra->yyLineNr;
4382 QCString &cn = yyextra->current->name;
4383 QCString rn = yyextra->current_root->name;
4384 if (!cn.isEmpty() && !rn.isEmpty())
4385 {
4386 prependScope(yyscanner);
4387 }
4388 BEGIN( TypedefName );
4389 }
4390 }
4391<TypedefName>("const"|"volatile"){BN} { // late "const" or "volatile" keyword
4392 lineCount(yyscanner);
4393 yyextra->current->type.prepend(yytext);
4394 }
4395<TypedefName>{ID} {
4396 if (yyextra->current->section.isEnum() || yyextra->current->spec.isEnum())
4397 {
4398 yyextra->current->program << ","; // add field terminator
4399 }
4400 yyextra->current->name=yytext;
4401 prependScope(yyscanner);
4402 yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
4403 yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
4404 //printf("Adding compound %s %s %s\n",qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args));
4405 if (!yyextra->firstTypedefEntry)
4406 {
4407 yyextra->firstTypedefEntry = yyextra->current;
4408 }
4409 yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
4410 initEntry(yyscanner);
4411 yyextra->isTypedef=TRUE; // to undo reset by initEntry(yyscanner)
4412 BEGIN(MemberSpecSkip);
4413 }
4414<TypedefName>";" { /* typedef of anonymous type */
4415 yyextra->current->name = generateAnonymousAnchor(yyextra->fileName,yyextra->anonCount++);
4416 if (yyextra->current->section.isEnum() || yyextra->current->spec.isEnum())
4417 {
4418 yyextra->current->program << ','; // add field terminator
4419 }
4420 // add compound definition to the tree
4421 yyextra->current->args = yyextra->current->args.simplifyWhiteSpace();
4422 yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
4423 yyextra->memspecEntry = yyextra->current;
4424 yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
4425 initEntry(yyscanner);
4426 unput(';');
4427 BEGIN( MemberSpec ) ;
4428 }
QCString generateAnonymousAnchor(const QCString &fileName, int count)
Definition util.cpp:4058
4429<MemberSpec>([*&]*{BN}*)*{ID}{BN}*("["[^\]\n]*"]")* { // the [] part could be improved.
4430 lineCount(yyscanner);
4431 int i=0,l=(int)yyleng,j;
4432 while (i<l && (!isId(yytext[i]))) i++;
4433 yyextra->msName = QCString(yytext).right(l-i).stripWhiteSpace();
4434 j=yyextra->msName.find("[");
4435 if (j!=-1)
4436 {
4437 yyextra->msArgs=yyextra->msName.right(yyextra->msName.length()-j);
4438 yyextra->msName=yyextra->msName.left(j);
4439 }
4440 yyextra->msType=QCString(yytext).left(i);
4441
4442 // handle *pName in: typedef { ... } name, *pName;
4443 if (yyextra->firstTypedefEntry)
4444 {
4445 if (yyextra->firstTypedefEntry->spec.isStruct())
4446 {
4447 yyextra->msType.prepend("struct "+yyextra->firstTypedefEntry->name);
4448 }
4449 else if (yyextra->firstTypedefEntry->spec.isUnion())
4450 {
4451 yyextra->msType.prepend("union "+yyextra->firstTypedefEntry->name);
4452 }
4453 else if (yyextra->firstTypedefEntry->section.isEnum())
4454 {
4455 yyextra->msType.prepend("enum "+yyextra->firstTypedefEntry->name);
4456 }
4457 else
4458 {
4459 yyextra->msType.prepend(yyextra->firstTypedefEntry->name);
4460 }
4461 }
4462 }
QCString right(size_t len) const
Definition qcstring.h:219
bool isId(int c)
Definition util.h:208
4463<MemberSpec>"(" { // function with struct return type
4464 addType(yyscanner);
4465 yyextra->current->name = yyextra->msName;
4466 yyextra->current->spec = TypeSpecifier();
4467 unput('(');
4468 BEGIN(FindMembers);
4469 }
4470<MemberSpec>[,;] {
4471 if (yyextra->msName.isEmpty() && !yyextra->current->name.isEmpty())
4472 {
4473 // see if the compound does not have a name or is yyextra->inside another
4474 // anonymous compound. If so we insert a
4475 // special 'anonymous' variable.
4476 //Entry *p=yyextra->current_root;
4477 const Entry *p=yyextra->current.get();
4478 while (p)
4479 {
4480 // only look for class scopes, not namespace scopes
4481 if (p->section.isCompound() && !p->name.isEmpty())
4482 {
4483 //printf("Trying scope '%s'\n",qPrint(p->name));
4484 int i=p->name.findRev("::");
4485 int pi = (i==-1) ? 0 : i+2;
4486 if (p->name.at(pi)=='@')
4487 {
4488 // anonymous compound yyextra->inside -> insert dummy variable name
4489 //printf("Adding anonymous variable for scope %s\n",qPrint(p->name));
4490 yyextra->msName = generateAnonymousAnchor(yyextra->fileName,yyextra->anonCount++);
4491 break;
4492 }
4493 }
4494 //p=p->parent;
4495 if (p==yyextra->current.get()) p=yyextra->current_root.get(); else p=p->parent();
4496 }
4497 }
4498 //printf("yyextra->msName=%s yyextra->current->name=%s\n",qPrint(yyextra->msName),qPrint(yyextra->current->name));
4499 if (!yyextra->msName.isEmpty()
4500 /*&& yyextra->msName!=yyextra->current->name*/) // skip typedef T {} T;, removed due to bug608493
4501 {
4502 bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT);
4503 // case 1: typedef struct _S { ... } S_t;
4504 // -> omit typedef and use S_t as the struct name
4505 if (typedefHidesStruct &&
4506 yyextra->isTypedef &&
4507 ((yyextra->current->spec.isStruct() || yyextra->current->spec.isUnion()) || yyextra->current->section.isEnum()) &&
4508 yyextra->msType.stripWhiteSpace().isEmpty() &&
4509 yyextra->memspecEntry)
4510 {
4511 yyextra->memspecEntry->name=yyextra->msName;
4512 }
4513 else // case 2: create a typedef field
4514 {
4515 std::shared_ptr<Entry> varEntry=std::make_shared<Entry>();
4516 varEntry->lang = yyextra->language;
4517 varEntry->protection = yyextra->current->protection ;
4518 varEntry->mtype = yyextra->current->mtype;
4519 varEntry->virt = yyextra->current->virt;
4520 varEntry->isStatic = yyextra->current->isStatic;
4521 varEntry->section = EntryType::makeVariable();
4522 varEntry->name = yyextra->msName.stripWhiteSpace();
4523 varEntry->type = yyextra->current->type.simplifyWhiteSpace()+" ";
4524 varEntry->args = yyextra->msArgs;
4525 if (yyextra->isTypedef)
4526 {
4527 varEntry->type.prepend("typedef ");
4528 // //printf("yyextra->current->name = %s %s\n",qPrint(yyextra->current->name),qPrint(yyextra->msName));
4529 }
4530 if (typedefHidesStruct &&
4531 yyextra->isTypedef &&
4532 (yyextra->current->spec.isStruct() || yyextra->current->spec.isUnion()) &&
4533 yyextra->memspecEntry
4534 ) // case 1: use S_t as type for pS_t in "typedef struct _S {} S_t, *pS_t;"
4535 {
4536 varEntry->type+=yyextra->memspecEntry->name+yyextra->msType;
4537 }
4538 else // case 2: use _S as type for for pS_t
4539 {
4540 varEntry->type+=yyextra->current->name+yyextra->msType;
4541 }
4542 varEntry->fileName = yyextra->fileName;
4543 varEntry->startLine = yyextra->yyLineNr;
4544 varEntry->startColumn = yyextra->yyColNr;
4545 varEntry->doc = yyextra->current->doc;
4546 varEntry->brief = yyextra->current->brief;
4547 varEntry->mGrpId = yyextra->current->mGrpId;
4548 varEntry->initializer.str(yyextra->current->initializer.str());
4549 varEntry->groups = yyextra->current->groups;
4550 varEntry->sli = yyextra->current->sli;
4551
4552 //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n",
4553 // qPrint(varEntry->type),qPrint(varEntry->name),
4554 // qPrint(varEntry->args),qPrint(varEntry->brief),qPrint(varEntry->doc));
4555 yyextra->current_root->moveToSubEntryAndKeep(varEntry);
4556 }
4557 }
4558 if (*yytext==';') // end of a struct/class ...
4559 {
4560 if (!yyextra->isTypedef && yyextra->msName.isEmpty() && yyextra->memspecEntry && yyextra->current->section.isCompound())
4561 { // case where a class/struct has a doc block after it
4562 if (!yyextra->current->doc.isEmpty())
4563 {
4564 yyextra->memspecEntry->doc += yyextra->current->doc;
4565 }
4566 if (!yyextra->current->brief.isEmpty())
4567 {
4568 yyextra->memspecEntry->brief += yyextra->current->brief;
4569 }
4570 }
4571 yyextra->msType.clear();
4572 yyextra->msName.clear();
4573 yyextra->msArgs.clear();
4574 yyextra->isTypedef=FALSE;
4575 yyextra->firstTypedefEntry.reset();
4576 yyextra->memspecEntry.reset();
4577 yyextra->current->reset();
4578 initEntry(yyscanner);
4579 BEGIN( FindMembers );
4580 }
4581 else
4582 {
4583 yyextra->current->doc.clear();
4584 yyextra->current->brief.clear();
4585 }
4586
4587 }
Represents an unstructured piece of information, about an entity found in the sources.
Definition entry.h:116
Entry * parent() const
Definition entry.h:134
QCString name
member name
Definition entry.h:174
EntryType section
entry type (see Sections);
Definition entry.h:172
ENTRY_TYPES bool isCompound() const
Definition types.h:638
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:578
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:91
4588<MemberSpec>"=" {
4589 yyextra->lastInitializerContext=YY_START;
4590 yyextra->initBracketCount=0;
4591 yyextra->current->initializer.str(yytext);
4592 BEGIN(ReadInitializer);
4593 /* BEGIN(MemberSpecSkip); */
4594 }
4595 /*
4596<MemberSpecSkip>"{" {
4597 yyextra->curlyCount=0;
4598 yyextra->lastCurlyContext = MemberSpecSkip;
4599 yyextra->previous = yyextra->current;
4600 BEGIN(SkipCurly);
4601 }
4602 */
4603<MemberSpecSkip>"," { BEGIN(MemberSpec); }
4604<MemberSpecSkip>";" { unput(';'); BEGIN(MemberSpec); }
4605<ReadBody,ReadNSBody,ReadBodyIntf>{BN}{1,80} { yyextra->current->program << yytext ;
4606 lineCount(yyscanner) ;
4607 }
4608<ReadBodyIntf>"@end"/[^a-z_A-Z0-9] { // end of Objective C block
4609 yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
4610 initEntry(yyscanner);
4611 yyextra->language = yyextra->current->lang = SrcLangExt::Cpp; // see bug746361
4612 yyextra->insideObjC=FALSE;
4613 BEGIN( FindMembers );
4614 }
4615<ReadBody,ReadNSBody,ReadBodyIntf>\\. { yyextra->current->program << yytext ; }
4616<ReadBody,ReadNSBody,ReadBodyIntf>. { yyextra->current->program << yytext ; }
4617
4618<FindMembers>"("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A<int>::func_t)(args...) */
4619<FindMembers>("("({BN}*"::"*{BN}*{TSCOPE}{BN}*"::")*({BN}*[*&\^]{BN}*)+)+ { /* typedef void (A::*ptr_t)(args...) or int (*func(int))[], the ^ is for Obj-C blocks */
4620 if (yyextra->insidePHP) // reference parameter
4621 {
4622 REJECT
4623 }
4624 else
4625 {
4626 yyextra->current->bodyLine = yyextra->yyLineNr;
4627 yyextra->current->bodyColumn = yyextra->yyColNr;
4628 lineCount(yyscanner);
4629 addType(yyscanner);
4630 yyextra->funcPtrType=yytext;
4631 yyextra->roundCount=0;
4632 //yyextra->current->type += yytext;
4633 BEGIN( FuncPtr );
4634 }
4635 }
4636<FuncPtr>{SCOPENAME} {
4637 yyextra->current->name = yytext;
4638 if (nameIsOperator(yyextra->current->name))
4639 {
4640 BEGIN( FuncPtrOperator );
4641 }
4642 else
4643 {
4644 if (yyextra->current->name=="const" || yyextra->current->name=="volatile")
4645 {
4646 yyextra->funcPtrType += yyextra->current->name;
4647 }
4648 else
4649 {
4650 BEGIN( EndFuncPtr );
4651 }
4652 }
4653 }
4654<FuncPtr>. {
4655 //printf("error: FuncPtr '%c' unexpected at line %d of %s\n",*yytext,yyextra->yyLineNr,yyextra->fileName);
4656 }
4657<FuncPtrOperator>"("{BN}*")"{BNopt}/"(" {
4658 yyextra->current->name += yytext;
4659 yyextra->current->name = yyextra->current->name.simplifyWhiteSpace();
4660 lineCount(yyscanner);
4661 }
4662<FuncPtrOperator>\n {
4663 lineCount(yyscanner);
4664 yyextra->current->name += *yytext;
4665 }
4666<FuncPtrOperator>"(" {
4667 unput(*yytext);
4668 BEGIN( EndFuncPtr );
4669 }
4670<FuncPtrOperator>. {
4671 yyextra->current->name += *yytext;
4672 }
4673<EndFuncPtr>")"{BNopt}/";" { // a variable with extra braces
4674 lineCount(yyscanner);
4675 yyextra->current->type+=yyextra->funcPtrType.mid(1);
4676 BEGIN(FindMembers);
4677 }
4678<EndFuncPtr>")"{BNopt}/"(" { // a function pointer
4679 lineCount(yyscanner);
4680 if (yyextra->funcPtrType!="(") // not just redundant braces
4681 {
4682 yyextra->current->type+=yyextra->funcPtrType+")";
4683 }
4684 BEGIN(FindMembers);
4685 }
4686<EndFuncPtr>")"{BNopt}/"[" { // an array of variables
4687 lineCount(yyscanner);
4688 yyextra->current->type+=yyextra->funcPtrType;
4689 yyextra->current->args += ")";
4690 BEGIN(FindMembers);
4691 }
4692<EndFuncPtr>"(" { // a function returning a function or
4693 // a function returning a pointer to an array
4694 yyextra->current->args += *yytext ;
4695 //yyextra->roundCount=0;
4696 //BEGIN( FuncFunc );
4697 yyextra->current->bodyLine = yyextra->yyLineNr;
4698 yyextra->current->bodyColumn = yyextra->yyColNr;
4699 yyextra->currentArgumentContext = FuncFuncEnd;
4700 yyextra->fullArgString=yyextra->current->args;
4701 yyextra->copyArgString=&yyextra->current->args;
4702 BEGIN( ReadFuncArgType ) ;
4703 }
4704<EndFuncPtr>"["[^\n\]]*"]" {
4705 yyextra->funcPtrType+=yytext;
4706 }
4707<EndFuncPtr>")" {
4708 BEGIN(FindMembers);
4709 }
4710<FuncFunc>"(" {
4711 yyextra->current->args += *yytext ;
4712 ++yyextra->roundCount;
4713 }
4714<FuncFunc>")" {
4715 yyextra->current->args += *yytext ;
4716 if ( yyextra->roundCount )
4717 --yyextra->roundCount;
4718 else
4719 {
4720 BEGIN(FuncFuncEnd);
4721 }
4722 }
4723<FuncFuncEnd>")"{BN}*"(" {
4724 lineCount(yyscanner);
4725 yyextra->current->type+=yyextra->funcPtrType+")(";
4726 BEGIN(FuncFuncType);
4727 }
4728<FuncFuncEnd>")"{BNopt}/[;{] {
4729 lineCount(yyscanner);
4730 yyextra->current->type+=yyextra->funcPtrType.mid(1);
4731 BEGIN(SFunction);
4732 }
4733<FuncFuncEnd>")"{BNopt}/"[" { // function returning a pointer to an array
4734 lineCount(yyscanner);
4735 yyextra->current->type+=yyextra->funcPtrType;
4736 yyextra->current->args+=")";
4737 BEGIN(FuncFuncArray);
4738 }
4739<FuncFuncEnd>. {
4740 yyextra->current->args += *yytext;
4741 }
4742<FuncFuncType>"(" {
4743 yyextra->current->type += *yytext;
4744 yyextra->roundCount++;
4745 }
4746<FuncFuncType>")" {
4747 yyextra->current->type += *yytext;
4748 if (yyextra->roundCount)
4749 --yyextra->roundCount;
4750 else
4751 BEGIN(SFunction);
4752 }
4753<FuncFuncType>{BN}*","{BN}* { lineCount(yyscanner) ; yyextra->current->type += ", " ; }
4754<FuncFuncType>{BN}+ { lineCount(yyscanner) ; yyextra->current->type += ' ' ; }
4755<FuncFuncType>. {
4756 yyextra->current->type += *yytext;
4757 }
4758<FindMembers>"("/{BN}*{ID}{BN}*"*"{BN}*{ID}*")"{BN}*"(" { // for catching typedef void (__stdcall *f)() like definitions
4759 if (yyextra->current->type.startsWith("typedef") &&
4760 yyextra->current->bodyLine==-1)
4761 // the bodyLine check is to prevent this guard to be true more than once
4762 {
4763 yyextra->current->bodyLine = yyextra->yyLineNr;
4764 yyextra->current->bodyColumn = yyextra->yyColNr;
4765 BEGIN( GetCallType );
4766 }
4767 else if (!yyextra->current->name.isEmpty()) // normal function
4768 {
4769 yyextra->current->args = yytext;
4770 yyextra->current->bodyLine = yyextra->yyLineNr;
4771 yyextra->current->bodyColumn = yyextra->yyColNr;
4772 yyextra->currentArgumentContext = FuncQual;
4773 yyextra->fullArgString=yyextra->current->args;
4774 yyextra->copyArgString=&yyextra->current->args;
4775 BEGIN( ReadFuncArgType ) ;
4776 //printf(">>> Read function arguments!\n");
4777 }
4778 }
4779<GetCallType>{BN}*{ID}{BN}*"*" {
4780 lineCount(yyscanner);
4781 addType(yyscanner);
4782 yyextra->funcPtrType="(";
4783 yyextra->funcPtrType+=yytext;
4784 yyextra->roundCount=0;
4785 BEGIN( FuncPtr );
4786 }
4787<FindMembers>"(" {
4788 if (!yyextra->current->name.isEmpty())
4789 {
4790 yyextra->current->args = yytext;
4791 yyextra->current->bodyLine = yyextra->yyLineNr;
4792 yyextra->current->bodyColumn = yyextra->yyColNr;
4793 yyextra->currentArgumentContext = FuncQual;
4794 yyextra->fullArgString=yyextra->current->args;
4795 yyextra->copyArgString=&yyextra->current->args;
4796 BEGIN( ReadFuncArgType ) ;
4797 //printf(">>> Read function arguments yyextra->current->argList.size()=%d\n",yyextra->current->argList.size());
4798 }
4799 }
4800 /*
4801<FindMembers>"("{BN}*("void"{BN}*)?")" {
4802 lineCount(yyscanner);
4803 yyextra->current->args = "()";
4804 BEGIN( FuncQual );
4805 }
4806 */
4807
4808 /*- Function argument reading rules ---------------------------------------*/
4809
4810<ReadFuncArgType>[^ \/\r\t\n\[\]\‍)\‍(\"\'#]+ { *yyextra->copyArgString+=yytext;
4811 if (yyextra->insideCS) yyextra->fullArgString+=substitute(yytext,".","::");
4812 else yyextra->fullArgString+=yytext;
4813 }
4814<CopyArgString,CopyArgPHPString>[^\n\\\"\']+ { *yyextra->copyArgString+=yytext;
4815 yyextra->fullArgString+=yytext;
4816 }
4817<CopyArgRound>[^\/\n\‍)\‍(\"\']+ {
4818 *yyextra->copyArgString+=yytext;
4819 yyextra->fullArgString+=yytext;
4820 }
4821<CopyArgSquare>[^\/\n\]\[\"\']+ {
4822 *yyextra->copyArgString+=yytext;
4823 yyextra->fullArgString+=yytext;
4824 }
4825<ReadFuncArgType,ReadTempArgs>{BN}* {
4826 *yyextra->copyArgString+=" ";
4827 yyextra->fullArgString+=" ";
4828 lineCount(yyscanner);
4829 }
4830<ReadFuncArgType,CopyArgRound,CopyArgSquare,CopyArgSharp,ReadTempArgs>{RAWBEGIN} {
4831 yyextra->delimiter = extractBeginRawStringDelimiter(yytext);
4832 yyextra->lastRawStringContext = YY_START;
4833 yyextra->pCopyRawString = yyextra->copyArgString;
4834 *yyextra->pCopyRawString+=yytext;
4835 yyextra->fullArgString+=yytext;
4836 BEGIN(RawString);
4837 }
4838<ReadFuncArgType,CopyArgRound,CopyArgSquare,CopyArgSharp,ReadTempArgs>\" {
4839 *yyextra->copyArgString+=*yytext;
4840 yyextra->fullArgString+=*yytext;
4841 yyextra->lastCopyArgStringContext = YY_START;
4842 BEGIN( CopyArgString );
4843 }
4844<ReadFuncArgType>"[" {
4845 if (!yyextra->insidePHP) REJECT;
4846 *yyextra->copyArgString+=*yytext;
4847 yyextra->fullArgString+=*yytext;
4848 yyextra->argSquareCount=0;
4849 yyextra->lastCopyArgContext = YY_START;
4850 BEGIN( CopyArgSquare );
4851 }
4852<ReadFuncArgType,ReadTempArgs>"(" {
4853 *yyextra->copyArgString+=*yytext;
4854 yyextra->fullArgString+=*yytext;
4855 yyextra->argRoundCount=0;
4856 yyextra->lastCopyArgContext = YY_START;
4857 BEGIN( CopyArgRound );
4858 }
4859<ReadFuncArgType>")" {
4860 *yyextra->copyArgString+=*yytext;
4861 yyextra->fullArgString+=*yytext;
4862 yyextra->current->argList = *stringToArgumentList(yyextra->language, yyextra->fullArgString);
4863 if (yyextra->insideJS)
4864 {
4865 fixArgumentListForJavaScript(yyextra->current->argList);
4866 }
4867 handleParametersCommentBlocks(yyscanner,yyextra->current->argList);
4868
4869 /* remember the yyextra->current documentation block, since
4870 we could overwrite it with the documentation of
4871 a function argument, which we then have to correct later
4872 on
4873 */
4874 yyextra->docBackup = yyextra->current->doc;
4875 yyextra->briefBackup = yyextra->current->brief;
4876
4877 BEGIN( yyextra->currentArgumentContext );
4878 }
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const QCString &argsString, QCString *extraTypeChars=nullptr)
Definition defargs.l:814
4879 /* a special comment */
4880<ReadFuncArgType,ReadTempArgs>({CCS}[*!]|{CPPC}[/!])("<"?) {
4881 if (yyextra->currentArgumentContext==DefineEnd)
4882 {
4883 // for defines we interpret a comment
4884 // as documentation for the define
4885 int i;for (i=(int)yyleng-1;i>=0;i--)
4886 {
4887 unput(yytext[i]);
4888 }
4889 yyextra->current->argList = *stringToArgumentList(yyextra->language, yyextra->fullArgString);
4890 handleParametersCommentBlocks(yyscanner,yyextra->current->argList);
4891 BEGIN( yyextra->currentArgumentContext );
4892 }
4893 else // not a define
4894 {
4895 // for functions we interpret a comment
4896 // as documentation for the argument
4897 yyextra->fullArgString+=yytext;
4898 yyextra->lastCopyArgChar=0;
4899 yyextra->lastCommentInArgContext=YY_START;
4900 if (yytext[1]=='/')
4901 BEGIN( CopyArgCommentLine );
4902 else
4903 BEGIN( CopyArgComment );
4904 }
4905 }
4906 /* a non-special comment */
4907<ReadFuncArgType,ReadTempArgs>{CCS}{CCE} { /* empty comment */ }
4908<ReadFuncArgType,ReadTempArgs>{CCS} {
4909 yyextra->lastCContext = YY_START;
4910 BEGIN( SkipComment );
4911 }
4912<ReadFuncArgType,ReadTempArgs>{CPPC} {
4913 yyextra->lastCContext = YY_START;
4914 BEGIN( SkipCxxComment );
4915 }
4916 /*
4917<ReadFuncArgType,ReadTempArgs>"'#" { if (yyextra->insidePHP)
4918 REJECT;
4919 *yyextra->copyArgString+=yytext;
4920 yyextra->fullArgString+=yytext;
4921 }
4922<ReadFuncArgType,ReadTempArgs>"#" {
4923 if (!yyextra->insidePHP)
4924 REJECT;
4925 yyextra->lastCContext = YY_START;
4926 BEGIN( SkipCxxComment );
4927 }
4928 */
4929 /* ')' followed by a special comment */
4930<ReadFuncArgType>")"{BN}*({CCS}[*!]|{CPPC}[/!])"<" {
4931 lineCount(yyscanner);
4932 if (yyextra->currentArgumentContext==DefineEnd)
4933 {
4934 // for defines we interpret a comment
4935 // as documentation for the define
4936 int i;for (i=(int)yyleng-1;i>0;i--)
4937 {
4938 unput(yytext[i]);
4939 }
4940 *yyextra->copyArgString+=*yytext;
4941 yyextra->fullArgString+=*yytext;
4942 yyextra->current->argList = *stringToArgumentList(yyextra->language, yyextra->fullArgString);
4943 handleParametersCommentBlocks(yyscanner,yyextra->current->argList);
4944 BEGIN( yyextra->currentArgumentContext );
4945 }
4946 else
4947 {
4948 // for functions we interpret a comment
4949 // as documentation for the yyextra->last argument
4950 yyextra->lastCopyArgChar=*yytext;
4951 QCString text=&yytext[1];
4952 text=text.stripWhiteSpace();
4953 yyextra->lastCommentInArgContext=YY_START;
4954 yyextra->fullArgString+=text;
4955 if (text.find("//")!=-1)
4956 BEGIN( CopyArgCommentLine );
4957 else
4958 BEGIN( CopyArgComment );
4959 }
4960 }
4961<CopyArgComment>^{B}*"*"+/{BN}+
4962<CopyArgComment>[^\n\\\@\*]+ { yyextra->fullArgString+=yytext; }
4963<CopyArgComment>{CCE} { yyextra->fullArgString+=yytext;
4964 if (yyextra->lastCopyArgChar!=0)
4965 unput(yyextra->lastCopyArgChar);
4966 BEGIN( yyextra->lastCommentInArgContext );
4967 }
4968<CopyArgCommentLine>\n { yyextra->fullArgString+=yytext;
4969 lineCount(yyscanner);
4970 if (yyextra->lastCopyArgChar!=0)
4971 unput(yyextra->lastCopyArgChar);
4972 BEGIN( yyextra->lastCommentInArgContext );
4973 }
4974<CopyArgCommentLine>{CMD}"startuml"/[^a-z_A-Z0-9\-] { // verbatim type command (which could contain nested comments!)
4975 yyextra->docBlockName="uml";
4976 yyextra->fullArgString+=yytext;
4977 BEGIN(CopyArgVerbatim);
4978 }
4979<CopyArgCommentLine>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
4980 yyextra->docBlockName=&yytext[1];
4981 yyextra->fullArgString+=yytext;
4982 BEGIN(CopyArgVerbatim);
4983 }
4984<CopyArgCommentLine>{CMD}("f$"|"f["|"f{"|"f(") {
4985 yyextra->docBlockName=&yytext[1];
4986 if (yyextra->docBlockName.at(1)=='[')
4987 {
4988 yyextra->docBlockName.at(1)=']';
4989 }
4990 if (yyextra->docBlockName.at(1)=='{')
4991 {
4992 yyextra->docBlockName.at(1)='}';
4993 }
4994 if (yyextra->docBlockName.at(1)=='(')
4995 {
4996 yyextra->docBlockName.at(1)=')';
4997 }
4998 yyextra->fullArgString+=yytext;
4999 BEGIN(CopyArgVerbatim);
5000 }
5001<CopyArgVerbatim>[\\@]("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9\-] { // end of verbatim block
5002 yyextra->fullArgString+=yytext;
5003 if (&yytext[4]==yyextra->docBlockName)
5004 {
5005 yyextra->docBlockName="";
5006 BEGIN(CopyArgCommentLine);
5007 }
5008 }
5009<CopyArgVerbatim>[\\@]("f$"|"f]"|"f}"|"f)") { // end of verbatim block
5010 yyextra->fullArgString+=yytext;
5011 if (yyextra->docBlockName==&yytext[1])
5012 {
5013 yyextra->docBlockName="";
5014 BEGIN(CopyArgCommentLine);
5015 }
5016 }
5017<CopyArgCommentLine>[^\\\@\n]+ { yyextra->fullArgString+=yytext; }
5018<CopyArgCommentLine>. { yyextra->fullArgString+=*yytext; }
5019<CopyArgComment,CopyArgVerbatim>\n { yyextra->fullArgString+=*yytext; lineCount(yyscanner); }
5020<CopyArgComment,CopyArgVerbatim>. { yyextra->fullArgString+=*yytext; }
5021<CopyArgComment>{CMD}("brief"|"short"){B}+ {
5022 warn(yyextra->fileName,yyextra->yyLineNr,
5023 "Ignoring {:c}brief command inside argument documentation",*yytext
5024 );
5025 yyextra->fullArgString+=' ';
5026 }
#define warn(file, line, fmt,...)
Definition message.h:97
5027<ReadTempArgs>"<" {
5028 *yyextra->copyArgString+=*yytext;
5029 yyextra->fullArgString+=*yytext;
5030 yyextra->argSharpCount=1;
5031 BEGIN( CopyArgSharp );
5032 }
5033<ReadTempArgs>">" {
5034 *yyextra->copyArgString+=*yytext;
5035 yyextra->fullArgString+=*yytext;
5036 //printf("end template list '%s'\n",qPrint(*yyextra->copyArgString));
5037 *yyextra->currentArgumentList = *stringToArgumentList(yyextra->language, yyextra->fullArgString);
5038 handleParametersCommentBlocks(yyscanner,yyextra->current->tArgLists.back());
5039 BEGIN( yyextra->currentArgumentContext );
5040 }
5041<CopyArgRound>"(" {
5042 yyextra->argRoundCount++;
5043 *yyextra->copyArgString+=*yytext;
5044 yyextra->fullArgString+=*yytext;
5045 }
5046<CopyArgRound>")" {
5047 *yyextra->copyArgString+=*yytext;
5048 yyextra->fullArgString+=*yytext;
5049 if (yyextra->argRoundCount>0)
5050 yyextra->argRoundCount--;
5051 else
5052 BEGIN( yyextra->lastCopyArgContext );
5053 }
5054<CopyArgSquare>"[" {
5055 yyextra->argSquareCount++;
5056 *yyextra->copyArgString+=*yytext;
5057 yyextra->fullArgString+=*yytext;
5058 }
5059<CopyArgSquare>"]" {
5060 *yyextra->copyArgString+=*yytext;
5061 yyextra->fullArgString+=*yytext;
5062 if (yyextra->argSquareCount>0)
5063 yyextra->argSquareCount--;
5064 else
5065 BEGIN( yyextra->lastCopyArgContext );
5066 }
5067<CopyArgSharp>"(" {
5068 *yyextra->copyArgString+=*yytext;
5069 yyextra->fullArgString+=*yytext;
5070 yyextra->argRoundCount=0;
5071 yyextra->lastCopyArgContext = YY_START;
5072 BEGIN( CopyArgRound );
5073 }
5074<CopyArgSharp>"<" {
5075 yyextra->argSharpCount++;
5076 //printf("yyextra->argSharpCount++=%d copy\n",yyextra->argSharpCount);
5077 *yyextra->copyArgString+=*yytext;
5078 yyextra->fullArgString+=*yytext;
5079 }
5080<CopyArgSharp>">" {
5081 *yyextra->copyArgString+=*yytext;
5082 yyextra->fullArgString+=*yytext;
5083 yyextra->argSharpCount--;
5084 if (yyextra->argSharpCount>0)
5085 {
5086 //printf("yyextra->argSharpCount--=%d copy\n",yyextra->argSharpCount);
5087 }
5088 else
5089 {
5090 BEGIN( ReadTempArgs );
5091 //printf("end of yyextra->argSharpCount\n");
5092 }
5093 }
5094<CopyArgString,CopyArgPHPString>\\. {
5095 *yyextra->copyArgString+=yytext;
5096 yyextra->fullArgString+=yytext;
5097 }
5098<CopyArgString>\" {
5099 *yyextra->copyArgString+=*yytext;
5100 yyextra->fullArgString+=*yytext;
5101 BEGIN( yyextra->lastCopyArgStringContext );
5102 }
5103<CopyArgPHPString>\' {
5104 *yyextra->copyArgString+=*yytext;
5105 yyextra->fullArgString+=*yytext;
5106 BEGIN( yyextra->lastCopyArgStringContext );
5107 }
5108<ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSquare,CopyArgSharp>{CHARLIT} {
5109 if (yyextra->insidePHP)
5110 {
5111 REJECT;
5112 }
5113 else
5114 {
5115 *yyextra->copyArgString+=yytext;
5116 yyextra->fullArgString+=yytext;
5117 }
5118 }
5119<ReadFuncArgType,ReadTempArgs,CopyArgRound,CopyArgSquare,CopyArgSharp>\' {
5120 *yyextra->copyArgString+=yytext;
5121 yyextra->fullArgString+=yytext;
5122 if (yyextra->insidePHP)
5123 {
5124 yyextra->lastCopyArgStringContext=YY_START;
5125 BEGIN(CopyArgPHPString);
5126 }
5127 }
5128<ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSquare,CopyArgSharp>"<="|">="|"<=>" {
5129 *yyextra->copyArgString+=yytext;
5130 yyextra->fullArgString+=yytext;
5131 }
5132<ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSquare,CopyArgSharp>\n {
5133 lineCount(yyscanner);
5134 *yyextra->copyArgString+=*yytext;
5135 yyextra->fullArgString+=*yytext;
5136 }
5137<ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSquare,CopyArgSharp>{ID} {
5138 *yyextra->copyArgString+=yytext;
5139 yyextra->fullArgString+=yytext;
5140 }
5141<ReadFuncArgType,ReadTempArgs,CopyArgString,CopyArgPHPString,CopyArgRound,CopyArgSquare,CopyArgSharp>. {
5142 *yyextra->copyArgString+=*yytext;
5143 yyextra->fullArgString+=*yytext;
5144 }
5145
5146
5147
5148 /*------------------------------------------------------------------------*/
5149
5150
5151<FuncRound>"(" { yyextra->current->args += *yytext ;
5152 ++yyextra->roundCount ;
5153 }
5154<FuncRound>")" { yyextra->current->args += *yytext ;
5155 if ( yyextra->roundCount )
5156 --yyextra->roundCount ;
5157 else
5158 BEGIN( FuncQual ) ;
5159 }
5160 /*
5161<FuncQual>"#" { if (yyextra->insidePHP)
5162 REJECT;
5163 yyextra->lastCPPContext = YY_START;
5164 BEGIN(SkipCPP);
5165 }
5166 */
5167<FuncQual>[{:;,] {
5168 if ( qstrcmp(yytext,";")==0 &&
5169 ((yyextra->insideJS || yyextra->insidePHP) &&
5170 !containsWord(yyextra->current->type,"function")) )
5171 {
5172 yyextra->current->reset();
5173 initEntry(yyscanner);
5174 BEGIN( FindMembers );
5175 }
5176 else
5177 {
5178 unput(*yytext); BEGIN( SFunction );
5179 }
5180 }
bool containsWord(const QCString &str, const char *word)
returns TRUE iff string s contains word w
Definition util.cpp:5465
5181<FuncQual>{BN}*"abstract"{BN}* { // pure virtual member function
5182 lineCount(yyscanner) ;
5183 yyextra->current->virt = Specifier::Pure;
5184 yyextra->current->args += " override ";
5185 }
5186<FuncQual,TrailingReturn>{BN}*"override"{BN}* { // C++11 overridden virtual member function
5187 lineCount(yyscanner) ;
5188 yyextra->current->spec.setOverride(true);
5189 yyextra->current->args += " override ";
5190 BEGIN(FuncQual);
5191 }
5192<FuncQual,TrailingReturn>{BN}*"final"{BN}* { // C++11 final method
5193 lineCount(yyscanner) ;
5194 yyextra->current->spec.setFinal(true);
5195 yyextra->current->args += " final ";
5196 BEGIN(FuncQual);
5197 }
5198<FuncQual>{BN}*"sealed"{BN}* { // sealed member function
5199 lineCount(yyscanner) ;
5200 yyextra->current->spec.setSealed(true);
5201 yyextra->current->args += " sealed ";
5202 }
5203<FuncQual>{BN}*"new"{BN}* { // new member function
5204 lineCount(yyscanner) ;
5205 yyextra->current->spec.setNew(true);
5206 yyextra->current->args += " new ";
5207 }
5208<FuncQual>{BN}*"const"{BN}* { // const member function
5209 lineCount(yyscanner) ;
5210 yyextra->current->args += " const ";
5211 yyextra->current->argList.setConstSpecifier(TRUE);
5212 }
5213<FuncQual>{BN}*"volatile"{BN}* { // volatile member function
5214 lineCount(yyscanner) ;
5215 yyextra->current->args += " volatile ";
5216 yyextra->current->argList.setVolatileSpecifier(TRUE);
5217 }
5218<FuncQual>{BN}*"noexcept"{BN}* { // noexcept qualifier
5219 lineCount(yyscanner) ;
5220 yyextra->current->args += " noexcept ";
5221 yyextra->current->spec.setNoExcept(true);
5222 }
5223<FuncQual>{BN}*"noexcept"{BN}*"("{B}*false{B}*")"{BN}* { // noexcept(false) expression
5224 lineCount(yyscanner) ;
5225 yyextra->current->args += " noexcept(false)";
5226 }
5227<FuncQual>{BN}*"noexcept"{BN}*"(" { // noexcept expression
5228 lineCount(yyscanner) ;
5229 yyextra->current->args += " noexcept(";
5230 yyextra->current->spec.setNoExcept(true);
5231 yyextra->lastRoundContext=FuncQual;
5232 yyextra->pCopyRoundString=&yyextra->current->args;
5233 yyextra->roundCount=0;
5234 BEGIN(CopyRound);
5235 }
5236<FuncQual>{BN}*"&" {
5237 yyextra->current->args += " &";
5238 yyextra->current->argList.setRefQualifier(RefQualifierType::LValue);
5239 }
5240<FuncQual>{BN}*"&&" {
5241 yyextra->current->args += " &&";
5242 yyextra->current->argList.setRefQualifier(RefQualifierType::RValue);
5243 }
5244
5245<FuncQual,TrailingReturn>{BN}*"="{BN}*"0"{BN}* { // pure virtual member function
5246 lineCount(yyscanner) ;
5247 yyextra->current->args += " = 0";
5248 yyextra->current->virt = Specifier::Pure;
5249 yyextra->current->argList.setPureSpecifier(TRUE);
5250 BEGIN(FuncQual);
5251 }
5252<FuncQual,TrailingReturn>{BN}*"="{BN}*"delete"{BN}* { // C++11 explicitly delete member
5253 lineCount(yyscanner);
5254 yyextra->current->args += " = delete";
5255 yyextra->current->spec.setDelete(true);
5256 yyextra->current->argList.setIsDeleted(TRUE);
5257 BEGIN(FuncQual);
5258 }
5259<FuncQual,TrailingReturn>{BN}*"="{BN}*"default"{BN}* { // C++11 explicitly defaulted constructor/assignment operator
5260 lineCount(yyscanner);
5261 yyextra->current->args += " = default";
5262 yyextra->current->spec.setDefault(true);
5263 BEGIN(FuncQual);
5264 }
5265<FuncQual>{BN}*"->"{BN}* {
5266 lineCount(yyscanner);
5267 yyextra->current->argList.setTrailingReturnType(" -> ");
5268 yyextra->current->args += " -> ";
5269 yyextra->roundCount=0;
5270 BEGIN(TrailingReturn);
5271 }
5272<TrailingReturn>[{;] {
5273 if (yyextra->roundCount>0) REJECT;
5274 unput(*yytext);
5275 BEGIN(FuncQual);
5276 }
5277<TrailingReturn>"requires"{BN}+ {
5278 if (yyextra->insideJava) REJECT;
5279 yyextra->requiresContext = FuncQual;
5280 yyextra->current->req+=' ';
5281 BEGIN(RequiresClause);
5282 }
5283<TrailingReturn>"(" {
5284 yyextra->roundCount++;
5285 yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext);
5286 yyextra->current->args+=yytext;
5287 }
5288<TrailingReturn>")" {
5289 if (yyextra->roundCount>0)
5290 {
5291 yyextra->roundCount--;
5292 }
5293 else
5294 {
5295 warn(yyextra->fileName,yyextra->yyLineNr,
5296 "Found ')' without opening '(' for trailing return type '{})...'",
5297 yyextra->current->argList.trailingReturnType());
5298 }
5299 yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext);
5300 yyextra->current->args+=yytext;
5301 }
5302<TrailingReturn>. {
5303 yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext);
5304 yyextra->current->args+=yytext;
5305 }
5306<TrailingReturn>\n {
5307 lineCount(yyscanner);
5308 yyextra->current->argList.setTrailingReturnType(yyextra->current->argList.trailingReturnType()+yytext);
5309 yyextra->current->args+=' ';
5310 }
5311<FuncRound,FuncFunc>{BN}*","{BN}* {
5312 lineCount(yyscanner) ;
5313 yyextra->current->args += ", " ;
5314 }
5315<FuncQual,FuncRound,FuncFunc>{BN}+ {
5316 lineCount(yyscanner) ;
5317 yyextra->current->args += ' ' ;
5318 }
5319<SFunction,FuncQual,FuncRound,FuncFunc>"#" { if (yyextra->insidePHP)
5320 REJECT;
5321 yyextra->lastCPPContext = YY_START;
5322 BEGIN(SkipCPP);
5323 }
5324<FuncQual>"=" {
5325 if (yyextra->insideCli && yyextra->current_root->section.isCompound())
5326 {
5327 BEGIN(CliOverride);
5328 }
5329 else
5330 {
5331 // typically an initialized function pointer
5332 yyextra->lastInitializerContext=YY_START;
5333 yyextra->initBracketCount=0;
5334 yyextra->current->initializer.str(yytext);
5335 BEGIN(ReadInitializer);
5336 }
5337 }
5338<CliOverride>{ID} {
5339 }
5340<CliOverride>"{" {
5341 unput(*yytext);
5342 BEGIN(FuncQual);
5343 }
5344<CliOverride>\n {
5345 lineCount(yyscanner);
5346 }
5347<CliOverride>. {
5348 }
5349<FuncQual>{ID} {
5350 if (yyextra->insideCpp && qstrcmp(yytext,"requires")==0)
5351 {
5352 // c++20 trailing requires clause
5353 yyextra->requiresContext = YY_START;
5354 yyextra->current->req+=' ';
5355 BEGIN(RequiresClause);
5356 }
5357 else if (yyextra->insideCS && qstrcmp(yytext,"where")==0)
5358 {
5359 // type constraint for a method
5360 yyextra->current->typeConstr.clear();
5361 yyextra->current->typeConstr.push_back(Argument());
5362 yyextra->lastCSConstraint = YY_START;
5363 BEGIN( CSConstraintName );
5364 }
5365 else if (checkForKnRstyleC(yyscanner)) // K&R style C function
5366 {
5367 yyextra->current->args = yytext;
5368 yyextra->oldStyleArgType.clear();
5369 BEGIN(OldStyleArgs);
5370 }
5371 else
5372 {
5373 yyextra->current->args += yytext;
5374 }
5375 }
5376<OldStyleArgs>[,;] {
5377 QCString oldStyleArgPtr;
5378 QCString oldStyleArgName;
5379 splitKnRArg(yyscanner,oldStyleArgPtr,oldStyleArgName);
5380 QCString doc,brief;
5381 if (yyextra->current->doc!=yyextra->docBackup)
5382 {
5383 doc=yyextra->current->doc;
5384 yyextra->current->doc=yyextra->docBackup;
5385 }
5386 if (yyextra->current->brief!=yyextra->briefBackup)
5387 {
5388 brief=yyextra->current->brief;
5389 yyextra->current->brief=yyextra->briefBackup;
5390 }
5391 addKnRArgInfo(yyscanner,yyextra->oldStyleArgType+oldStyleArgPtr,
5392 oldStyleArgName,brief,doc);
5393 yyextra->current->args.clear();
5394 if (*yytext==';') yyextra->oldStyleArgType.clear();
5395 }
5396<OldStyleArgs>{ID} { yyextra->current->args += yytext; }
5397<OldStyleArgs>"{" {
5398 if (yyextra->current->argList.empty())
5399 {
5400 yyextra->current->argList.setNoParameters(TRUE);
5401 }
5402 yyextra->current->args = argListToString(yyextra->current->argList);
5403 unput('{');
5404 BEGIN(FuncQual);
5405 }
5406<OldStyleArgs>. { yyextra->current->args += *yytext; }
5407<FuncQual,FuncRound,FuncFunc>\" {
5408 if (yyextra->insideIDL && yyextra->insideCppQuote)
5409 {
5410 BEGIN(EndCppQuote);
5411 }
5412 else
5413 {
5414 yyextra->current->args += *yytext;
5415 }
5416 }
5417<FuncQual,FuncRound,FuncFunc>. { yyextra->current->args += *yytext; }
5418<FuncQual>{BN}*"try:" |
5419<FuncQual>{BN}*"try"{BN}+ { /* try-function-block */
5420 yyextra->insideTryBlock=TRUE;
5421 lineCount(yyscanner);
5422 if (yytext[yyleng-1]==':')
5423 {
5424 unput(':');
5425 BEGIN( SFunction );
5426 }
5427 }
5428<FuncQual>{BN}*"throw"{BN}*"(" { // C++ style throw clause
5429 yyextra->current->exception = " throw (" ;
5430 yyextra->roundCount=0;
5431 lineCount(yyscanner) ;
5432 BEGIN( ExcpRound ) ;
5433 }
5434<FuncQual>{BN}*"raises"{BN}*"(" {
5435 yyextra->current->exception = " raises (" ;
5436 lineCount(yyscanner) ;
5437 yyextra->roundCount=0;
5438 BEGIN( ExcpRound ) ;
5439 }
5440<FuncQual>{BN}*"throws"{BN}+ { // Java style throw clause
5441 yyextra->current->exception = " throws " ;
5442 lineCount(yyscanner) ;
5443 BEGIN( ExcpList );
5444 }
5445<ExcpRound>"(" { yyextra->current->exception += *yytext ;
5446 ++yyextra->roundCount ;
5447 }
5448<ExcpRound>")" { yyextra->current->exception += *yytext ;
5449 if ( yyextra->roundCount )
5450 --yyextra->roundCount ;
5451 else
5452 BEGIN( FuncQual ) ;
5453 }
5454<ExcpRound>. {
5455 yyextra->current->exception += *yytext;
5456 }
5457<ExcpList>"{" {
5458 unput('{'); BEGIN( FuncQual );
5459 }
5460<ExcpList>";" {
5461 unput(';'); BEGIN( FuncQual );
5462 }
5463<ExcpList>"\n" {
5464 yyextra->current->exception += ' ';
5465 lineCount(yyscanner);
5466 }
5467<ExcpList>. {
5468 yyextra->current->exception += *yytext;
5469 }
5470<SFunction>"(" { yyextra->current->type += yyextra->current->name ;
5471 yyextra->current->name = yyextra->current->args ;
5472 yyextra->current->args = yytext ;
5473 yyextra->roundCount=0;
5474 BEGIN( FuncRound ) ;
5475 }
5476<SFunction>":" {
5477 if (!yyextra->insidePHP) BEGIN(SkipInits);
5478 }
5479<SFunction>[;{,] {
5480 yyextra->current->name=removeRedundantWhiteSpace(yyextra->current->name);
5481 yyextra->current->type=removeRedundantWhiteSpace(yyextra->current->type);
5482 yyextra->current->args=removeRedundantWhiteSpace(yyextra->current->args);
5483 yyextra->current->fileName = yyextra->fileName;
5484 yyextra->current->startLine = yyextra->yyBegLineNr;
5485 yyextra->current->startColumn = yyextra->yyBegColNr;
5486 static const reg::Ex re(R"(\‍([^)]*[*&][^)]*\))"); // e.g. (...*...)
5488 std::string type = yyextra->current->type.str();
5489 int ti=-1;
5490 if (reg::search(type,match,re))
5491 {
5492 ti = (int)match.position();
5493 }
5494 if (ti!=-1)
5495 {
5496 int di = yyextra->current->type.find("decltype(");
5497 if (di!=-1 && di<ti) // decltype(...(...*...) -> normal return type
5498 {
5499 ti=-1;
5500 }
5501 }
5502 int ts=yyextra->current->type.find('<');
5503 int te=yyextra->current->type.findRev('>');
5504
5505 // bug677315: A<int(void *, char *)> get(); is not a function pointer
5506 bool startsWithTypedef = yyextra->current->type.startsWith("typedef ");
5507 bool isFunction = ti==-1 || // not a (...*...) pattern
5508 (ts!=-1 && ts<te && ts<ti && ti<te); // (...*...) is part of a template argument list
5509 bool isVariable = !yyextra->current->type.isEmpty() &&
5510 (!isFunction || startsWithTypedef);
5511
5512 //printf("type=%s ts=%d te=%d ti=%d isFunction=%d\n",
5513 // qPrint(yyextra->current->type),ts,te,ti,isFunction);
5514
5515 if (*yytext!=';' || yyextra->current_root->section.isCompound())
5516 {
5517 if (isVariable)
5518 {
5519 //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args));
5520 if (yyextra->isTypedef && !startsWithTypedef)
5521 {
5522 yyextra->current->type.prepend("typedef ");
5523 }
5524 yyextra->current->section = EntryType::makeVariable() ;
5525 }
5526 else
5527 {
5528 //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args));
5529 yyextra->current->section = EntryType::makeFunction() ;
5530 yyextra->current->proto = *yytext==';';
5531 }
5532 }
5533 else // a global function prototype or function variable
5534 {
5535 //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",qPrint(yyextra->current->type),qPrint(yyextra->current->name),qPrint(yyextra->current->args));
5536 if (isVariable)
5537 {
5538 if (yyextra->isTypedef && !startsWithTypedef)
5539 {
5540 yyextra->current->type.prepend("typedef ");
5541 }
5542 //printf("Scanner.l: found function variable!\n");
5543 yyextra->current->section = EntryType::makeVariable();
5544 }
5545 else
5546 {
5547 //printf("Scanner.l: found prototype\n");
5548 yyextra->current->section = EntryType::makeFunction();
5549 yyextra->current->proto = TRUE;
5550 }
5551 }
5552 //printf("Adding entry '%s'\n",qPrint(yyextra->current->name));
5553 if ( yyextra->insidePHP)
5554 {
5555 if (findAndRemoveWord(yyextra->current->type,"final"))
5556 {
5557 yyextra->current->spec.setFinal(true);
5558 }
5559 if (findAndRemoveWord(yyextra->current->type,"abstract"))
5560 {
5561 yyextra->current->spec.setAbstract(true);
5562 }
5563 }
5564 if ( yyextra->insidePHP && !containsWord(yyextra->current->type,"function"))
5565 {
5566 initEntry(yyscanner);
5567 if ( *yytext == '{' )
5568 {
5569 yyextra->lastCurlyContext = FindMembers;
5570 yyextra->curlyCount=0;
5571 BEGIN( SkipCurly );
5572 }
5573 else
5574 {
5575 BEGIN( FindMembers );
5576 }
5577 }
5578 else
5579 {
5580 if ( yyextra->insidePHP)
5581 {
5582 findAndRemoveWord(yyextra->current->type,"function");
5583 }
5584 yyextra->previous = yyextra->current;
5585 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
5586 initEntry(yyscanner);
5587 // Objective C 2.0: Required/Optional section
5588 if (yyextra->previous->spec.isOptional() || yyextra->previous->spec.isRequired())
5589 {
5590 yyextra->current->spec.setOptional(true).setRequired(true);
5591 }
5592 yyextra->lastCurlyContext = FindMembers;
5593 if ( *yytext == ',' )
5594 {
5595 yyextra->current->type = stripFuncPtr(yyextra->previous->type);
5596 }
5597 if ( *yytext == '{' )
5598 {
5599 if ( !yyextra->insidePHP && yyextra->current_root->section.isCompound() )
5600 {
5601 yyextra->previous->spec.setInline(true);
5602 }
5603 //addToBody(yytext);
5604 yyextra->curlyCount=0;
5605 BEGIN( SkipCurly ) ;
5606 }
5607 else
5608 {
5609 if (!yyextra->previous->section.isVariable())
5610 yyextra->previous->bodyLine=-1; // a function/member declaration
5611 BEGIN( FindMembers ) ;
5612 }
5613 }
5614 }
Object representing the matching results.
Definition regex.h:153
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:759
bool findAndRemoveWord(QCString &sentence, const char *word)
removes occurrences of whole word from sentence, while keeps internal spaces and reducing multiple se...
Definition util.cpp:5481
5615<SkipInits>">"{BN}*"{" { // C++11 style initializer (see bug 790788)
5616 lineCount(yyscanner);
5617 yyextra->curlyCount=1;
5618 BEGIN(SkipC11Inits);
5619 }
5620<SkipInits>{ID}{BN}*"{" { // C++11 style initializer (see bug 688647)
5621 lineCount(yyscanner);
5622 yyextra->curlyCount=1;
5623 BEGIN(SkipC11Inits);
5624 }
5625<SkipC11Inits>"{" {
5626 ++yyextra->curlyCount;
5627 }
5628<SkipC11Inits>"}" {
5629 if ( --yyextra->curlyCount<=0 )
5630 {
5631 BEGIN(SkipInits);
5632 }
5633 }
5634<SkipC11Attribute>"]]" {
5635 BEGIN(yyextra->lastC11AttributeContext);
5636 }
5637<SkipInits>"{" { // C++11 style initializer
5638 unput('{');
5639 BEGIN( SFunction );
5640 }
5641<SkipCurly>"{" {
5642 //addToBody(yytext);
5643 ++yyextra->curlyCount ;
5644 }
5645<SkipCurly>"}"/{BN}*{DCOMM}"<!--" | /* see bug710917 */)
5646<SkipCurly>"}" {
5647 //addToBody(yytext);
5648 if( yyextra->curlyCount )
5649 {
5650 --yyextra->curlyCount ;
5651 }
5652 else
5653 {
5654 if (!yyextra->current->sli.empty() && yyextra->previous) // copy special list items
5655 {
5656 yyextra->previous->sli = yyextra->current->sli;
5657 yyextra->current->sli.clear();
5658 }
5659 if (yyextra->previous) yyextra->previous->endBodyLine=yyextra->yyLineNr;
5660 BEGIN( yyextra->lastCurlyContext ) ;
5661 }
5662 }
5663<SkipCurly>"}"{BN}*{DCOMM}"<" {
5664 lineCount(yyscanner);
5665 if ( yyextra->curlyCount )
5666 {
5667 //addToBody(yytext);
5668 --yyextra->curlyCount ;
5669 }
5670 else
5671 {
5672 yyextra->current->endBodyLine=yyextra->yyLineNr;
5673 yyextra->tempEntry = yyextra->current; // temporarily switch to the previous entry
5674 yyextra->current = yyextra->previous;
5675
5676 yyextra->docBlockContext = SkipCurlyEndDoc;
5677 yyextra->docBlockInBody = FALSE;
5678 yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
5679 ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
5680 yyextra->docBlock.str(std::string());
5681 yyextra->docBlockTerm = '}';
5682 if (yytext[yyleng-3]=='/')
5683 {
5684 startCommentBlock(yyscanner,TRUE);
5685 BEGIN( DocLine );
5686 }
5687 else
5688 {
5689 startCommentBlock(yyscanner,FALSE);
5690 BEGIN( DocBlock );
5691 }
5692 }
5693 }
5694<SkipCurlyEndDoc>"}"{BN}*{DCOMM}"<" { // desc is followed by another one
5695 yyextra->docBlockContext = SkipCurlyEndDoc;
5696 yyextra->docBlockInBody = FALSE;
5697 yyextra->docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) ||
5698 ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) );
5699 yyextra->docBlock.str(std::string());
5700 yyextra->docBlockTerm = '}';
5701 if (yytext[yyleng-3]=='/')
5702 {
5703 startCommentBlock(yyscanner,TRUE);
5704 BEGIN( DocLine );
5705 }
5706 else
5707 {
5708 startCommentBlock(yyscanner,FALSE);
5709 BEGIN( DocBlock );
5710 }
5711 }
5712<SkipCurlyEndDoc>"}" {
5713 //addToBody("}");
5714 if (yyextra->tempEntry) // we can only switch back to yyextra->current if no new item was created
5715 {
5716 yyextra->current = yyextra->tempEntry;
5717 yyextra->tempEntry.reset();
5718 }
5719 BEGIN( yyextra->lastCurlyContext );
5720 }
5721<SkipCurly>\" {
5722 //addToBody(yytext);
5723 yyextra->lastStringContext=SkipCurly;
5724 BEGIN( SkipString );
5725 }
5726<SkipCurly>^{B}*"#" {
5727 if (yyextra->insidePHP)
5728 REJECT;
5729 //addToBody(yytext);
5730 BEGIN( SkipCurlyCpp );
5731 }
5732<SkipCurly,SkipC11Inits,SkipInits,SkipC11Attribute>\n {
5733 lineCount(yyscanner);
5734 //addToBody(yytext);
5735 }
5736<SkipCurly,SkipCurlyCpp,ReadInitializer,ReadInitializerPtr>"<<<" {
5737 if (!yyextra->insidePHP)
5738 {
5739 REJECT;
5740 }
5741 else
5742 {
5743 yyextra->lastHereDocContext = YY_START;
5744 BEGIN(HereDoc);
5745 }
5746 }
5747<SkipCurly,SkipCurlyCpp>{B}*{RAWBEGIN} {
5748 yyextra->delimiter = extractBeginRawStringDelimiter(yytext);
5749 yyextra->lastRawStringContext = YY_START;
5750 yyextra->dummyRawString.clear();
5751 yyextra->pCopyRawString = &yyextra->dummyRawString;
5752 *yyextra->pCopyRawString += yytext;
5753 BEGIN(RawString);
5754 }
5755<SkipCurly,SkipCurlyCpp>[^\n#"'@\\/{}<\$]+ {
5756 lineCount(yyscanner); // for yyextra->column updates
5757 //addToBody(yytext);
5758 }
5759<SkipCurly,SkipCurlyCpp>"\$" {}
5760<SkipCurlyCpp>\n {
5761 //addToBody(yytext);
5762 lineCount(yyscanner);
5763 yyextra->lastCurlyContext = FindMembers;
5764 BEGIN( SkipCurly );
5765 }
5766<SkipCurlyCpp>\\[\r]*"\n"[\r]* {
5767 //addToBody(yytext);
5768 lineCount(yyscanner);
5769 }
5770<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>{CCS} {
5771 //addToBody(yytext);
5772 yyextra->lastCContext = YY_START;
5773 BEGIN(SkipComment);
5774 }
5775<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>{CPPC} {
5776 //addToBody(yytext);
5777 yyextra->lastCContext = YY_START;
5778 BEGIN(SkipCxxComment);
5779 }
5780<SkipInits,SkipC11Inits,SkipC11Attribute>"(" {
5781 yyextra->roundCount=0;
5782 yyextra->lastSkipRoundContext=YY_START;
5783 BEGIN(SkipRound);
5784 }
5785<SkipInits,SkipC11Inits,SkipC11Attribute>\" {
5786 yyextra->lastStringContext=YY_START;
5787 BEGIN( SkipString );
5788 }
5789<SkipInits>; {
5790 warn(yyextra->fileName,yyextra->yyLineNr,
5791 "Found ';' while parsing initializer list! "
5792 "(doxygen could be confused by a macro call without semicolon)"
5793 );
5794 BEGIN( FindMembers );
5795 }
5796<SkipInits,SkipCurly,SkipCurlyCpp>"#" {
5797 if (!yyextra->insidePHP)
5798 REJECT;
5799 //addToBody(yytext);
5800 yyextra->lastCContext = YY_START;
5801 BEGIN(SkipCxxComment);
5802 }
5803<SkipInits,SkipCurly,SkipCurlyCpp>@\" {
5804 if (!yyextra->insideCS) REJECT;
5805 // C# verbatim string
5806 // we want to discard the string, due to reuse of states we need a dummy stream
5807 yyextra->lastSkipVerbStringContext=YY_START;
5808 yyextra->pSkipVerbString=&yyextra->dummyTextStream;
5809 yyextra->dummyTextStream.clear(); // remove old data so it won't grow too much
5810 BEGIN(SkipVerbString);
5811 }
5812<SkipInits,SkipCurly,SkipCurlyCpp>{CHARLIT} {
5813 if (yyextra->insidePHP) REJECT;
5814 }
5815<SkipInits,SkipCurly,SkipCurlyCpp>\' {
5816 if (yyextra->insidePHP)
5817 {
5818 yyextra->lastStringContext=YY_START;
5819 BEGIN(SkipPHPString);
5820 }
5821 }
5822<SkipC11Attribute>{ID} {
5823 if (QCString(yytext)=="nodiscard")
5824 {
5825 yyextra->current->spec.setNoDiscard(true);
5826 }
5827 }
5828<SkipInits,SkipC11Inits,SkipCurly,SkipCurlyCpp,SkipC11Attribute>. { }
5829<SkipString,SkipPHPString>\\. { }
5830<SkipString>\" {
5831 BEGIN( yyextra->lastStringContext );
5832 }
5833<SkipPHPString>\' {
5834 BEGIN( yyextra->lastStringContext );
5835 }
5836<SkipString,SkipPHPString>{CCS}|{CCE}|{CPPC} { }
5837<SkipString,SkipPHPString>\n {
5838 lineCount(yyscanner);
5839 }
5840<SkipString>"[[" { }
5841<SkipString,SkipPHPString>. { }
5842<CompoundName>":" { // for "class : public base {} var;" construct, see bug 608359
5843 unput(':');
5844 BEGIN(ClassVar);
5845 }
5846<CompoundName>";" {
5847 yyextra->current->section = EntryType::makeEmpty() ;
5848 yyextra->current->type.clear() ;
5849 yyextra->current->name.clear() ;
5850 yyextra->current->args.clear() ;
5851 yyextra->current->argList.clear();
5852 BEGIN( FindMembers ) ;
5853 }
5854<Bases>";" {
5855 if (yyextra->insideIDL && (yyextra->current->spec.isSingleton() || yyextra->current->spec.isService()))
5856 {
5857 // in UNO IDL a service or singleton may be defined
5858 // completely like this: "service Foo : XFoo;"
5859 if (!yyextra->current->name.isEmpty() && !yyextra->current_root->name.isEmpty())
5860 {
5861 prependScope(yyscanner);
5862 }
5863 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
5864 // there can be only one base class here
5865 if (!yyextra->baseName.isEmpty())
5866 {
5867 yyextra->current->extends.emplace_back(
5868 yyextra->baseName,Protection::Public,Specifier::Normal);
5869 yyextra->baseName.clear();
5870 }
5871 yyextra->current_root->moveToSubEntryAndRefresh( yyextra->current ) ;
5872 initEntry(yyscanner);
5873 }
5874 else
5875 {
5876 yyextra->current->section = EntryType::makeEmpty() ;
5877 yyextra->current->type.clear() ;
5878 yyextra->current->name.clear() ;
5879 yyextra->current->args.clear() ;
5880 yyextra->current->argList.clear();
5881 }
5882 BEGIN( FindMembers ) ;
5883 }
5884<CompoundName>{SCOPENAME}/{BN}*"<" {
5885 yyextra->sharpCount = 0;
5886 yyextra->current->name = yytext ;
5887 if (yyextra->current->spec.isProtocol())
5888 {
5889 yyextra->current->name+="-p";
5890 }
5891 lineCount(yyscanner);
5892 yyextra->lastClassTemplSpecContext = ClassVar;
5893 if (yyextra->insideObjC) // protocol list
5894 {
5895 BEGIN( ObjCProtocolList );
5896 }
5897 else if (yyextra->insideCS) // C# generic class
5898 {
5899 //yyextra->current->name+="-g";
5900 BEGIN( CSGeneric );
5901 }
5902 else // C++ template specialization
5903 {
5904 yyextra->roundCount=0;
5905 BEGIN( ClassTemplSpec );
5906 }
5907 }
5908<CSGeneric>"<" {
5909 ArgumentList al;
5910 // check bug 612858 before enabling the next line
5911 //yyextra->current->spec |= Entry::Template;
5912 yyextra->current->tArgLists.push_back(al);
5913 yyextra->currentArgumentList = &yyextra->current->tArgLists.back();
5914 yyextra->templateStr="<";
5915 yyextra->current->name += "<";
5916 yyextra->fullArgString = yyextra->templateStr;
5917 yyextra->copyArgString = &yyextra->current->name;
5918 //yyextra->copyArgString = &yyextra->templateStr;
5919 yyextra->currentArgumentContext = ClassVar;
5920 BEGIN( ReadTempArgs );
5921 }
5922<ObjCProtocolList>"<" {
5923 yyextra->insideProtocolList=TRUE;
5924 BEGIN( Bases );
5925 }
5926<ClassTemplSpec>">"({BN}*"::"{BN}*{SCOPENAME})? {
5927 yyextra->current->name += yytext;
5928 lineCount(yyscanner);
5929 if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
5930 {
5931 yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
5932 if (yyextra->current->spec.isProtocol())
5933 { // Objective-C protocol
5934 unput('{'); // fake start of body
5935 BEGIN( ClassVar );
5936 }
5937 else
5938 {
5939 BEGIN( yyextra->lastClassTemplSpecContext );
5940 }
5941 }
5942 }
5943<ClassTemplSpec>"<" {
5944 yyextra->current->name += yytext;
5945 if (yyextra->roundCount==0) yyextra->sharpCount++;
5946 }
5947<ClassTemplSpec>. {
5948 yyextra->current->name += yytext;
5949 }
5950<CompoundName>({SCOPENAME}|{CSSCOPENAME}){BN}*";" { // forward declaration?
5951 if (yyextra->insideCS && yyextra->current->type == "namespace")
5952 {
5953 // file scoped CSharp namespace
5954 lineCount(yyscanner);
5955 yyextra->current->name = substitute(yytext,".","::");
5956 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
5957 yyextra->fakeNS++;
5958 unput('{'); // fake start of body
5959 BEGIN( ClassVar );
5960 }
5961 else if (!yyextra->current->tArgLists.empty())
5962 {
5963 // found a forward template declaration, this has
5964 // a purpose of its own
5965 yyextra->current->name = yytext;
5966 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
5967 //printf("template class declaration for %s!\n",qPrint(yyextra->current->name));
5968 QCString rn = yyextra->current_root->name;
5969 //printf("cn='%s' rn='%s' yyextra->isTypedef=%d\n",qPrint(cn),qPrint(rn),yyextra->isTypedef);
5970 if (!yyextra->current->name.isEmpty() && !rn.isEmpty())
5971 {
5972 prependScope(yyscanner);
5973 }
5974 yyextra->current->spec.setForwardDecl(true);
5975 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
5976 }
5977 else if (yyextra->insideIDL &&
5978 (((yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isService()) &&
5979 yyextra->current->spec.isInterface()) ||
5980 ((yyextra->current_root->spec.isService() || yyextra->current_root->spec.isSingleton()) &&
5981 yyextra->current->spec.isService())
5982 )
5983 )
5984 {
5985 // interface yyextra->inside of UNO IDL service or interface
5986 // service yyextra->inside of UNO IDL service or singleton
5987 // there may be documentation on the member,
5988 // so do not throw it away...
5989 yyextra->current->name = yytext;
5990 yyextra->current->name=yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace();
5991 yyextra->current->section = yyextra->current->spec.isInterface() ? EntryType::makeExportedInterface()
5992 : EntryType::makeIncludedService();
5993// yyextra->current->section = EntryType::makeMemberDoc();
5994 yyextra->current->spec.setInterface(false).setService(false);
5995 // FIXME: horrible: Interface == Gettable, so need to clear it - actually we're mixing values from
5996 // different enums in this case...
5997 // granted only Optional and Interface are actually valid in this context but urgh...
5998 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
5999 }
6000
6001 if (!(yyextra->insideCS && yyextra->current->type == "namespace"))
6002 {
6003 unput(';');
6004 yyextra->current->reset();
6005 initEntry(yyscanner);
6006 if (yyextra->insideObjC) // see bug746361
6007 {
6008 yyextra->language = yyextra->current->lang = SrcLangExt::Cpp;
6009 yyextra->insideObjC = FALSE;
6010 }
6011 if (yyextra->isTypedef) // typedef of a class, put typedef keyword back
6012 {
6013 yyextra->current->type.prepend("typedef");
6014 }
6015 BEGIN( FindMembers );
6016 }
6017 }
Wrapper class for the Entry type.
Definition types.h:631
6018<CompoundName>{SCOPENAME}/{BN}*"(" {
6019 yyextra->current->name = yytext ;
6020 lineCount(yyscanner);
6021 if (yyextra->insideCpp && yyextra->current->name=="alignas") // C++11
6022 {
6023 yyextra->lastAlignAsContext = YY_START;
6024 BEGIN( AlignAs );
6025 }
6026 else
6027 {
6028 if (yyextra->current->spec.isProtocol())
6029 {
6030 yyextra->current->name += "-p";
6031 }
6032 BEGIN( ClassVar );
6033 }
6034 }
6035<AlignAs>"(" { yyextra->roundCount=0;
6036 BEGIN( AlignAsEnd );
6037 }
6038<AlignAs>\n { lineCount(yyscanner); }
6039<AlignAs>.
6040<AlignAsEnd>"(" { yyextra->roundCount++; }
6041<AlignAsEnd>")" { if (--yyextra->roundCount<0)
6042 {
6043 BEGIN( yyextra->lastAlignAsContext );
6044 }
6045 }
6046<AlignAsEnd>\n { lineCount(yyscanner); }
6047<AlignAsEnd>.
6048<ConceptName>{ID} {
6049 yyextra->current->name = yytext ;
6050 }
6051<ConceptName>"=" {
6052 yyextra->current->bodyLine = yyextra->yyLineNr;
6053 yyextra->current->bodyColumn = yyextra->yyColNr;
6054 yyextra->current->initializer.str(std::string());
6055 yyextra->lastInitializerContext = FindMembers;
6056 yyextra->initBracketCount=0;
6057 BEGIN(ReadInitializer);
6058 }
6059<CompoundName>{SCOPENAME}/{BN}*"," { // multiple forward declarations on one line
6060 // e.g. @protocol A,B;
6061 yyextra->current->reset();
6062 initEntry(yyscanner);
6063 }
6064<CompoundName>{SCOPENAME} {
6065 yyextra->current->name = yytext ;
6066 storeClangId(yyscanner,yytext);
6067 lineCount(yyscanner);
6068 if (yyextra->current->spec.isProtocol())
6069 {
6070 yyextra->current->name += "-p";
6071 }
6072 if (yyextra->current->spec.isProtocol() || yyextra->current->section.isObjcImpl())
6073 {
6074 unput('{'); // fake start of body
6075 }
6076 BEGIN( ClassVar );
6077 }
6078<CompoundName>{CSSCOPENAME} { // C# style scope
6079 yyextra->current->name = substitute(yytext,".","::");
6080 lineCount(yyscanner);
6081 BEGIN( ClassVar );
6082 }
6083<ClassVar>{SCOPENAME}{BNopt}/"(" {
6084 if (yyextra->insideIDL && literal_at(yytext,"switch") && !isId(yytext[6]))
6085 {
6086 // Corba IDL style union
6087 yyextra->roundCount=0;
6088 BEGIN(SkipUnionSwitch);
6089 }
6090 else
6091 {
6092 addType(yyscanner);
6093 yyextra->yyBegColNr=yyextra->yyColNr;
6094 yyextra->yyBegLineNr=yyextra->yyLineNr;
6095 yyextra->current->name = yytext;
6096 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
6097 lineCount(yyscanner);
6098 BEGIN( FindMembers );
6099 }
6100 }
6101<ClassVar>"," {
6102 if (yyextra->isTypedef)
6103 {
6104 // multiple types in one typedef
6105 unput(',');
6106 yyextra->current->type.prepend("typedef ");
6107 BEGIN(FindMembers);
6108 }
6109 else
6110 {
6111 // Multiple class forward declaration
6112 }
6113 }
6114<ClassVar>("sealed"|"abstract")/{BN}*(":"|"{") {
6115 if (yyextra->insideCli)
6116 {
6117 if (yytext[0]=='s') // sealed
6118 yyextra->current->spec.setSealedClass(true);
6119 else // abstract
6120 yyextra->current->spec.setAbstractClass(true);
6121 BEGIN( ClassVar );
6122 }
6123 else
6124 {
6125 REJECT;
6126 }
6127 }
6128<ClassVar>({ID}{BN}*"::"{BN}*)+{ID} {
6129 yyextra->yyBegColNr=yyextra->yyColNr;
6130 yyextra->yyBegLineNr=yyextra->yyLineNr;
6131 storeClangId(yyscanner,yytext);
6132 lineCount(yyscanner);
6133 if (yyextra->current->section.isEnum())
6134 { // found "enum a N::b" -> variable
6135 yyextra->current->section = EntryType::makeVariable() ;
6136 }
6137 yyextra->current->type += ' ' ;
6138 yyextra->current->type += yyextra->current->name ;
6139 yyextra->current->name = QCString(yytext).simplifyWhiteSpace();
6140
6141 if (nameIsOperator(yyextra->current->name))
6142 {
6143 BEGIN( Operator );
6144 }
6145 }
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
Definition qcstring.cpp:185
6146<ClassVar>{ID} {
6147 yyextra->yyBegColNr=yyextra->yyColNr;
6148 yyextra->yyBegLineNr=yyextra->yyLineNr;
6149 storeClangId(yyscanner,yytext);
6150 if (yyextra->insideIDL && qstrcmp(yytext,"switch")==0)
6151 {
6152 // Corba IDL style union
6153 yyextra->roundCount=0;
6154 BEGIN(SkipUnionSwitch);
6155 }
6156 else if ((yyextra->insideJava || yyextra->insidePHP || yyextra->insideJS || yyextra->insideSlice) && (qstrcmp(yytext,"implements")==0 || qstrcmp(yytext,"extends")==0))
6157 {
6158 yyextra->current->type.clear();
6159 yyextra->baseProt = Protection::Public;
6160 yyextra->baseVirt = Specifier::Normal;
6161 yyextra->baseName.clear();
6162 BEGIN( BasesProt ) ;
6163 }
6164 else if (yyextra->insideCS && qstrcmp(yytext,"where")==0) // C# type constraint
6165 {
6166 yyextra->current->typeConstr.clear();
6167 yyextra->current->typeConstr.push_back(Argument());
6168 yyextra->lastCSConstraint = YY_START;
6169 BEGIN( CSConstraintName );
6170 }
6171 else if (yyextra->insideCli && qstrcmp(yytext,"abstract")==0)
6172 {
6173 yyextra->current->spec.setAbstract(true);
6174 }
6175 else if (yyextra->insideCli && qstrcmp(yytext,"sealed")==0)
6176 {
6177 yyextra->current->spec.setSealed(true);
6178 }
6179 else if (qstrcmp(yytext,"final")==0)
6180 {
6181 yyextra->current->spec.setFinal(true);
6182 }
6183 else
6184 {
6185 if (yyextra->current->section.isEnum())
6186 { // found "enum a b" -> variable
6187 yyextra->current->section = EntryType::makeVariable() ;
6188 }
6189 yyextra->current->type += ' ' ;
6190 yyextra->current->type += yyextra->current->name ;
6191 yyextra->current->name = yytext ;
6192
6193 if (nameIsOperator(yyextra->current->name))
6194 {
6195 BEGIN( Operator );
6196 }
6197 }
6198 }
6199<ClassVar>[(\[] {
6200 if (yyextra->insideObjC && *yytext=='(') // class category
6201 {
6202 yyextra->current->name+='(';
6203 //if (yyextra->current->section!=Entry::OBJCIMPL_SEC)
6204 //{
6205 yyextra->current->spec.setCategory(true);
6206 //}
6207 BEGIN( ClassCategory );
6208 }
6209 else
6210 {
6211 // probably a function anyway
6212 unput(*yytext);
6213 BEGIN( FindMembers );
6214 }
6215 }
6216<CSConstraintType,CSConstraintName>{CCS}{CCE} { /* empty comment */ }
6217<CSConstraintType,CSConstraintName>({CCS}[*!]|{CPPC}[/!])("<"?) { // special comment
6218 yyextra->fullArgString.clear();
6219 yyextra->lastCopyArgChar='#'; // end marker
6220 yyextra->lastCommentInArgContext=YY_START;
6221 if (yytext[1]=='/')
6222 BEGIN( CopyArgCommentLine );
6223 else
6224 BEGIN( CopyArgComment );
6225 }
6226<CSConstraintType,CSConstraintName>"#" { // artificially inserted token to signal end of comment block
6227 yyextra->current->typeConstr.back().docs = yyextra->fullArgString;
6228 }
6229<CSConstraintType>"=>" { // end of type constraint reached
6230 // parse documentation of the constraints
6231 handleParametersCommentBlocks(yyscanner,yyextra->current->typeConstr);
6232 unput('>');
6233 unput('=');
6234 BEGIN( yyextra->lastCSConstraint );
6235 }
6236<CSConstraintType>"{" { // end of type constraint reached
6237 // parse documentation of the constraints
6238 handleParametersCommentBlocks(yyscanner,yyextra->current->typeConstr);
6239 unput('{');
6240 BEGIN( yyextra->lastCSConstraint );
6241 }
6242<CSConstraintType,CSConstraintName>";" {
6243 handleParametersCommentBlocks(yyscanner,yyextra->current->typeConstr);
6244 unput(';');
6245 BEGIN( yyextra->lastCSConstraint );
6246 }
6247<CSConstraintName>":" {
6248 BEGIN( CSConstraintType );
6249 }
6250<CSConstraintName>{ID} {
6251 // parameter name
6252 yyextra->current->typeConstr.back().name=yytext;
6253 }
6254<CSConstraintType>"where" { // another constraint for a different param
6255 yyextra->current->typeConstr.push_back(Argument());
6256 BEGIN( CSConstraintName );
6257 }
6258<CSConstraintType>({ID}".")*{ID}("<"{ID}">")?("()")? {
6259 if (yyextra->current->typeConstr.back().type.isEmpty())
6260 // first type constraint for this parameter
6261 {
6262 yyextra->current->typeConstr.back().type=yytext;
6263 }
6264 else // new type constraint for same parameter
6265 {
6266 QCString name = yyextra->current->typeConstr.back().name;
6267 yyextra->current->typeConstr.push_back(Argument());
6268 yyextra->current->typeConstr.back().name=name;
6269 yyextra->current->typeConstr.back().type=yytext;
6270 }
6271 }
6272<CSConstraintName,CSConstraintType>\n {
6273 lineCount(yyscanner);
6274 }
6275<CSConstraintName,CSConstraintType>. {
6276 }
6277<ClassCategory>{ID} {
6278 yyextra->current->name+=yytext;
6279 }
6280<ClassCategory>")"/{BN}*"{" {
6281 yyextra->current->name+=')';
6282 BEGIN( ClassVar );
6283 }
6284<ClassCategory>")"/{BN}*"<" {
6285 yyextra->current->name+=')';
6286 BEGIN( ObjCProtocolList );
6287 }
6288<ClassCategory>")" {
6289 yyextra->current->name+=')';
6290 if (yyextra->current->spec.isProtocol() || yyextra->current->section.isObjcImpl())
6291 {
6292 unput('{'); // fake start of body
6293 }
6294 else // category has no variables so push back an empty body
6295 {
6296 unput('}');
6297 unput('{');
6298 }
6299 BEGIN( ClassVar );
6300 }
6301<ClassVar>":" {
6302 if (yyextra->current->section.isVariable()) // enum A B:2, see bug 748208
6303 {
6304 yyextra->current->bitfields+=":";
6305 yyextra->current->args.clear();
6306 BEGIN(BitFields);
6307 }
6308 else if (yyextra->current->section.isEnum()) // enum E:2, see bug 313527,
6309 // or C++11 style enum: 'E : unsigned int {...}'
6310 {
6311 yyextra->current->args.clear();
6312 BEGIN(EnumBaseType);
6313 }
6314 else
6315 {
6316 yyextra->current->type.clear();
6317 if (yyextra->current->spec.isInterface() ||
6318 yyextra->current->spec.isStruct() ||
6319 yyextra->current->spec.isRef() ||
6320 yyextra->current->spec.isValue() ||
6321 yyextra->insidePHP || yyextra->insideCS || yyextra->insideD || yyextra->insideObjC || yyextra->insideIDL
6322 )
6323 {
6324 yyextra->baseProt = Protection::Public;
6325 }
6326 else
6327 {
6328 yyextra->baseProt = Protection::Private;
6329 }
6330 yyextra->baseVirt = Specifier::Normal;
6331 yyextra->baseName.clear();
6332 BEGIN( BasesProt ) ;
6333 }
6334 }
6335<ClassVar>[;=*&] {
6336 if (yyextra->isTypedef) // typedef of a class, put typedef keyword back
6337 {
6338 yyextra->current->type.prepend("typedef");
6339 }
6340 if ((yytext[0]=='*' || yytext[0]=='&') && yyextra->current->section.isEnum())
6341 { // found "enum a *b" -> variable
6342 yyextra->current->section = EntryType::makeVariable() ;
6343 }
6344 if (yytext[0]==';' && yyextra->current->section.isEnum())
6345 {
6346 yyextra->current->reset();
6347 initEntry(yyscanner);
6348 }
6349 else
6350 {
6351 unput(*yytext);
6352 }
6353 BEGIN( FindMembers );
6354 }
6355<Bases,ClassVar>{CPPC}"/"/[^/] {
6356 if (!yyextra->insideObjC)
6357 {
6358 REJECT;
6359 }
6360 else
6361 {
6362 lineCount(yyscanner);
6363 yyextra->current->program << yytext;
6364 yyextra->current->fileName = yyextra->fileName ;
6365 yyextra->current->startLine = yyextra->yyLineNr ;
6366 yyextra->current->startColumn = yyextra->yyColNr;
6367 yyextra->curlyCount=0;
6368 BEGIN( ReadBodyIntf );
6369 }
6370 }
6371<Bases,ClassVar>({CPPC}{B}*)?{CCS}"*"/{NCOMM} |
6372<Bases,ClassVar>({CPPC}{B}*)?{CCS}"!" |
6373<Bases,ClassVar>{CPPC}"!" |
6374<Bases,ClassVar>[\-+]{BN}* {
6375 if (!yyextra->insideObjC)
6376 {
6377 REJECT;
6378 }
6379 else
6380 {
6381 lineCount(yyscanner);
6382 yyextra->current->program << yytext;
6383 yyextra->current->fileName = yyextra->fileName ;
6384 yyextra->current->startLine = yyextra->yyLineNr ;
6385 yyextra->current->startColumn = yyextra->yyColNr;
6386 yyextra->curlyCount=0;
6387 BEGIN( ReadBodyIntf );
6388 }
6389 }
6390<CompoundName,ClassVar>{B}*"{"{B}* {
6391 yyextra->current->program.str(std::string());
6392 yyextra->current->fileName = yyextra->fileName ;
6393 yyextra->current->bodyLine = yyextra->yyLineNr;
6394 yyextra->current->bodyColumn = yyextra->yyColNr;
6395 yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
6396 if (yyextra->current->name.isEmpty() && !yyextra->isTypedef) // anonymous compound
6397 {
6398 if (yyextra->current->section.isNamespace()) // allow reopening of anonymous namespaces
6399 {
6400 if (Config_getBool(EXTRACT_ANON_NSPACES)) // use visible name
6401 {
6402 yyextra->current->name="anonymous_namespace{"+stripPath(yyextra->current->fileName)+"}";
6403 }
6404 else // use invisible name
6405 {
6406 yyextra->current->name = generateAnonymousAnchor(yyextra->fileName,yyextra->anonNSCount);
6407 }
6408 }
6409 else
6410 {
6411 yyextra->current->name = generateAnonymousAnchor(yyextra->fileName,yyextra->anonCount++);
6412 }
6413 }
6414 yyextra->curlyCount=0;
6415 if (yyextra->current_root && // not a nested struct yyextra->inside an @interface section
6416 !yyextra->current_root->spec.isInterface() &&
6417 (yyextra->current->spec.isInterface() ||
6418 yyextra->current->spec.isProtocol() ||
6419 yyextra->current->spec.isCategory() ||
6420 yyextra->current->section.isObjcImpl()
6421 ) &&
6422 yyextra->insideObjC
6423 )
6424 { // ObjC body that ends with @end
6425 BEGIN( ReadBodyIntf );
6426 }
6427 else if (yyextra->current->section.isNamespace())
6428 { // namespace body
6429 BEGIN( ReadNSBody );
6430 }
6431 else
6432 { // class body
6433 BEGIN( ReadBody ) ;
6434 }
6435 }
QCString stripPath(const QCString &s)
Definition util.cpp:5448
6436<BasesProt>"virtual"{BN}+ { lineCount(yyscanner); yyextra->baseVirt = Specifier::Virtual; }
6437<BasesProt>"public"{BN}+ { lineCount(yyscanner); yyextra->baseProt = Protection::Public; }
6438<BasesProt>"protected"{BN}+ { lineCount(yyscanner); yyextra->baseProt = Protection::Protected; }
6439<BasesProt>"internal"{BN}+ { if (!yyextra->insideCli) REJECT ; lineCount(yyscanner); yyextra->baseProt = Protection::Package; }
6440<BasesProt>"private"{BN}+ { lineCount(yyscanner); yyextra->baseProt = Protection::Private; }
6441<BasesProt>{BN} { lineCount(yyscanner); }
6442<BasesProt>. { unput(*yytext); BEGIN(Bases); }
6443<Bases>"decltype"{BN}*"(" {
6444 lineCount(yyscanner);
6445 yyextra->roundCount=0;
6446 yyextra->lastSkipRoundContext=YY_START;
6447 BEGIN(SkipRound);
6448 }
6449<Bases>("\\")?({ID}"\\")*{ID} { // PHP namespace token, not sure if interspacing is allowed but it gives problems (see bug 640847)
6450 if (!yyextra->insidePHP)
6451 {
6452 REJECT;
6453 }
6454 else // PHP base class of the form \Ns\Cl or Ns\Cl
6455 {
6456 lineCount(yyscanner);
6457 QCString bn=yytext;
6458 bn = substitute(bn,"\\","::");
6459 yyextra->baseName += bn;
6460 yyextra->current->args += ' ';
6461 yyextra->current->args += yytext;
6462 }
6463 }
6464<Bases>("::")?{BN}*({ID}{BN}*"::"{BN}*)*{ID}("...")? {
6465 lineCount(yyscanner);
6466 QCString baseScope = yytext;
6467 if (yyextra->insideCS && baseScope.stripWhiteSpace()=="where")
6468 {
6469 // type constraint for a class
6470 yyextra->current->typeConstr.clear();
6471 yyextra->current->typeConstr.push_back(Argument());
6472 yyextra->lastCSConstraint = YY_START;
6473 BEGIN( CSConstraintName );
6474 }
6475 else
6476 {
6477 yyextra->baseName+=yytext;
6478 yyextra->current->args += ' ';
6479 yyextra->current->args += yytext;
6480 }
6481 }
6482<Bases>{BN}*{ID}("."{ID})* { // Java style class
6483 QCString name = substitute(yytext,".","::");
6484 yyextra->baseName += name;
6485 yyextra->current->args += ' ';
6486 yyextra->current->args += name;
6487 }
6488<ClassVar,Bases>\n/{BN}*[^{, \t\n] {
6489 if (!yyextra->insideObjC)
6490 {
6491 REJECT;
6492 }
6493 else
6494 {
6495 lineCount(yyscanner);
6496 unput('{');
6497 }
6498 }
6499<ClassVar,Bases>"@end" { // empty ObjC interface
6500 unput('d'); // insert fake body: {}@end
6501 unput('n');
6502 unput('e');
6503 unput('@');
6504 unput('}');
6505 unput('{');
6506 }
6507<ClassVar>"<" { yyextra->current->name += *yytext;
6508 yyextra->sharpCount=1;
6509 yyextra->roundCount=0;
6510 yyextra->lastSkipSharpContext = YY_START;
6511 yyextra->specName = &yyextra->current->name;
6512 BEGIN ( Specialization );
6513 }
6514<Bases>{BN}*"<" {
6515 lineCount(yyscanner);
6516 yyextra->sharpCount=1;
6517 yyextra->roundCount=0;
6518 yyextra->lastSkipSharpContext = YY_START;
6519 if (yyextra->insideObjC) // start of protocol list
6520 {
6521 unput(',');
6522 }
6523 else // template specialization
6524 {
6525 //if (yyextra->insideCS) // generic
6526 //{
6527 // yyextra->baseName+="-g";
6528 //}
6529 yyextra->templateStr = yytext;
6530 yyextra->specName = &yyextra->templateStr;
6531 BEGIN ( Specialization );
6532 }
6533 }
6534<Specialization>"<" { *yyextra->specName += *yytext;
6535 if (yyextra->roundCount==0) yyextra->sharpCount++;
6536 }
6537<Specialization>">" {
6538 *yyextra->specName += *yytext;
6539 if (yyextra->roundCount==0 && --yyextra->sharpCount<=0)
6540 {
6541 yyextra->baseName+=removeRedundantWhiteSpace(*yyextra->specName);
6542 BEGIN(yyextra->lastSkipSharpContext);
6543 }
6544 }
6545<Specialization>{BN}+ { lineCount(yyscanner); *yyextra->specName +=' '; }
6546<Specialization>"<<" { *yyextra->specName += yytext; }
6547<Specialization>">>"/{B}*"::" { // M$ C++ extension to allow >> to close a template...
6548 unput('>');
6549 unput(' ');
6550 unput('>');
6551 }
6552<Specialization>">>" {
6553 if (yyextra->insideCS) // for C# >> ends a nested template
6554 {
6555 REJECT;
6556 }
6557 else // for C++ >> is a bitshift
6558 // operator and > > would end
6559 // a nested template.
6560 // We require the bitshift to be enclosed in braces.
6561 // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
6562 {
6563 if (yyextra->roundCount>0)
6564 {
6565 *yyextra->specName += yytext;
6566 }
6567 else
6568 {
6569 unput('>');
6570 unput(' ');
6571 unput('>');
6572 }
6573 }
6574 }
6575<Specialization>"typename"{BN}+ { lineCount(yyscanner); }
6576<Specialization>"(" { *yyextra->specName += *yytext; yyextra->roundCount++; }
6577<Specialization>")" { *yyextra->specName += *yytext; yyextra->roundCount--; }
6578
6579<Specialization>"\\\\" { *yyextra->specName += *yytext;}
6580<Specialization>"\\'" { *yyextra->specName += *yytext;}
6581<Specialization>"\\\"" { *yyextra->specName += *yytext;}
6582<Specialization>"'" { *yyextra->specName += *yytext;BEGIN(SpecializationSingleQuote);}
6583<Specialization>"\"" { *yyextra->specName += *yytext;BEGIN(SpecializationDoubleQuote);}
6584<SpecializationSingleQuote,SpecializationDoubleQuote>"\\\\" { *yyextra->specName += *yytext;}
6585<SpecializationSingleQuote>"\\'" { *yyextra->specName += *yytext;}
6586<SpecializationSingleQuote>"'" { *yyextra->specName += *yytext; BEGIN(Specialization);}
6587<SpecializationDoubleQuote>"\\\"" { *yyextra->specName += *yytext;}
6588<SpecializationDoubleQuote>"\"" { *yyextra->specName += *yytext; BEGIN(Specialization);}
6589<SpecializationSingleQuote,SpecializationDoubleQuote>. { *yyextra->specName += *yytext;}
6590
6591<Specialization>. {
6592 *yyextra->specName += *yytext;
6593 }
6594<SkipRound>"(" { ++yyextra->roundCount; }
6595<SkipRound>")" { if (--yyextra->roundCount<0)
6596 BEGIN ( yyextra->lastSkipRoundContext );
6597 }
6598<SkipRound>\" {
6599 yyextra->lastStringContext=SkipRound;
6600 BEGIN(SkipString);
6601 }
6602<Bases>","|(">"({BN}*"{")?)|({BN}+"implements"{BN}*) { lineCount(yyscanner);
6603 if (yyextra->insideProtocolList)
6604 {
6605 yyextra->baseName+="-p";
6606 }
6607 else
6608 {
6609 yyextra->current->args += ',' ;
6610 }
6611 yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
6612 if (!yyextra->baseName.isEmpty())
6613 {
6614 yyextra->current->extends.emplace_back(
6615 yyextra->baseName,yyextra->baseProt,yyextra->baseVirt
6616 );
6617 }
6618 if (yyextra->current->spec.isInterface() || yyextra->current->spec.isStruct() ||
6619 yyextra->insideJava || yyextra->insidePHP || yyextra->insideCS ||
6620 yyextra->insideD || yyextra->insideObjC || yyextra->insideIDL || yyextra->insideSlice)
6621 {
6622 yyextra->baseProt=Protection::Public;
6623 }
6624 else
6625 {
6626 yyextra->baseProt=Protection::Private;
6627 }
6628 yyextra->baseVirt=Specifier::Normal;
6629 yyextra->baseName.clear();
6630 if (*yytext=='>')
6631 { // end of a ObjC protocol list
6632 yyextra->insideProtocolList=FALSE;
6633 if (yyleng==1)
6634 {
6635 unput('{'); // dummy start body
6636 }
6637 else
6638 {
6639 yyless(1);
6640 }
6641 }
6642 else
6643 {
6644 if (*yytext==',' && yyextra->insideObjC) // Begin of protocol list
6645 {
6646 yyextra->insideProtocolList=TRUE;
6647 }
6648 BEGIN(BasesProt);
6649 }
6650 }
6651<Bases>{B}*"{"{B}* {
6652 yyextra->current->program.str(std::string());
6653 yyextra->current->fileName = yyextra->fileName ;
6654 yyextra->current->bodyLine = yyextra->yyLineNr;
6655 yyextra->current->bodyColumn = yyextra->yyColNr;
6656 yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
6657 if (!yyextra->baseName.isEmpty())
6658 yyextra->current->extends.emplace_back(
6659 yyextra->baseName,yyextra->baseProt,yyextra->baseVirt
6660 );
6661 yyextra->curlyCount=0;
6662 if (yyextra->insideObjC)
6663 {
6664 BEGIN( ReadBodyIntf );
6665 }
6666 else
6667 {
6668 BEGIN( ReadBody ) ;
6669 }
6670 }
6671<SkipUnionSwitch>{B}*"(" {
6672 yyextra->roundCount++;
6673 }
6674<SkipUnionSwitch>")" {
6675 if (--yyextra->roundCount==0)
6676 {
6677 BEGIN(ClassVar);
6678 }
6679 }
6680<SkipUnionSwitch>\n { lineCount(yyscanner); }
6681<SkipUnionSwitch>.
6682<Comment>{BN}+ { yyextra->current->program << yytext ;
6683 lineCount(yyscanner) ;
6684 }
6685<Comment>{CCS} { yyextra->current->program << yytext ; }
6686<Comment>{CPPC} { yyextra->current->program << yytext ; }
6687<Comment>{CMD}("code"|"verbatim"|"iliteral") {
6688 if (yyextra->doxygenComment) yyextra->insideCode=TRUE;
6689 yyextra->current->program << yytext ;
6690 }
6691<Comment>{CMD}("endcode"|"endverbatim"|"endiliteral") {
6692 if (yyextra->doxygenComment) yyextra->insideCode=FALSE;
6693 yyextra->current->program << yytext ;
6694 }
6695<Comment>[^ \.\t\r\n\/\*]+ { yyextra->current->program << yytext ; }
6696<Comment>{CCE} { yyextra->current->program << yytext ;
6697 if (!yyextra->insideCode)
6698 {
6699 yyextra->doxygenComment=false;
6700 BEGIN( yyextra->lastContext );
6701 }
6702 }
6703<Comment>. { yyextra->current->program << *yytext ; }
6704
6705<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,SkipC11Inits,SkipC11Attribute,Bases,OldStyleArgs>({CPPC}{B}*)?{CCS}"!" {
6706 //printf("Start doc block at %d\n",yyextra->yyLineNr);
6707 if (!yyextra->current->doc.isEmpty())
6708 {
6709 yyextra->current->doc+="\n\n";
6710 }
6711 else
6712 {
6713 yyextra->current->docLine = yyextra->yyLineNr;
6714 yyextra->current->docFile = yyextra->fileName;
6715 }
6716
6717 yyextra->lastDocContext = YY_START;
6718 if (yyextra->current_root->section.isScope())
6719 {
6720 yyextra->current->inside = yyextra->current_root->name+"::";
6721 }
6722 yyextra->docBlockContext = YY_START;
6723 yyextra->docBlockInBody = YY_START==SkipCurly;
6724 yyextra->docBlockAutoBrief = Config_getBool(QT_AUTOBRIEF);
6725
6726 QCString indent;
6727 indent.fill(' ',computeIndent(yytext,yyextra->column));
6728 yyextra->docBlock.str(indent.str());
6729
6730 if (yyextra->docBlockAutoBrief)
6731 {
6732 yyextra->current->briefLine = yyextra->yyLineNr;
6733 yyextra->current->briefFile = yyextra->fileName;
6734 }
6735 startCommentBlock(yyscanner,FALSE);
6736 BEGIN( DocBlock );
6737 }
6738<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>{CCS}"*"[*]+{BL} {
6739 bool javadocBanner = Config_getBool(JAVADOC_BANNER);
6740 lineCount(yyscanner);
6741
6742 if( javadocBanner )
6743 {
6744 yyextra->lastDocContext = YY_START;
6745
6746 //printf("Found comment banner at %s:%d\n",yyextra->fileName,yyextra->yyLineNr);
6747 if (yyextra->current_root->section.isScope())
6748 {
6749 yyextra->current->inside = yyextra->current_root->name+"::";
6750 }
6751 yyextra->current->docLine = yyextra->yyLineNr;
6752 yyextra->current->docFile = yyextra->fileName;
6753 yyextra->docBlockContext = YY_START;
6754 yyextra->docBlockInBody = YY_START==SkipCurly;
6755 bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF);
6756 yyextra->docBlockAutoBrief = javadocAutoBrief;
6757
6758 QCString indent;
6759 indent.fill(' ',computeIndent(yytext,yyextra->column));
6760 yyextra->docBlock.str(indent.str());
6761
6762 if (yyextra->docBlockAutoBrief)
6763 {
6764 yyextra->current->briefLine = yyextra->yyLineNr;
6765 yyextra->current->briefFile = yyextra->fileName;
6766 }
6767 startCommentBlock(yyscanner,FALSE);
6768 BEGIN( DocBlock );
6769 }
6770 else
6771 {
6772 yyextra->current->program << yytext ;
6773 yyextra->lastContext = YY_START ;
6774 yyextra->doxygenComment=true;
6775 BEGIN( Comment ) ;
6776 }
6777 }
6778<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>^{B}+({CPPC}{B}*)?{CCS}"*"/{NCOMM} {
6779 lineCount(yyscanner);
6780 yyextra->yyColNr=1;
6781 REJECT;
6782 }
6783<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>({CPPC}{B}*)?{CCS}"*"/{NCOMM} {
6784 yyextra->lastDocContext = YY_START;
6785
6786 //printf("Found comment block at %s:%d\n",yyextra->fileName,yyextra->yyLineNr);
6787 if (yyextra->current_root->section.isScope())
6788 {
6789 yyextra->current->inside = yyextra->current_root->name+"::";
6790 }
6791 yyextra->current->docLine = yyextra->yyLineNr;
6792 yyextra->current->docFile = yyextra->fileName;
6793 yyextra->docBlockContext = YY_START;
6794 yyextra->docBlockInBody = YY_START==SkipCurly;
6795 bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF);
6796 yyextra->docBlockAutoBrief = javadocAutoBrief;
6797
6798 QCString indent;
6799 indent.fill(' ',computeIndent(yytext,yyextra->column));
6800 yyextra->docBlock.str(indent.str());
6801
6802 if (yyextra->docBlockAutoBrief)
6803 {
6804 yyextra->current->briefLine = yyextra->yyLineNr;
6805 yyextra->current->briefFile = yyextra->fileName;
6806 }
6807 startCommentBlock(yyscanner,FALSE);
6808 BEGIN( DocBlock );
6809 }
6810<FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>{CPPC}"!" {
6811 yyextra->lastDocContext = YY_START;
6812 if (yyextra->current_root->section.isScope())
6813 {
6814 yyextra->current->inside = yyextra->current_root->name+"::";
6815 }
6816 yyextra->docBlockContext = YY_START;
6817 yyextra->docBlockInBody = YY_START==SkipCurly;
6818 yyextra->docBlockAutoBrief = FALSE;
6819
6820 QCString indent;
6821 indent.fill(' ',computeIndent(yytext,yyextra->column));
6822 yyextra->docBlock.str(indent.str());
6823
6824 startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
6825 BEGIN( DocLine );
6826 }
6827<FindMembers,FindFields,MemberSpec,SkipCurly,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>{CPPC}"/"/[^/] {
6828 yyextra->lastDocContext = YY_START;
6829 if (yyextra->current_root->section.isScope())
6830 {
6831 yyextra->current->inside = yyextra->current_root->name+"::";
6832 }
6833 yyextra->docBlockContext = YY_START;
6834 yyextra->docBlockInBody = YY_START==SkipCurly;
6835 yyextra->docBlockAutoBrief = FALSE;
6836 QCString indent;
6837 indent.fill(' ',computeIndent(yytext,yyextra->column));
6838 yyextra->docBlock.str(indent.str());
6839 startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
6840 BEGIN( DocLine );
6841 }
6842<FindMembers>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
6843 lineCount(yyscanner);
6844 yyextra->externLinkage=TRUE;
6845 }
6846<FindMembers>"{" {
6847 if (yyextra->externLinkage)
6848 {
6849 yyextra->externLinkage=FALSE;
6850 }
6851 else if (yyextra->insideCS &&
6852 !yyextra->current->name.isEmpty() &&
6853 !yyextra->current->type.isEmpty())
6854 {
6855 if (yyextra->current->mtype == MethodTypes::Event)
6856 {
6857 yyextra->mtype = MethodTypes::Event;
6858 }
6859 else if (containsWord(yyextra->current->type,"event")) // event
6860 {
6861 yyextra->current->mtype = yyextra->mtype = MethodTypes::Event;
6862 }
6863 else // property
6864 {
6865 yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
6866 }
6867 yyextra->current->bodyLine = yyextra->yyLineNr;
6868 yyextra->current->bodyColumn = yyextra->yyColNr;
6869 yyextra->curlyCount=0;
6870 BEGIN( CSAccessorDecl );
6871 }
6872 else if (yyextra->insideIDL && yyextra->current->spec.isAttribute())
6873 {
6874 // UNO IDL: attributes may have setter and getter
6875 // exception specifications
6876 yyextra->current->exception = " {";
6877 BEGIN(UNOIDLAttributeBlock);
6878 }
6879 else
6880 {
6881 if ((yyextra->insideJava || yyextra->insideCS || yyextra->insideD) &&
6882 yyextra->current->name.isEmpty()
6883 )
6884 {
6885 // static Java initializer
6886 yyextra->needsSemi = FALSE;
6887 if (yyextra->current->isStatic)
6888 {
6889 yyextra->current->name="[static initializer]";
6890 yyextra->current->type.clear();
6891 }
6892 else
6893 {
6894 yyextra->current->name="[instance initializer]";
6895 }
6896 unput(*yytext);
6897 BEGIN( SFunction );
6898 }
6899 else
6900 {
6901 // pre C++11 code -> ignore the initializer
6902 //yyextra->needsSemi = TRUE;
6903 //yyextra->current->type.clear();
6904 //yyextra->current->name.clear();
6905 //yyextra->current->args.clear();
6906 //yyextra->current->argList.clear();
6907 //yyextra->curlyCount=0;
6908 //BEGIN( SkipCurlyBlock );
6909
6910 // C++11 style initializer list
6911 yyextra->current->bodyLine = yyextra->yyLineNr;
6912 yyextra->current->bodyColumn = yyextra->yyColNr;
6913 yyextra->current->initializer.str(yytext);
6914 yyextra->lastInitializerContext = YY_START;
6915 yyextra->initBracketCount=1;
6916 BEGIN(ReadInitializer);
6917 }
6918 }
6919 }
6920<CSAccessorDecl>"{" { yyextra->curlyCount++; }
6921<CSAccessorDecl>"}"{B}*"=" {
6922 // fall back to next rule if it's not the right bracket
6923 if (yyextra->curlyCount != 0) REJECT;
6924 yyextra->current->initializer.str("=");
6925 yyextra->current->endBodyLine=yyextra->yyLineNr;
6926 yyextra->lastInitializerContext = FindMembers;
6927 BEGIN(ReadInitializer);
6928 }
6929<CSAccessorDecl>"}" {
6930 if (yyextra->curlyCount)
6931 {
6932 yyextra->curlyCount--;
6933 }
6934 else
6935 {
6936 yyextra->mtype = MethodTypes::Method;
6937 yyextra->virt = Specifier::Normal;
6938 // not really important, but while we are at it
6939 yyextra->current->endBodyLine=yyextra->yyLineNr;
6940 unput(';');
6941 BEGIN(FindMembers);
6942 }
6943 }
6944<CSAccessorDecl>"private "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec.setPrivateSettable(true); }
6945<CSAccessorDecl>"protected "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec.setProtectedSettable(true); }
6946<CSAccessorDecl>"private "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec.setPrivateGettable(true); }
6947<CSAccessorDecl>"protected "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec.setProtectedGettable(true); }
6948<CSAccessorDecl>"set" { if (yyextra->curlyCount==0) yyextra->current->spec.setSettable(true); }
6949<CSAccessorDecl>"get" { if (yyextra->curlyCount==0) yyextra->current->spec.setGettable(true); }
6950<CSAccessorDecl>"add" { if (yyextra->curlyCount==0) yyextra->current->spec.setAddable(true); }
6951<CSAccessorDecl>"remove" { if (yyextra->curlyCount==0) yyextra->current->spec.setRemovable(true); }
6952<CSAccessorDecl>"raise" { if (yyextra->curlyCount==0) yyextra->current->spec.setRaisable(true); }
6953<CSAccessorDecl>{CHARLIT} {}
6954<CSAccessorDecl>"\"" { BEGIN(CSString);}
6955<CSAccessorDecl>"." {}
6956<CSAccessorDecl>\n { lineCount(yyscanner); }
6957<CSString>"\"" { BEGIN(CSAccessorDecl);}
6958<CSString>{CPPC} {} // Otherwise the rule <*>"//" will kick in
6959<CSString>{CCS} {} // Otherwise the rule <*>"/*" will kick in
6960<CSString>\n { lineCount(yyscanner); }
6961<CSString>"." {}
6962
6963 /* ---- Slice-specific rules ------ */
6964
6965<SliceSequence>{SCOPENAME} {
6966 if (yyextra->current->spec.isLocal())
6967 {
6968 yyextra->current->type = "local ";
6969 }
6970 yyextra->current->type += "sequence<";
6971 yyextra->current->type += yytext;
6972 yyextra->current->type += ">";
6973 }
6974
6975<SliceSequence>{BN}*">"{BN}* {
6976 lineCount(yyscanner);
6977 BEGIN(SliceSequenceName);
6978 }
6979
6980<SliceSequenceName>{ID}{BN}* {
6981 lineCount(yyscanner);
6982 yyextra->current->name = yytext ;
6983 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
6984 }
6985
6986<SliceSequenceName>";" {
6987 yyextra->current->section = EntryType::makeVariable();
6988 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
6989 initEntry(yyscanner);
6990 BEGIN(FindMembers);
6991 }
6992
6993<SliceDictionary>{SCOPENAME}{BN}*","{BN}*{SCOPENAME} {
6994 lineCount(yyscanner);
6995 if (yyextra->current->spec.isLocal())
6996 {
6997 yyextra->current->type = "local ";
6998 }
6999 yyextra->current->type += "dictionary<";
7000 yyextra->current->type += yytext;
7001 yyextra->current->type += ">";
7002 yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
7003 }
7004
7005<SliceDictionary>{BN}*">"{BN}* {
7006 lineCount(yyscanner);
7007 BEGIN(SliceDictionaryName);
7008 }
7009
7010<SliceDictionaryName>{ID}{BN}* {
7011 lineCount(yyscanner);
7012 yyextra->current->name = yytext ;
7013 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
7014 }
7015
7016<SliceDictionaryName>";" {
7017 yyextra->current->section = EntryType::makeVariable();
7018 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
7019 initEntry(yyscanner);
7020 BEGIN(FindMembers);
7021 }
7022
7023 /**********************************************************************************/
7024 /******************** Documentation block related rules ***************************/
7025 /**********************************************************************************/
7026
7027 /* ---- Single line comments ------ */
7028<DocLine>[^\n]*"\n"[ \t]*{CPPC}[/!][<]? { // continuation of multiline C++-style comment
7029 int markerLen = yytext[yyleng-1]=='<' ? 4 : 3;
7030 yyextra->docBlock << std::string(yytext).substr(0,yyleng-markerLen);
7031 lineCount(yyscanner);
7032 }
7033<DocLine>{B}*{CPPC}"/"[/]+{Bopt}/"\n" { // ignore marker line (see bug700345)
7034 handleCommentBlock(yyscanner,yyextra->docBlock.str(),yyextra->current->brief.isEmpty());
7035 BEGIN( yyextra->docBlockContext );
7036 }
static void handleCommentBlock(yyscan_t yyscanner, const QCString &doc, bool brief)
7037<DocLine>{NONLopt}/"\n"{B}*{CPPC}[!/]{B}*{CMD}"}" { // next line is an end group marker, see bug 752712
7038 yyextra->docBlock << yytext;
7039 handleCommentBlock(yyscanner,yyextra->docBlock.str(),yyextra->current->brief.isEmpty());
7040 BEGIN( yyextra->docBlockContext );
7041 }
7042<DocLine>{NONLopt}/"\n" { // whole line
7043 yyextra->docBlock << yytext;
7044 handleCommentBlock(yyscanner,yyextra->docBlock.str(),yyextra->current->brief.isEmpty());
7045 BEGIN( yyextra->docBlockContext );
7046 }
7047
7048 /* ---- Comments blocks ------ */
7049
7050<DocBlock>"*"*{CCE} { // end of comment block
7051 handleCommentBlock(yyscanner,yyextra->docBlock.str(),FALSE);
7052 BEGIN(yyextra->docBlockContext);
7053 }
7054<DocBlock>"\\ilinebr "{B}*"*"/[^/] {
7055 QCString indent;
7056 indent.fill(' ',computeIndent(yytext+8,yyextra->column));
7057 yyextra->docBlock << "\\ilinebr " << indent;
7058 }
7059<DocBlock>^{B}*"*"+/[^/] {
7060 QCString indent;
7061 indent.fill(' ',computeIndent(yytext,yyextra->column));
7062 yyextra->docBlock << indent;
7063 }
7064<DocBlock>^{B}*({CPPC})?{B}*"*"+/[^/a-z_A-Z0-9*] { // start of a comment line
7065 QCString indent;
7066 indent.fill(' ',computeIndent(yytext,yyextra->column));
7067 yyextra->docBlock << indent;
7068 }
7069<DocBlock>^{B}*({CPPC}){B}* { // strip embedded C++ comments if at the start of a line
7070 }
7071<DocBlock>{CPPC} { // slashes in the middle of a comment block
7072 yyextra->docBlock << yytext;
7073 }
7074<DocBlock>{CCS} { // start of a new comment in the
7075 // middle of a comment block
7076 yyextra->docBlock << yytext;
7077 }
7078<DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] { // escaped command
7079 yyextra->docBlock << yytext;
7080 }
7081<DocBlock>{CMD}("f$"|"f["|"f{"|"f(") {
7082 yyextra->docBlock << yytext;
7083 char blockName[] = "f$";
7084 char c = yytext[2];
7085 if (c=='[') blockName[1]=']';
7086 else if (c=='{') blockName[1]='}';
7087 else if (c=='(') blockName[1]=')';
7088 startVerbatimBlock(yyscanner,blockName);
7089 BEGIN(DocCopyBlock);
7090 }
7091<DocBlock>{CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
7092 yyextra->fileName = &yytext[6];
7093 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
7094 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
7095 yyextra->docBlock << yytext;
7096 }
7097<DocBlock>{CMD}"ifile"{B}+{FILEMASK} {
7098 yyextra->fileName = &yytext[6];
7099 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
7100 yyextra->docBlock << yytext;
7101 }
7102<DocBlock>{CMD}"iline"{LINENR}{B} {
7103 bool ok = false;
7104 int nr = QCString(&yytext[6]).toInt(&ok);
7105 if (!ok)
7106 {
7107 warn(yyextra->fileName,yyextra->yyLineNr,"Invalid line number '{}' for iline command",yytext);
7108 }
7109 else
7110 {
7111 yyextra->yyLineNr = nr;
7112 }
7113 yyextra->docBlock << yytext;
7114 }
7115<DocBlock>{B}*"<"{PRE}">" {
7116 yyextra->docBlock << yytext;
7117 startVerbatimBlock(yyscanner,"<pre>");
7118 BEGIN(DocCopyBlock);
7119 }
7120<DocBlock>{CMD}"startuml"/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
7121 yyextra->docBlock << yytext;
7122 startVerbatimBlock(yyscanner,"uml");
7123 BEGIN(DocCopyBlock);
7124 }
7125<DocBlock>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
7126 yyextra->docBlock << yytext;
7127 startVerbatimBlock(yyscanner,&yytext[1]);
7128 BEGIN(DocCopyBlock);
7129 }
7130<DocBlock>"\\ilinebr "({B}*"*"+)?{B}{0,3}"~~~"[~]* {
7131 QCString pat = substitute(yytext+9,"*"," "); // skip over "\ilinebr " part
7132 yyextra->docBlock << "\\ilinebr ";
7133 yyextra->docBlock << pat;
7134 startVerbatimBlock(yyscanner,"~~~",pat.stripWhiteSpace().length());
7135 BEGIN(DocCopyBlock);
7136 }
7137<DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
7138 QCString pat = substitute(yytext,"*"," ");
7139 yyextra->docBlock << pat;
7140 startVerbatimBlock(yyscanner,"~~~",pat.stripWhiteSpace().length());
7141 BEGIN(DocCopyBlock);
7142 }
7143<DocBlock>"\\ilinebr "({B}*"*"+)?{B}{0,3}"```"[`]*/(".")?[a-zA-Z0-9#_-]+ |
7144<DocBlock>"\\ilinebr "({B}*"*"+)?{B}{0,3}"```"[`]*/"{"[^}]+"}" |
7145<DocBlock>"\\ilinebr "({B}*"*"+)?{B}{0,3}"```"[`]* {
7146 QCString pat = substitute(yytext+9,"*"," "); // skip over "\ilinebr " part
7147 yyextra->docBlock << "\\ilinebr ";
7148 yyextra->docBlock << pat;
7149 startVerbatimBlock(yyscanner,"```",pat.stripWhiteSpace().length());
7150 BEGIN(DocCopyBlock);
7151 }
7152<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]*/(".")?[a-zA-Z0-9#_-]+ |
7153<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]*/"{"[^}]+"}" |
7154<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
7155 QCString pat = substitute(yytext,"*"," ");
7156 yyextra->docBlock << pat;
7157 startVerbatimBlock(yyscanner,"```",pat.stripWhiteSpace().length());
7158 BEGIN(DocCopyBlock);
7159 }
7160<DocBlock>{B}*"<"{CODE}">" {
7161 if (yyextra->insideCS)
7162 {
7163 yyextra->docBlock << yytext;
7164 startVerbatimBlock(yyscanner,"<code>");
7165 BEGIN(DocCopyBlock);
7166 }
7167 else
7168 {
7169 REJECT;
7170 }
7171 }
7172<DocBlock>[^@*~\/\\\n]+ { // any character that isn't special
7173 yyextra->docBlock << yytext;
7174 }
7175<DocBlock>\n { // newline
7176 lineCount(yyscanner);
7177 yyextra->docBlock << *yytext;
7178 }
7179<DocBlock>. { // command block
7180 yyextra->docBlock << *yytext;
7181 }
7182
7183 /* ---- Copy verbatim sections ------ */
7184
7185<DocCopyBlock>"</"{PRE}">" { // end of a <pre> block
7186 if (endVerbatimBlock(yyscanner,"<pre>"))
7187 {
7188 BEGIN(DocBlock);
7189 }
7190 yyextra->docBlock << yytext;
7191 }
7192<DocCopyBlock>"</"{CODE}">" { // end of a <code> block
7193 if (endVerbatimBlock(yyscanner,"<code>"))
7194 {
7195 BEGIN(DocBlock);
7196 }
7197 yyextra->docBlock << yytext;
7198 }
7199<DocCopyBlock>[\\@]("f$"|"f]"|"f}"|"f)") {
7200 if (endVerbatimBlock(yyscanner,&yytext[1]))
7201 {
7202 BEGIN(DocBlock);
7203 }
7204 yyextra->docBlock << yytext;
7205 }
7206<DocCopyBlock>[\\@]("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block
7207 if (endVerbatimBlock(yyscanner,&yytext[4]))
7208 {
7209 BEGIN(DocBlock);
7210 }
7211 yyextra->docBlock << yytext;
7212 }
7213<DocCopyBlock>^{B}*"*"+/{BN}+ { // start of a comment line
7214 if ((yyextra->docBlockName=="verbatim") || (yyextra->docBlockName=="code") || (yyextra->docBlockName=="iliteral"))
7215 {
7216 REJECT;
7217 }
7218 else
7219 {
7220 QCString indent;
7221 indent.fill(' ',computeIndent(yytext,0));
7222 yyextra->docBlock << indent;
7223 }
7224 }
7225<DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* { // start of a comment line with two *'s
7226 if ((yyextra->docBlockName=="code") || (yyextra->docBlockName=="iliteral"))
7227 {
7228 QCString indent;
7229 indent.fill(' ',computeIndent(yytext,0));
7230 yyextra->docBlock << indent;
7231 }
7232 else
7233 {
7234 REJECT;
7235 }
7236 }
7237<DocCopyBlock>^{B}*"*"+/({ID}|"(") { // Assume *var or *(... is part of source code (see bug723516)
7238 if ((yyextra->docBlockName=="code") || (yyextra->docBlockName=="iliteral"))
7239 {
7240 QCString indent;
7241 indent.fill(' ',computeIndent(yytext,-1));
7242 yyextra->docBlock << indent+"*";
7243 }
7244 else
7245 {
7246 REJECT;
7247 }
7248 }
7249<DocCopyBlock>^{B}*"*"+/{BN}* { // start of a comment line with one *
7250 if ((yyextra->docBlockName=="code") || (yyextra->docBlockName=="iliteral"))
7251 {
7252 QCString indent;
7253 if (yyextra->nestedComment>0) // keep * it is part of the code
7254 {
7255 indent.fill(' ',computeIndent(yytext,-1));
7256 yyextra->docBlock << indent+"*";
7257 }
7258 else // remove * it is part of the comment block
7259 {
7260 indent.fill(' ',computeIndent(yytext,0));
7261 yyextra->docBlock << indent;
7262 }
7263 }
7264 else
7265 {
7266 REJECT;
7267 }
7268 }
7269<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
7270 QCString pat = substitute(yytext,"*"," ");
7271 if (endVerbatimBlock(yyscanner,"~~~",pat.stripWhiteSpace().length()))
7272 {
7273 BEGIN(DocBlock);
7274 }
7275 yyextra->docBlock << pat;
7276 }
7277<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
7278 QCString pat = substitute(yytext,"*"," ");
7279 if (endVerbatimBlock(yyscanner,"```",pat.stripWhiteSpace().length()))
7280 {
7281 BEGIN(DocBlock);
7282 }
7283 yyextra->docBlock << pat;
7284 }
7285<DocCopyBlock>[^<@/\*\]~"\$\\\n]+ { // any character that is not special
7286 yyextra->docBlock << yytext;
7287 }
7288<DocCopyBlock>\" {
7289 yyextra->docBlock << yytext;
7290 if (yyextra->docBlockName=="code" || yyextra->docBlockName=="iliteral")
7291 // to support end of comment character sequences inside
7292 // a string literal of a code block, see #6737
7293 {
7294 yyextra->lastStringContext=YY_START;
7295 yyextra->pCopyQuotedGString=&yyextra->docBlock;
7296 yyextra->stopAtInvalidString=true;
7297 BEGIN(CopyGString);
7298 }
7299 }
7300<DocCopyBlock>{CCS}|{CCE}|{CPPC} {
7301 if (yytext[1]=='*')
7302 {
7303 yyextra->nestedComment++;
7304 }
7305 else if (yytext[0]=='*' && yyextra->nestedComment>0)
7306 {
7307 yyextra->nestedComment--;
7308 }
7309 yyextra->docBlock << yytext;
7310 }
7311<DocCopyBlock>\n { // newline
7312 yyextra->docBlock << *yytext;
7313 lineCount(yyscanner);
7314 }
7315<DocCopyBlock>. { // any other character
7316 yyextra->docBlock << *yytext;
7317 }
7318<DocCopyBlock><<EOF>> {
7319 warn(yyextra->fileName,yyextra->yyLineNr,
7320 "reached end of file while inside a '{}' block!"
7321 " The command that should end the block seems to be missing!",
7322 yyextra->docBlockName);
7323 yyterminate();
7324 }
#define yyterminate()
7325
7326
7327 /* ------------- Prototype parser -------------- */
7328
7329<Prototype>"operator"{B}*"("{B}*")" {
7330 yyextra->current->name+=yytext;
7331 }
7332<Prototype>"(" {
7333 yyextra->current->args+=*yytext;
7334 yyextra->currentArgumentContext = PrototypeQual;
7335 yyextra->fullArgString = yyextra->current->args;
7336 yyextra->copyArgString = &yyextra->current->args;
7337 BEGIN( ReadFuncArgType ) ;
7338 }
7339<Prototype>"("({ID}"::")*({B}*[&*])+ {
7340 if (yyextra->insidePHP) // reference parameter
7341 {
7342 REJECT;
7343 }
7344 else
7345 {
7346 yyextra->current->type+=yyextra->current->name+yytext;
7347 yyextra->current->name.clear();
7348 BEGIN( PrototypePtr );
7349 }
7350 }
7351<PrototypePtr>{SCOPENAME} {
7352 yyextra->current->name+=yytext;
7353 }
7354<PrototypePtr>"(" {
7355 yyextra->current->args+=*yytext;
7356 yyextra->currentArgumentContext = PrototypeQual;
7357 yyextra->fullArgString = yyextra->current->args;
7358 yyextra->copyArgString = &yyextra->current->args;
7359 BEGIN( ReadFuncArgType ) ;
7360 }
7361<PrototypePtr>")" {
7362 yyextra->current->type+=')';
7363 BEGIN( Prototype );
7364 }
7365<PrototypePtr>. {
7366 yyextra->current->name+=yytext;
7367 }
7368<PrototypeQual>"{" {
7369 BEGIN( PrototypeSkipLine);
7370 }
7371<PrototypeQual>{B}*"const"{B}* {
7372 yyextra->current->args += " const ";
7373 yyextra->current->argList.setConstSpecifier(TRUE);
7374 }
7375<PrototypeQual>{B}*"volatile"{B}* {
7376 yyextra->current->args += " volatile ";
7377 yyextra->current->argList.setVolatileSpecifier(TRUE);
7378 }
7379<PrototypeQual>{B}*"="{B}*"0"{B}* {
7380 yyextra->current->args += " = 0";
7381 yyextra->current->virt = Specifier::Pure;
7382 yyextra->current->argList.setPureSpecifier(TRUE);
7383 }
7384<PrototypeQual>"throw"{B}*"(" {
7385 yyextra->current->exception = "throw(";
7386 BEGIN(PrototypeExc);
7387 }
7388<PrototypeExc>")" {
7389 yyextra->current->exception += ')';
7390 BEGIN(PrototypeQual);
7391 }
7392<PrototypeExc>. {
7393 yyextra->current->exception += *yytext;
7394 }
7395<PrototypeQual>. {
7396 yyextra->current->args += *yytext;
7397 }
7398<Prototype>. {
7399 yyextra->current->name += *yytext;
7400 }
7401<PrototypeSkipLine>. {
7402 }
7403
7404
7405
7406
7407<SkipCxxComment>.*"\\\n" { // line continuation
7408 if (yyextra->insideCS)
7409 {
7410 REJECT;
7411 }
7412 else
7413 {
7414 lineCount(yyscanner);
7415 }
7416 }
7417<SkipCxxComment>{ANYopt}/\n {
7418 BEGIN( yyextra->lastCContext ) ;
7419 }
7420<SkipComment>[^\*\n]+
7421
7422 /* ------------ Generic rules -------------- */
7423
7424<*>"[[" { // C++11 attribute
7425 if (!yyextra->insideCpp) REJECT;
7426 if (YY_START == CopyGString || YY_START == CopyGString) REJECT;
7427 yyextra->lastC11AttributeContext = YY_START;
7428 BEGIN( SkipC11Attribute );
7429 }
7430
7431<*>\n { lineCount(yyscanner); }
7432<*>\" {
7433 if (yyextra->insideIDL && yyextra->insideCppQuote)
7434 {
7435 BEGIN(EndCppQuote);
7436 }
7437 else if (yyextra->insidePHP)
7438 {
7439 yyextra->lastStringContext=YY_START;
7440 BEGIN(SkipString);
7441 }
7442 }
7443<*>^{B}*"#" {
7444 if (!yyextra->insidePHP)
7445 {
7446 yyextra->lastCPPContext = YY_START;
7447 BEGIN( SkipCPP ) ;
7448 }
7449 else
7450 {
7451 yyextra->lastCContext = YY_START ;
7452 BEGIN( SkipCxxComment ) ;
7453 }
7454 }
7455<*>"#" {
7456 if (!yyextra->insidePHP)
7457 REJECT;
7458 yyextra->lastCContext = YY_START ;
7459 BEGIN( SkipCxxComment ) ;
7460 }
7461<*>\' {
7462 if (yyextra->insidePHP)
7463 {
7464 yyextra->lastStringContext=YY_START;
7465 BEGIN(SkipPHPString);
7466 }
7467 }
7468<*>\? {
7469 if (yyextra->insideCS && (YY_START != SkipRound) && (YY_START != CSAccessorDecl))
7470 {
7471 if (yyextra->current->type.isEmpty())
7472 {
7473 if (yyextra->current->name.isEmpty())
7474 yyextra->current->name="?";
7475 else
7476 yyextra->current->name+="?";
7477 }
7478 else
7479 {
7480 yyextra->current->type+="?";
7481 }
7482 }
7483 }
7484<*>"}" { yyextra->exported=false; }
7485<*>.
7486<SkipComment>{CPPC}|{CCS}
7487<*>{CCS} { yyextra->lastCContext = YY_START ;
7488 BEGIN( SkipComment ) ;
7489 }
7490<SkipComment>{B}*{CCE} { BEGIN( yyextra->lastCContext ) ; }
7491<*>{CPPC} {
7492 yyextra->lastCContext = YY_START ;
7493 BEGIN( SkipCxxComment ) ;
7494 }
7495<<EOF>> {
7496 if (yyextra->insideCS && yyextra->fakeNS)
7497 {
7498 yyextra->fakeNS--;
7499 unput('}');
7500 BEGIN ( ReadNSBody);
7501 }
7502 else
7503 {
7504 yyterminate();
7505 }
7506 }
7507%%
7508
7509//----------------------------------------------------------------------------
7510static int yyread(yyscan_t yyscanner,char *buf,int max_size)
7511{
7512 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7513 int c=0;
7514 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7515 {
7516 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7517 //printf("%d (%c)\n",*buf,*buf);
7518 c++; buf++;
7519 }
7520 return c;
7521}
7522
7523
7524static void initParser(yyscan_t yyscanner)
7525{
7526 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7527 yyextra->outerScopeEntries.clear();
7528 yyextra->baseName.clear();
7529 yyextra->protection = Protection::Public;
7530 yyextra->baseProt = Protection::Public;
7531 yyextra->sharpCount = 0;
7532 yyextra->roundCount = 0;
7533 yyextra->curlyCount = 0;
7534 yyextra->mtype = MethodTypes::Method;
7535 yyextra->isStatic = FALSE;
7536 yyextra->virt = Specifier::Normal;
7537 yyextra->baseVirt = Specifier::Normal;
7538 yyextra->isTypedef = FALSE;
7539 yyextra->insideTryBlock = FALSE;
7540 yyextra->insideFormula = FALSE;
7541 yyextra->insideCode=FALSE;
7542 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
7543 yyextra->previous = 0;
7544 yyextra->firstTypedefEntry.reset();
7545 yyextra->memspecEntry.reset();
7546}
7547
7548static void initEntry(yyscan_t yyscanner)
7549{
7550 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7551 if (yyextra->insideJava)
7552 {
7553 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
7554 }
7555 yyextra->current->protection = yyextra->protection;
7556 yyextra->current->exported = yyextra->exported ;
7557 yyextra->current->mtype = yyextra->mtype;
7558 yyextra->current->virt = yyextra->virt;
7559 yyextra->current->isStatic = yyextra->isStatic;
7560 yyextra->current->lang = yyextra->language;
7561 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
7562 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
7563 yyextra->isTypedef=FALSE;
7564}
7565
7566
7567//-----------------------------------------------------------------------------
7568
7569static void storeClangId(yyscan_t yyscanner,const char *id)
7570{
7571 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7572 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
7573 {
7574 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
7575 }
7576}
7577
7578static void lineCount(yyscan_t yyscanner)
7579{
7580 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7581 int tabSize = Config_getInt(TAB_SIZE);
7582 const char *p;
7583 for (p = yytext ; *p ; ++p )
7584 {
7585 if (*p=='\n')
7586 {
7587 yyextra->yyLineNr++,yyextra->column=0,yyextra->yyColNr=1;
7588 }
7589 else if (*p=='\t')
7590 {
7591 yyextra->column+=tabSize - (yyextra->column%tabSize);
7592 }
7593 else
7594 {
7595 yyextra->column++,yyextra->yyColNr++;
7596 }
7597 }
7598 //printf("lineCount()=%d\n",yyextra->column);
7599}
7600
7601static inline int computeIndent(const char *s,int startIndent)
7602{
7603 int col=startIndent;
7604 int tabSize=Config_getInt(TAB_SIZE);
7605 const char *p=s;
7606 char c;
7607 while ((c=*p++))
7608 {
7609 if (c=='\t') col+=tabSize-(col%tabSize);
7610 else if (c=='\n') col=0;
7611 else col++;
7612 }
7613 return col;
7614}
7615
7616static QCString extractBeginRawStringDelimiter(const char *rawStart)
7617{
7618 QCString text=rawStart;
7619 int i = text.find('"');
7620 assert(i!=-1);
7621 return text.mid(i+1,text.length()-i-2); // text=...R"xyz( -> delimiter=xyz
7622}
7623
7624static QCString extractEndRawStringDelimiter(const char *rawEnd)
7625{
7626 QCString text=rawEnd;
7627 return text.mid(1,text.length()-2); // text=)xyz" -> delimiter=xyz
7628}
7629
7630static inline void initMethodProtection(yyscan_t yyscanner,Protection prot)
7631{
7632 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7633 yyextra->current->protection = yyextra->protection = prot;
7634 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
7635 yyextra->current->type.clear();
7636 yyextra->current->name.clear();
7637 yyextra->current->args.clear();
7638 yyextra->current->argList.clear();
7639 lineCount(yyscanner) ;
7640}
7641
7642static void addType(yyscan_t yyscanner)
7643{
7644 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7645 size_t tl=yyextra->current->type.length();
7646 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7647 {
7648 yyextra->current->type += ' ' ;
7649 }
7650 yyextra->current->type += yyextra->current->name;
7651 yyextra->current->name.clear() ;
7652 tl=yyextra->current->type.length();
7653 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7654 {
7655 yyextra->current->type += ' ' ;
7656 }
7657 yyextra->current->type += yyextra->current->args ;
7658 yyextra->current->args.clear() ;
7659 yyextra->current->argList.clear();
7660}
7661
7662
7663static QCString stripQuotes(const char *s)
7664{
7665 QCString name;
7666 if (s==nullptr || *s==0) return name;
7667 name=s;
7668 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
7669 {
7670 name=name.mid(1,name.length()-2);
7671 }
7672 return name;
7673}
7674
7675static QCString stripFuncPtr(const QCString &type)
7676{
7677 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
7678 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
7679 size_t i=type.length();
7680 bool funcPtr = i>0 && type[i-1]==')';
7681 if (funcPtr) i--;
7682 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
7683 if (funcPtr && i>0 && type[i-1]=='(') i--;
7684 return type.left(i);
7685}
7686
7687//-----------------------------------------------------------------
7688static void startVerbatimBlock(yyscan_t yyscanner,const QCString &blockName,size_t fencedSize)
7689{
7690 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7691 if (Config_getBool(MARKDOWN_SUPPORT))
7692 {
7693 yyextra->docBlock << "\\iskip";
7694 }
7695 yyextra->docBlockName=blockName;
7696 yyextra->fencedSize=fencedSize;
7697 yyextra->nestedComment=0;
7698}
7699
7700//-----------------------------------------------------------------
7701static bool endVerbatimBlock(yyscan_t yyscanner,const QCString &blockName,size_t fencedSize)
7702{
7703 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7704 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
7705 {
7706 if (Config_getBool(MARKDOWN_SUPPORT))
7707 {
7708 yyextra->docBlock << "\\endiskip";
7709 }
7710 yyextra->docBlockName="";
7711 return true;
7712 }
7713 return false;
7714}
7715
7716//-----------------------------------------------------------------
7717
7718// return TRUE iff req holds the start of a requires expression
7719// or sub-expression without parenthesis, i.e. req is empty or ends with || or &&
7721{
7722 QCString r = req.stripWhiteSpace();
7723 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
7724}
7725
7726//-----------------------------------------------------------------
7727
7728static bool nameIsOperator(QCString &name)
7729{
7730 int i=name.find("operator");
7731 if (i==-1) return FALSE;
7732 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
7733 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
7734 return FALSE; // case TEXToperatorTEXT
7735}
7736
7737//-----------------------------------------------------------------------------
7738
7739static void setContext(yyscan_t yyscanner)
7740{
7741 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7742 yyextra->language = getLanguageFromFileName(yyextra->fileName);
7743 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
7744 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
7745 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
7746 yyextra->insideD = yyextra->language==SrcLangExt::D;
7747 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
7748 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
7749 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
7750 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
7751 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
7752 yyextra->language==SrcLangExt::Lex);
7753 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
7754 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
7755 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
7756 // );
7757}
7758
7759//-----------------------------------------------------------------------------
7760
7761static void prependScope(yyscan_t yyscanner)
7762{
7763 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7764 if (yyextra->current_root->section.isScope())
7765 {
7766 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
7767 yyextra->current->name.prepend(yyextra->current_root->name+"::");
7768 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
7769 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
7770 {
7771 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
7772 }
7773 }
7774}
7775
7776//-----------------------------------------------------------------------------
7777
7778/*! Returns TRUE iff the yyextra->current entry could be a K&R style C function */
7779static bool checkForKnRstyleC(yyscan_t yyscanner)
7780{
7781 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7782 if (!yyextra->fileName.lower().endsWith(".c")) return FALSE; // must be a C file
7783 if (yyextra->current->argList.empty()) return FALSE; // must have arguments
7784 for (const Argument &a : yyextra->current->argList)
7785 {
7786 // in K&R style argument do not have a type, but doxygen expects a type
7787 // so it will think the argument has no name
7788 if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE;
7789 }
7790 return TRUE;
7791}
7792
7793static void setJavaProtection(yyscan_t yyscanner)
7794{
7795 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7796 if (yyextra->insideJava)
7797 {
7798 QCString text=yytext;
7799 yyextra->current->protection = Protection::Public;
7800 if (text.find("protected")!=-1)
7801 yyextra->current->protection = Protection::Protected;
7802 else if (text.find("private")!=-1)
7803 yyextra->current->protection = Protection::Private;
7804 else if (text.find("package")!=-1)
7805 yyextra->current->protection = Protection::Package;
7806 }
7807}
7808//-----------------------------------------------------------------------------
7809
7810static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &oldStyleArgName)
7811{
7812 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7813 int si = static_cast<int>(yyextra->current->args.length());
7814 if (yyextra->oldStyleArgType.isEmpty()) // new argument
7815 {
7816 std::string args = yyextra->current->args.str();
7817 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
7818 int bi1=-1;
7819 int bi2=-1;
7820 reg::Match match;
7821 if (reg::search(args,match,re))
7822 {
7823 bi1=(int)match.position();
7824 size_t secondMatchStart = match.position()+match.length(); // search again after first match
7825 if (reg::search(args,match,re,secondMatchStart))
7826 {
7827 bi2=(int)match.position();
7828 }
7829 }
7830 char c;
7831 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
7832 {
7833 int s=bi2+1; // keep opening (
7834 yyextra->oldStyleArgType = yyextra->current->args.left(s);
7835 int i=s;
7836 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
7837 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
7838 s=i;
7839 while (i<si && isId(yyextra->current->args.at(i))) i++;
7840 oldStyleArgName = yyextra->current->args.mid(s,i-s);
7841 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
7842 }
7843 else if (bi1!=-1) // redundant braces like in "int (*var)"
7844 {
7845 int s=bi1; // strip opening (
7846 yyextra->oldStyleArgType = yyextra->current->args.left(s);
7847 s++;
7848 int i=s+1;
7849 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
7850 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
7851 s=i;
7852 while (i<si && isId(yyextra->current->args.at(i))) i++;
7853 oldStyleArgName = yyextra->current->args.mid(s,i-s);
7854 }
7855 else // normal "int *var"
7856 {
7857 int l=si,i=l-1,j;
7858 // look for start of name in "type *name"
7859 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
7860 j=i+1;
7861 // look for start of *'s
7862 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
7863 i++;
7864 if (i!=l)
7865 {
7866 yyextra->oldStyleArgType=yyextra->current->args.left(i);
7867 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
7868 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
7869 }
7870 else
7871 {
7872 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
7873 }
7874 }
7875 }
7876 else // continuation like *arg2 in "int *args,*arg2"
7877 {
7878 int l=si,j=0;
7879 char c;
7880 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
7881 if (j>0)
7882 {
7883 oldStyleArgPtr=yyextra->current->args.left(j);
7884 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
7885 }
7886 else
7887 {
7888 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
7889 }
7890 }
7891}
7892
7893//-----------------------------------------------------------------------------
7894
7895/*! Update the argument \a name with additional \a type info. For K&R style
7896 * function the type is found \e after the argument list, so this routine
7897 * in needed to fix up.
7898 */
7899static void addKnRArgInfo(yyscan_t yyscanner,const QCString &type,const QCString &name,
7900 const QCString &brief,const QCString &docs)
7901{
7902 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7903 for (Argument &a : yyextra->current->argList)
7904 {
7905 if (a.type==name)
7906 {
7907 a.type=type.stripWhiteSpace();
7908 a.type.stripPrefix("register ");
7909 a.name=name.stripWhiteSpace();
7910 if (!brief.isEmpty() && !docs.isEmpty())
7911 {
7912 a.docs=brief+"\n\n"+docs;
7913 }
7914 else if (!brief.isEmpty())
7915 {
7916 a.docs=brief;
7917 }
7918 else
7919 {
7920 a.docs=docs;
7921 }
7922 }
7923 }
7924}
7925
7926//-----------------------------------------------------------------------------
7927
7929{
7930 for (Argument &a : al)
7931 {
7932 if (!a.type.isEmpty() && a.name.isEmpty())
7933 { // a->type is actually the (typeless) parameter name, so move it
7934 a.name=a.type;
7935 a.type.clear();
7936 }
7937 }
7938}
7939
7940//-----------------------------------------------------------------------------
7941
7942static void startCommentBlock(yyscan_t yyscanner,bool brief)
7943{
7944 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7945 if (brief)
7946 {
7947 yyextra->current->briefFile = yyextra->fileName;
7948 yyextra->current->briefLine = yyextra->yyLineNr;
7949 }
7950 else
7951 {
7952 yyextra->current->docFile = yyextra->fileName;
7953 yyextra->current->docLine = yyextra->yyLineNr;
7954 }
7955}
7956
7957//----------------------------------------------------------------------------
7958
7959static void newEntry(yyscan_t yyscanner)
7960{
7961 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7962 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
7963 // and yyextra->current is actually replaced by yyextra->previous which was
7964 // already added to yyextra->current_root, so we should not add it again
7965 // (see bug723314)
7966 {
7967 yyextra->previous = yyextra->current;
7968 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
7969 }
7970 else
7971 {
7972 yyextra->previous = yyextra->current;
7973 yyextra->current = yyextra->tempEntry;
7974 yyextra->tempEntry.reset();
7975 }
7976 initEntry(yyscanner);
7977}
7978
7979static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief)
7980{
7981 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7982 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
7983 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
7984 if (yyextra->docBlockInBody && hideInBodyDocs) return;
7985 int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine; // line of block start
7986
7987 // fill in inbodyFile && inbodyLine the first time, see bug 633891
7988 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
7989 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
7990 {
7991 docEntry->inbodyFile = yyextra->fileName;
7992 docEntry->inbodyLine = lineNr;
7993 }
7994
7995 int position=0;
7996 bool needsEntry=FALSE;
7997 GuardedSectionStack guards;
7998 Markdown markdown(yyextra->fileName,lineNr);
7999 QCString strippedDoc = stripIndentation(doc);
8000 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8001 while (yyextra->commentScanner.parseCommentBlock(
8002 yyextra->thisParser,
8003 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8004 processedDoc, // text
8005 yyextra->fileName, // file
8006 lineNr, // line of block start
8007 yyextra->docBlockInBody ? FALSE : brief, // isBrief
8008 yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
8009 yyextra->docBlockInBody, // isInBody
8010 yyextra->protection,
8011 position,
8012 needsEntry,
8013 Config_getBool(MARKDOWN_SUPPORT),
8014 &guards
8015 )
8016 )
8017 {
8018 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8019 if (needsEntry)
8020 {
8021 QCString docFile = yyextra->current->docFile;
8022 newEntry(yyscanner);
8023 yyextra->current->docFile = docFile;
8024 yyextra->current->docLine = lineNr;
8025 }
8026 }
8027 if (needsEntry)
8028 {
8029 newEntry(yyscanner);
8030 }
8031
8032 if (yyextra->docBlockTerm)
8033 {
8034 unput(yyextra->docBlockTerm);
8035 yyextra->docBlockTerm=0;
8036 }
8037}
8038
8040{
8041 AUTO_TRACE();
8042 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8043 for (Argument &a : al)
8044 {
8045 AUTO_TRACE_ADD("Param '{}' docs='{}'",a.name,Trace::trunc(a.docs));
8046 if (!a.docs.isEmpty())
8047 {
8048 if (a.name.isEmpty() && a.type == "...") a.name= "...";
8049 int position=0;
8050 bool needsEntry;
8051
8052 // save context
8053 QCString orgDoc = yyextra->current->doc;
8054 QCString orgBrief = yyextra->current->brief;
8055 int orgDocLine = yyextra->current->docLine;
8056 int orgBriefLine = yyextra->current->briefLine;
8057
8058 yyextra->current->doc.clear();
8059 yyextra->current->brief.clear();
8060
8061 //printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
8062 int lineNr = orgDocLine;
8063 GuardedSectionStack guards;
8064 Markdown markdown(yyextra->fileName,lineNr);
8065 QCString strippedDoc = stripIndentation(a.docs);
8066 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8067 while (yyextra->commentScanner.parseCommentBlock(
8068 yyextra->thisParser,
8069 yyextra->current.get(),
8070 processedDoc, // text
8071 yyextra->fileName, // file
8072 lineNr,
8073 FALSE,
8074 FALSE,
8075 FALSE,
8076 yyextra->protection,
8077 position,
8078 needsEntry,
8079 Config_getBool(MARKDOWN_SUPPORT),
8080 &guards
8081 )
8082 )
8083 {
8084 //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8085 if (needsEntry) newEntry(yyscanner);
8086 }
8087 if (needsEntry)
8088 {
8089 newEntry(yyscanner);
8090 }
8091 a.docs = yyextra->current->doc;
8092
8093 // restore context
8094 yyextra->current->doc = orgDoc;
8095 yyextra->current->brief = orgBrief;
8096 yyextra->current->docLine = orgDocLine;
8097 yyextra->current->briefLine = orgBriefLine;
8098 }
8099 }
8100}
8101
8102
8103//----------------------------------------------------------------------------
8104
8105static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt)
8106{
8107 AUTO_TRACE("name={}",rt->name);
8108 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8109 for (const auto &ce : rt->children())
8110 {
8111 if (!ce->program.empty())
8112 {
8113 AUTO_TRACE_ADD("compound name='{}' program='{}'",Trace::trunc(ce->name),Trace::trunc(ce->program.str()));
8114 // init scanner state
8115 yyextra->padCount=0;
8116 //depthIf = 0;
8117 yyextra->column=0;
8118 yyextra->programStr = ce->program.str();
8119 yyextra->inputString = yyextra->programStr.data();
8120 yyextra->inputPosition = 0;
8121 if (ce->section.isEnum() || ce->spec.isEnum())
8122 BEGIN( FindFields ) ;
8123 else
8124 BEGIN( FindMembers ) ;
8125 yyextra->current_root = ce;
8126 yyextra->fileName = ce->fileName;
8127 //setContext();
8128 yyextra->yyLineNr = ce->bodyLine;
8129 yyextra->yyColNr = ce->bodyColumn;
8130 yyextra->insideObjC = ce->lang==SrcLangExt::ObjC;
8131 //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
8132 yyextra->current = std::make_shared<Entry>();
8133 yyextra->isStatic = FALSE;
8134 initEntry(yyscanner);
8135
8136 // deep copy group list from parent (see bug 727732)
8137 bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
8138 if (autoGroupNested && !rt->groups.empty() && !ce->section.isEnum() && !ce->spec.isEnum())
8139 {
8140 ce->groups = rt->groups;
8141 }
8142
8143 int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2;
8144 // set default protection based on the compound type
8145 if ( ce->section.isClass() ) // class
8146 {
8147 if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
8148 {
8149 yyextra->current->protection = yyextra->protection = Protection::Public ;
8150 }
8151 else if (yyextra->insideJava)
8152 {
8153 yyextra->current->protection = yyextra->protection = (ce->spec.isInterface() || ce->spec.isEnum()) ? Protection::Public : Protection::Package;
8154 }
8155 else if (ce->spec.isInterface() || ce->spec.isRef() || ce->spec.isValue() || ce->spec.isStruct() || ce->spec.isUnion())
8156 {
8157 if (ce->lang==SrcLangExt::ObjC)
8158 {
8159 yyextra->current->protection = yyextra->protection = Protection::Protected ;
8160 }
8161 else
8162 {
8163 yyextra->current->protection = yyextra->protection = Protection::Public ;
8164 }
8165 }
8166 else
8167 {
8168 yyextra->current->protection = yyextra->protection = Protection::Private ;
8169 }
8170 }
8171 else if (ce->section.isEnum() ) // enum
8172 {
8173 yyextra->current->protection = yyextra->protection = ce->protection;
8174 }
8175 else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
8176 {
8177 if (ce->section.isNamespace() ) // unnamed namespace
8178 {
8179 yyextra->current->isStatic = yyextra->isStatic = TRUE;
8180 }
8181 yyextra->current->protection = yyextra->protection = ce->protection;
8182 yyextra->current->exported = yyextra->exported = false;
8183 }
8184 else if (ce->section.isNamespace() )
8185 {
8186 yyextra->current->protection = yyextra->protection = Protection::Public ;
8187 yyextra->current->exported = yyextra->exported = ce->exported;
8188 }
8189 else // named struct, union, protocol, category
8190 {
8191 yyextra->current->protection = yyextra->protection = Protection::Public ;
8192 yyextra->current->exported = yyextra->exported = false;
8193 }
8194 yyextra->mtype = MethodTypes::Method;
8195 yyextra->virt = Specifier::Normal;
8196 //printf("name=%s yyextra->current->isStatic=%d yyextra->isStatic=%d\n",qPrint(ce->name),yyextra->current->isStatic,yyextra->isStatic);
8197
8198 //memberGroupId = DOX_NOGROUP;
8199 //memberGroupRelates.clear();
8200 //memberGroupInside.clear();
8201 QCString name = ce->name;
8202 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
8203
8204 scannerYYlex(yyscanner);
8205 yyextra->lexInit=TRUE;
8206 //forceEndGroup();
8207
8208 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
8209
8210 yyextra->programStr.clear();
8211 ce->program.str(std::string());
8212
8213
8214 //if (depthIf>0)
8215 //{
8216 // warn(yyextra->fileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
8217 //}
8218 }
8219 parseCompounds(yyscanner,ce);
8220 }
8221}
8222
8223//----------------------------------------------------------------------------
8224
8225static void parseMain(yyscan_t yyscanner,
8226 const QCString &fileName,
8227 const char *fileBuf,
8228 const std::shared_ptr<Entry> &rt,
8229 ClangTUParser *clangParser)
8230{
8231 AUTO_TRACE("fileName={}",fileName);
8232 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8233 initParser(yyscanner);
8234
8235 yyextra->inputString = fileBuf;
8236 yyextra->inputPosition = 0;
8237 yyextra->column = 0;
8238 scannerYYrestart(nullptr,yyscanner);
8239
8240 //depthIf = 0;
8241 yyextra->protection = Protection::Public;
8242 yyextra->mtype = MethodTypes::Method;
8243 yyextra->isStatic = FALSE;
8244 yyextra->exported = false;
8245 yyextra->virt = Specifier::Normal;
8246 yyextra->current_root = rt;
8247 yyextra->yyLineNr = 1 ;
8248 yyextra->yyBegLineNr = 1;
8249 yyextra->yyBegColNr = 0;
8250 yyextra->anonCount = 0;
8251 yyextra->anonNSCount = 0;
8252 yyextra->fileName = fileName;
8253 yyextra->clangParser = clangParser;
8254 setContext(yyscanner);
8255 rt->lang = yyextra->language;
8256 msg("Parsing file {}...\n",yyextra->fileName);
8257
8258 yyextra->current_root = rt;
8259 initParser(yyscanner);
8260 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
8261 yyextra->current = std::make_shared<Entry>();
8262 //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
8263 EntryType sec=guessSection(yyextra->fileName);
8264 if (!sec.isEmpty())
8265 {
8266 yyextra->current->name = yyextra->fileName;
8267 yyextra->current->section = sec;
8268 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8269 }
8270 yyextra->current->reset();
8271 initEntry(yyscanner);
8272 if ( yyextra->insidePHP )
8273 {
8274 BEGIN( FindMembersPHP );
8275 }
8276 else if ( yyextra->insideJava ) // add default java.lang package scope
8277 {
8278 yyextra->current->name="java::lang"; // '::' is used in doxygen's internal representation as a scope separator
8279 yyextra->current->fileName = yyextra->fileName;
8280 yyextra->current->section = EntryType::makeUsingDir();
8281 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8282 initEntry(yyscanner);
8283 BEGIN( FindMembers );
8284 }
8285 else
8286 {
8287 BEGIN( FindMembers );
8288 }
8289
8290 scannerYYlex(yyscanner);
8291 yyextra->lexInit=TRUE;
8292
8293 if (YY_START==Comment)
8294 {
8295 warn(yyextra->fileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?");
8296 }
8297
8298 //forceEndGroup();
8299 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
8300
8301 yyextra->programStr.clear();
8302 rt->program.str(std::string());
8303
8304 parseCompounds(yyscanner,rt);
8305
8306 yyextra->anonNSCount++;
8307
8308 // add additional entries that were created during processing
8309 for (auto &[parent,child]: yyextra->outerScopeEntries)
8310 {
8311 //printf(">>> adding '%s' to scope '%s'\n",qPrint(child->name),qPrint(parent->name));
8312 parent->moveToSubEntryAndKeep(child);
8313 }
8314 yyextra->outerScopeEntries.clear();
8315
8316}
8317
8318//----------------------------------------------------------------------------
8319
8320static void parsePrototype(yyscan_t yyscanner,const QCString &text)
8321{
8322 AUTO_TRACE("text='{}'",Trace::trunc(text));
8323 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8324 if (text.isEmpty())
8325 {
8326 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8327 return;
8328 }
8329 if (!yyextra->current) // nothing to store (see bug683516)
8330 {
8331 return;
8332 }
8333
8334 const char *orgInputString;
8335 int orgInputPosition;
8336 YY_BUFFER_STATE orgState;
8337
8338 // save scanner state
8339 orgState = YY_CURRENT_BUFFER;
8340 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8341 orgInputString = yyextra->inputString;
8342 orgInputPosition = yyextra->inputPosition;
8343
8344 // set new string
8345 yyextra->inputString = text.data();
8346 yyextra->inputPosition = 0;
8347 yyextra->column = 0;
8348 scannerYYrestart(nullptr, yyscanner);
8349 BEGIN(Prototype);
8350 scannerYYlex(yyscanner);
8351 yyextra->lexInit=TRUE;
8352
8353 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8354 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.isEmpty())
8355 {
8356 yyextra->current->section = EntryType::makeVariableDoc();
8357 }
8358
8359 // restore original scanner state
8360 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8361 yy_switch_to_buffer(orgState, yyscanner);
8362 yyextra->inputString = orgInputString;
8363 yyextra->inputPosition = orgInputPosition;
8364
8365
8366 //printf("**** parsePrototype end\n");
8367}
8368
8369//----------------------------------------------------------------------------
8370
8376
8378{
8379 scannerYYlex_init_extra(&p->state,&p->yyscanner);
8380#ifdef FLEX_DEBUG
8381 scannerYYset_debug(Debug::isFlagSet(Debug::Lex_scanner)?1:0,p->yyscanner);
8382#endif
8383}
8384
8386{
8387 scannerYYlex_destroy(p->yyscanner);
8388}
8389
8391 const char *fileBuf,
8392 const std::shared_ptr<Entry> &root,
8393 ClangTUParser *clangParser)
8394{
8395 AUTO_TRACE();
8396 struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
8397 yyextra->thisParser = this;
8398
8399 DebugLex debugLex(Debug::Lex_scanner, __FILE__, qPrint(fileName));
8400
8401 ::parseMain(p->yyscanner,fileName,fileBuf,root,clangParser);
8402}
8403
8404
8406{
8407 QCString fe=extension.lower();
8408 SrcLangExt lang = getLanguageFromFileName(extension);
8409 return (SrcLangExt::Cpp == lang) || (SrcLangExt::Lex == lang) ||
8410 !( fe==".java" || fe==".as" || fe==".d" || fe==".php" ||
8411 fe==".php4" || fe==".inc" || fe==".phtml"|| fe==".php5"
8412 );
8413}
8414
8416{
8417 ::parsePrototype(p->yyscanner,text);
8418}
8419
8420//----------------------------------------------------------------------------
8421
8422#include "scanner.l.h"
void parseInput(const QCString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &root, ClangTUParser *clangParser) override
Parses a single input file with the goal to build an Entry tree.
Definition scanner.l:8390
void parsePrototype(const QCString &text) override
Callback function called by the comment block scanner.
Definition scanner.l:8415
std::unique_ptr< Private > p
Definition scanner.h:46
~COutlineParser() override
Definition scanner.l:8385
bool needsPreprocessing(const QCString &extension) const override
Returns TRUE if the language identified by extension needs the C preprocessor to be run before feed t...
Definition scanner.l:8405
@ Lex_scanner
Definition debug.h:67
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:132
Helper class to process markdown formatted text.
Definition markdown.h:32
QCString process(const QCString &input, int &startNewlines, bool fromParseInput=false)
QCString lower() const
Definition qcstring.h:234
bool endsWith(const char *s) const
Definition qcstring.h:509
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:198
void clear()
Definition qcstring.h:169
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
Definition code.l:3989
#define YY_BUF_SIZE
Definition commentcnv.l:19
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
static void initParser(yyscan_t yyscanner)
#define Config_getInt(name)
Definition config.h:34
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:47
#define AUTO_TRACE(...)
Definition docnode.cpp:46
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1324
static void parseMain(yyscan_t yyscanner, const QCString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &rt, FortranFormat format)
#define msg(fmt,...)
Definition message.h:94
QCString trunc(const QCString &s, size_t numChars=15)
Definition trace.h:56
static void newEntry(yyscan_t yyscanner)
Definition pyscanner.l:1778
static void parsePrototype(yyscan_t yyscanner, const QCString &text)
Definition pyscanner.l:2283
static void parseCompounds(yyscan_t yyscanner, std::shared_ptr< Entry > rt)
Definition pyscanner.l:2149
const char * qPrint(const char *s)
Definition qcstring.h:672
QCString name
Definition arguments.h:44
QCString docs
Definition arguments.h:47
scannerYY_state state
Definition scanner.l:8374
@ CSharp
Definition types.h:46
@ Slice
Definition types.h:59
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5705
QCString stripIndentation(const QCString &s, bool skipFirstLine)
Definition util.cpp:6438
EntryType guessSection(const QCString &name)
Definition util.cpp:349