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