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