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