Doxygen
Loading...
Searching...
No Matches
scanner.l File Reference
#include <stdint.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cctype>
#include "scanner.h"
#include "entry.h"
#include "message.h"
#include "config.h"
#include "doxygen.h"
#include "util.h"
#include "defargs.h"
#include "language.h"
#include "commentscan.h"
#include "arguments.h"
#include "moduledef.h"
#include "stringutil.h"
#include "clangparser.h"
#include "markdown.h"
#include "regex.h"
#include "trace.h"
#include "debug.h"
#include "doxygen_lex.h"
#include "scanner.l.h"
Include dependency graph for scanner.l:

Go to the source code of this file.

Classes

struct  scannerYY_state
struct  COutlineParser::Private

Macros

#define YY_TYPEDEF_YY_SCANNER_T
#define YY_NO_INPUT   1
#define YY_NO_UNISTD_H   1
#define YY_INPUT(buf, result, max_size)

Typedefs

typedef yyguts_t * yyscan_t

Functions

static const char * stateToString (int state)
static int computeIndent (const char *s, int startIndent)
static void initMethodProtection (yyscan_t yyscanner, Protection prot)
static QCString stripQuotes (const char *s)
static QCString stripFuncPtr (const QCString &type)
static bool nameIsOperator (QCString &name)
void fixArgumentListForJavaScript (ArgumentList &al)
static bool startOfRequiresExpression (const QCString &req)
static void initParser (yyscan_t yyscanner)
static void initEntry (yyscan_t yyscanner)
static void lineCount (yyscan_t yyscanner)
static void addType (yyscan_t yyscanner)
static void setContext (yyscan_t yyscanner)
static void prependScope (yyscan_t yyscanner)
static void startCommentBlock (yyscan_t yyscanner, bool)
static void handleCommentBlock (yyscan_t yyscanner, const QCString &doc, bool brief)
static void handleParametersCommentBlocks (yyscan_t yyscanner, ArgumentList &al)
static bool checkForKnRstyleC (yyscan_t yyscanner)
static void splitKnRArg (yyscan_t yyscanner, QCString &oldStyleArgPtr, QCString &oldStyleArgName)
static void addKnRArgInfo (yyscan_t yyscanner, const QCString &type, const QCString &name, const QCString &brief, const QCString &docs)
static int yyread (yyscan_t yyscanner, char *buf, int max_size)
static void setJavaProtection (yyscan_t yyscanner)
static void storeClangId (yyscan_t yyscanner, const char *id)
static void startVerbatimBlock (yyscan_t yyscanner, const QCString &blockName, size_t fencedSize=0, bool codeBlock=false)
static bool endVerbatimBlock (yyscan_t yyscanner, const QCString &blockName, size_t fencedSize=0)
static const char * getLexerFILE ()
int yylex (yyscan_t yyscanner)
 Slice states.
static void newEntry (yyscan_t yyscanner)
static void parseCompounds (yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
static void parseConcepts (yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
static void parseMain (yyscan_t yyscanner, const QCString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &rt, ClangTUParser *clangParser)
static void parsePrototype (yyscan_t yyscanner, const QCString &text)

Macro Definition Documentation

◆ YY_INPUT

#define YY_INPUT ( buf,
result,
max_size )
Value:
result=yyread(yyscanner,buf,max_size);
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
Definition code.l:3982

Definition at line 258 of file scanner.l.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 61 of file scanner.l.

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 62 of file scanner.l.

◆ YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 22 of file scanner.l.

Typedef Documentation

◆ yyscan_t

typedef yyguts_t* yyscan_t

Definition at line 24 of file scanner.l.

Function Documentation

◆ addKnRArgInfo()

void addKnRArgInfo ( yyscan_t yyscanner,
const QCString & type,
const QCString & name,
const QCString & brief,
const QCString & docs )
static

Update the argument name with additional type info. For K&R style function the type is found after the argument list, so this routine in needed to fix up.

Definition at line 8259 of file scanner.l.

8261{
8262 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8263 for (Argument &a : yyextra->current->argList)
8264 {
8265 if (a.type==name)
8266 {
8267 a.type=type.stripWhiteSpace();
8268 a.type.stripPrefix("register ");
8269 a.name=name.stripWhiteSpace();
8270 if (!brief.isEmpty() && !docs.isEmpty())
8271 {
8272 a.docs=brief+"\n\n"+docs;
8273 }
8274 else if (!brief.isEmpty())
8275 {
8276 a.docs=brief;
8277 }
8278 else
8279 {
8280 a.docs=docs;
8281 }
8282 }
8283 }
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
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:213
This class contains the information about the argument of a function or template.
Definition arguments.h:27
QCString type
Definition arguments.h:42
QCString name
Definition arguments.h:44
QCString docs
Definition arguments.h:47
8284}

References Argument::docs, QCString::isEmpty(), Argument::name, QCString::stripPrefix(), QCString::stripWhiteSpace(), and Argument::type.

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 8001 of file scanner.l.

8002{
8003 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8004 size_t tl=yyextra->current->type.length();
8005 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8006 {
8007 yyextra->current->type += ' ' ;
8008 }
8009 yyextra->current->type += yyextra->current->name;
8010 yyextra->current->name.clear() ;
8011 tl=yyextra->current->type.length();
8012 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8013 {
8014 yyextra->current->type += ' ' ;
8015 }
8016 yyextra->current->type += yyextra->current->args ;
8017 yyextra->current->args.clear() ;
8018 yyextra->current->argList.clear();
8019}

◆ checkForKnRstyleC()

bool checkForKnRstyleC ( yyscan_t yyscanner)
static

Returns TRUE iff the yyextra->current entry could be a K&R style C function

Definition at line 8139 of file scanner.l.

8140{
8141 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8142 if (!yyextra->fileName.lower().endsWith(".c")) return FALSE; // must be a C file
8143 if (yyextra->current->argList.empty()) return FALSE; // must have arguments
8144 for (const Argument &a : yyextra->current->argList)
8145 {
8146 // in K&R style argument do not have a type, but doxygen expects a type
8147 // so it will think the argument has no name
8148 if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE;
8149 }
8150 return TRUE;
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
8151}

References FALSE, QCString::isEmpty(), Argument::name, and Argument::type.

◆ computeIndent()

int computeIndent ( const char * s,
int startIndent )
inlinestatic

Definition at line 7974 of file scanner.l.

7975{
7976 int col=startIndent;
7977 int tabSize=Config_getInt(TAB_SIZE);
7978 const char *p=s;
7979 char c;
7980 while ((c=*p++))
7981 {
7982 if (c=='\t') col+=tabSize-(col%tabSize);
7983 else if (c=='\n') col=0;
7984 else col++;
7985 }
7986 return col;
#define Config_getInt(name)
Definition config.h:34
7987}

◆ endVerbatimBlock()

bool endVerbatimBlock ( yyscan_t yyscanner,
const QCString & blockName,
size_t fencedSize = 0 )
static

Definition at line 8061 of file scanner.l.

8062{
8063 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8064 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
8065 {
8066 if (Config_getBool(MARKDOWN_SUPPORT))
8067 {
8068 yyextra->docBlock << "\\endiskip";
8069 }
8070 yyextra->docBlockName="";
8071 return true;
8072 }
8073 return false;
#define Config_getBool(name)
Definition config.h:33
8074}

References Config_getBool.

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 8288 of file scanner.l.

8289{
8290 for (Argument &a : al)
8291 {
8292 if (!a.type.isEmpty() && a.name.isEmpty())
8293 { // a->type is actually the (typeless) parameter name, so move it
8294 a.name=a.type;
8295 a.type.clear();
8296 }
8297 }
8298}

References QCString::clear(), QCString::isEmpty(), Argument::name, and Argument::type.

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 261 of file scanner.l.

261{return __FILE__;}

◆ handleCommentBlock()

void handleCommentBlock ( yyscan_t yyscanner,
const QCString & doc,
bool brief )
static

Definition at line 8339 of file scanner.l.

8340{
8341 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8342 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
8343 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
8344 if (yyextra->docBlockInBody && hideInBodyDocs) return;
8345 int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine; // line of block start
#define AUTO_TRACE(...)
Definition docnode.cpp:47
QCString trunc(const QCString &s, size_t numChars=15)
Definition trace.h:56
8346
8347 // fill in inbodyFile && inbodyLine the first time, see bug 633891
8348 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
8349 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
8350 {
8351 docEntry->inbodyFile = yyextra->fileName;
8352 docEntry->inbodyLine = lineNr;
8353 }
8354
8355 int position=0;
8356 bool needsEntry=FALSE;
8357 GuardedSectionStack guards;
8358 Markdown markdown(yyextra->fileName,lineNr);
8359 QCString strippedDoc = stripIndentation(doc);
8360 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8361 while (yyextra->commentScanner.parseCommentBlock(
8362 yyextra->thisParser,
8363 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8364 processedDoc, // text
8365 yyextra->fileName, // file
8366 lineNr, // line of block start
8367 yyextra->docBlockInBody ? FALSE : brief, // isBrief
8368 yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
8369 yyextra->docBlockInBody, // isInBody
8370 yyextra->protection,
8371 position,
8372 needsEntry,
8373 Config_getBool(MARKDOWN_SUPPORT),
8374 &guards
8375 )
8376 )
8377 {
8378 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8379 if (needsEntry)
8380 {
8381 QCString docFile = yyextra->current->docFile;
8382 newEntry(yyscanner);
8383 yyextra->current->docFile = docFile;
8384 yyextra->current->docLine = lineNr;
8385 }
8386 }
8387 if (needsEntry)
8388 {
8389 newEntry(yyscanner);
8390 }
Helper class to process markdown formatted text.
Definition markdown.h:32
This is an alternative implementation of QCString.
Definition qcstring.h:101
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
static void newEntry(yyscan_t yyscanner)
Definition scanner.l:8319
QCString stripIndentation(const QCString &s, bool skipFirstLine)
Definition util.cpp:5949
8391
8392 if (yyextra->docBlockTerm)
8393 {
8394 unput(yyextra->docBlockTerm);
8395 yyextra->docBlockTerm=0;
8396 }
8397}

References Trace::trunc().

◆ handleParametersCommentBlocks()

void handleParametersCommentBlocks ( yyscan_t yyscanner,
ArgumentList & al )
static

Definition at line 8399 of file scanner.l.

8400{
8401 AUTO_TRACE();
8402 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8403 for (Argument &a : al)
8404 {
8405 AUTO_TRACE_ADD("Param '{}' docs='{}'",a.name,Trace::trunc(a.docs));
8406 if (!a.docs.isEmpty())
8407 {
8408 if (a.name.isEmpty() && a.type == "...") a.name= "...";
8409 int position=0;
8410 bool needsEntry;
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:48
8411
8412 // save context
8413 QCString orgDoc = yyextra->current->doc;
8414 QCString orgBrief = yyextra->current->brief;
8415 int orgDocLine = yyextra->current->docLine;
8416 int orgBriefLine = yyextra->current->briefLine;
8417
8418 yyextra->current->doc.clear();
8419 yyextra->current->brief.clear();
8420
8421 //printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
8422 int lineNr = orgDocLine;
8423 GuardedSectionStack guards;
8424 Markdown markdown(yyextra->fileName,lineNr);
8425 QCString strippedDoc = stripIndentation(a.docs);
8426 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8427 while (yyextra->commentScanner.parseCommentBlock(
8428 yyextra->thisParser,
8429 yyextra->current.get(),
8430 processedDoc, // text
8431 yyextra->fileName, // file
8432 lineNr,
8433 FALSE,
8434 FALSE,
8435 FALSE,
8436 yyextra->protection,
8437 position,
8438 needsEntry,
8439 Config_getBool(MARKDOWN_SUPPORT),
8440 &guards
8441 )
8442 )
8443 {
8444 //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8445 if (needsEntry) newEntry(yyscanner);
8446 }
8447 if (needsEntry)
8448 {
8449 newEntry(yyscanner);
8450 }
8451 a.docs = yyextra->current->doc;
8452
8453 // restore context
8454 yyextra->current->doc = orgDoc;
8455 yyextra->current->brief = orgBrief;
8456 yyextra->current->docLine = orgDocLine;
8457 yyextra->current->briefLine = orgBriefLine;
8458 }
8459 }
8460}

References Config_getBool, FALSE, and Trace::trunc().

◆ initEntry()

void initEntry ( yyscan_t yyscanner)
static

Definition at line 7918 of file scanner.l.

7919{
7920 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7921 if (yyextra->insideJava)
7922 {
7923 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
7924 }
7925 yyextra->current->protection = yyextra->protection;
7926 yyextra->current->exported = yyextra->exported ;
7927 yyextra->current->mtype = yyextra->mtype;
7928 yyextra->current->virt = yyextra->virt;
7929 yyextra->current->isStatic = yyextra->isStatic;
7930 yyextra->current->lang = yyextra->language;
7931 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
7932 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
7933 yyextra->isTypedef=FALSE;
7934}

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 7989 of file scanner.l.

7990{
7991 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7992 yyextra->current->protection = yyextra->protection = prot;
7993 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
7994 yyextra->current->type.clear();
7995 yyextra->current->name.clear();
7996 yyextra->current->args.clear();
7997 yyextra->current->argList.clear();
7998 lineCount(yyscanner) ;
#define lineCount(s, len)
7999}

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 7894 of file scanner.l.

7895{
7896 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7897 yyextra->outerScopeEntries.clear();
7898 yyextra->baseName.clear();
7899 yyextra->protection = Protection::Public;
7900 yyextra->baseProt = Protection::Public;
7901 yyextra->sharpCount = 0;
7902 yyextra->roundCount = 0;
7903 yyextra->curlyCount = 0;
7904 yyextra->mtype = MethodTypes::Method;
7905 yyextra->isStatic = FALSE;
7906 yyextra->virt = Specifier::Normal;
7907 yyextra->baseVirt = Specifier::Normal;
7908 yyextra->isTypedef = FALSE;
7909 yyextra->insideTryBlock = FALSE;
7910 yyextra->insideFormula = FALSE;
7911 yyextra->insideCode=FALSE;
7912 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
7913 yyextra->previous = 0;
7914 yyextra->firstTypedefEntry.reset();
7915 yyextra->memspecEntry.reset();
7916}

References FALSE.

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 7948 of file scanner.l.

7949{
7950 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7951 int tabSize = Config_getInt(TAB_SIZE);
7952 const char *p;
7953 for (p = yytext ; *p ; ++p )
7954 {
7955 if (*p=='\n')
7956 {
7957 yyextra->yyLineNr++;
7958 yyextra->column=0;
7959 yyextra->yyColNr=1;
7960 }
7961 else if (*p=='\t')
7962 {
7963 yyextra->column+=tabSize - (yyextra->column%tabSize);
7964 }
7965 else
7966 {
7967 yyextra->column++;
7968 yyextra->yyColNr++;
7969 }
7970 }
7971 //printf("lineCount()=%d\n",yyextra->column);
7972}

◆ nameIsOperator()

bool nameIsOperator ( QCString & name)
static

Definition at line 8088 of file scanner.l.

8089{
8090 int i=name.find("operator");
8091 if (i==-1) return FALSE;
8092 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
8093 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
8094 return FALSE; // case TEXToperatorTEXT
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:593
bool isId(int c)
Definition util.h:207
8095}

References FALSE, isId(), and TRUE.

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8319 of file scanner.l.

8320{
8321 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8322 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
8323 // and yyextra->current is actually replaced by yyextra->previous which was
8324 // already added to yyextra->current_root, so we should not add it again
8325 // (see bug723314)
8326 {
8327 yyextra->previous = yyextra->current;
8328 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8329 }
8330 else
8331 {
8332 yyextra->previous = yyextra->current;
8333 yyextra->current = yyextra->tempEntry;
8334 yyextra->tempEntry.reset();
8335 }
8336 initEntry(yyscanner);
static void initEntry(yyscan_t yyscanner)
Definition scanner.l:7918
8337}

◆ parseCompounds()

void parseCompounds ( yyscan_t yyscanner,
const std::shared_ptr< Entry > & rt )
static

Definition at line 8465 of file scanner.l.

8466{
8467 AUTO_TRACE("name={}",rt->name);
8468 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8469 for (const auto &ce : rt->children())
8470 {
8471 if (!ce->program.empty())
8472 {
8473 AUTO_TRACE_ADD("compound name='{}' program='{}'",Trace::trunc(ce->name),Trace::trunc(ce->program.str()));
8474 // init scanner state
8475 yyextra->padCount=0;
8476 yyextra->column=0;
8477 yyextra->programStr = ce->program.str();
8478 yyextra->inputString = yyextra->programStr.data();
8479 yyextra->inputPosition = 0;
8480 if (ce->section.isEnum() || ce->spec.isEnum())
8481 BEGIN( FindFields ) ;
8482 else
8483 BEGIN( FindMembers ) ;
8484 yyextra->current_root = ce;
8485 yyextra->fileName = ce->fileName;
8486 //setContext();
8487 yyextra->yyLineNr = ce->bodyLine;
8488 yyextra->yyColNr = ce->bodyColumn;
8489 yyextra->insideObjC = ce->lang==SrcLangExt::ObjC;
8490 //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
8491 yyextra->current = std::make_shared<Entry>();
8492 yyextra->isStatic = FALSE;
8493 initEntry(yyscanner);
8494
8495 // deep copy group list from parent (see bug 727732)
8496 bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
8497 if (autoGroupNested && !rt->groups.empty() && !ce->section.isEnum() && !ce->spec.isEnum())
8498 {
8499 ce->groups = rt->groups;
8500 }
8501
8502 int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2;
8503 // set default protection based on the compound type
8504 if ( ce->section.isClass() ) // class
8505 {
8506 if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
8507 {
8508 yyextra->current->protection = yyextra->protection = Protection::Public ;
8509 }
8510 else if (yyextra->insideJava)
8511 {
8512 yyextra->current->protection = yyextra->protection = (ce->spec.isInterface() || ce->spec.isEnum()) ? Protection::Public : Protection::Package;
8513 }
8514 else if (ce->spec.isInterface() || ce->spec.isRef() || ce->spec.isValue() || ce->spec.isStruct() || ce->spec.isUnion())
8515 {
8516 if (ce->lang==SrcLangExt::ObjC)
8517 {
8518 yyextra->current->protection = yyextra->protection = Protection::Protected ;
8519 }
8520 else
8521 {
8522 yyextra->current->protection = yyextra->protection = Protection::Public ;
8523 }
8524 }
8525 else
8526 {
8527 yyextra->current->protection = yyextra->protection = Protection::Private ;
8528 }
8529 }
8530 else if (ce->section.isEnum() ) // enum
8531 {
8532 yyextra->current->protection = yyextra->protection = ce->protection;
8533 }
8534 else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
8535 {
8536 if (ce->section.isNamespace() ) // unnamed namespace
8537 {
8538 yyextra->current->isStatic = yyextra->isStatic = TRUE;
8539 }
8540 yyextra->current->protection = yyextra->protection = ce->protection;
8541 yyextra->current->exported = yyextra->exported = false;
8542 }
8543 else if (ce->section.isNamespace() )
8544 {
8545 yyextra->current->protection = yyextra->protection = Protection::Public ;
8546 yyextra->current->exported = yyextra->exported = ce->exported;
8547 }
8548 else // named struct, union, protocol, category
8549 {
8550 yyextra->current->protection = yyextra->protection = Protection::Public ;
8551 yyextra->current->exported = yyextra->exported = false;
8552 }
8553 yyextra->mtype = MethodTypes::Method;
8554 yyextra->virt = Specifier::Normal;
8555 //printf("name=%s yyextra->current->isStatic=%d yyextra->isStatic=%d\n",qPrint(ce->name),yyextra->current->isStatic,yyextra->isStatic);
8556
8557 //memberGroupId = DOX_NOGROUP;
8558 //memberGroupRelates.clear();
8559 //memberGroupInside.clear();
8560 QCString name = ce->name;
8561 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
8562
8563 scannerYYlex(yyscanner);
8564 //forceEndGroup();
8565
8566 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
8567
8568 yyextra->programStr.clear();
8569 ce->program.str(std::string());
8570
8571
8572 //if (depthIf>0)
8573 //{
8574 // warn(yyextra->fileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
8575 //}
8576 }
8577 parseCompounds(yyscanner,ce);
8578 }
static void parseCompounds(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8465
8579}

References FALSE, and Trace::trunc().

◆ parseConcepts()

void parseConcepts ( yyscan_t yyscanner,
const std::shared_ptr< Entry > & rt )
static

Definition at line 8581 of file scanner.l.

8582{
8583 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8584 for (const auto &ce : rt->children())
8585 {
8586 if (ce->section.isConcept())
8587 {
8588 //printf("*** found concept '%s' value=[[\n%s\n]] line=%d,col=%d\n",
8589 // qPrint(ce->name),qPrint(ce->initializer.str()),ce->startLine,ce->startColumn);
8590 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8591 // init scanner state
8592 yyextra->padCount =0;
8593 yyextra->column =0;
8594 yyextra->programStr = ce->initializer.str();
8595 yyextra->inputString = yyextra->programStr.data();
8596 yyextra->inputPosition = 0;
8597 yyextra->current_root = ce;
8598 yyextra->fileName = ce->fileName;
8599 yyextra->yyLineNr = ce->bodyLine;
8600 yyextra->yyColNr = ce->bodyColumn;
8601 yyextra->insideObjC = false;
8602 yyextra->current = std::make_shared<Entry>();
8603
8604 // hack to reconstruct what was in the code before the concept expression
8605 QCString indent;
8606 indent.fill(' ',std::max(0,ce->startColumn-1));
8607 QCString templArgs;
8608 if (!ce->args.isEmpty())
8609 {
8610 templArgs=indent+"template"+ce->args+"\n";
8611 }
8612 yyextra->current->initializer.str(QCString(templArgs+indent+"concept "+ce->name+ " =").str());
QCString fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:193
const std::string & str() const
Definition qcstring.h:552
8613
8614 yyextra->isStatic = FALSE;
8615 initEntry(yyscanner);
8616 yyextra->current->section = EntryType::makeConceptCodePart();
8617 yyextra->current->startLine = yyextra->yyLineNr;
8618 BEGIN( FindConceptParts );
8619 scannerYYlex(yyscanner);
8620 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8621
8622 }
8623 parseConcepts(yyscanner,ce);
8624 }
static void parseConcepts(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8581
8625}

References FALSE, QCString::fill(), initEntry(), parseConcepts(), and QCString::str().

Referenced by parseConcepts(), and parseMain().

◆ parseMain()

void parseMain ( yyscan_t yyscanner,
const QCString & fileName,
const char * fileBuf,
const std::shared_ptr< Entry > & rt,
ClangTUParser * clangParser )
static

Definition at line 8629 of file scanner.l.

8634{
8635 AUTO_TRACE("fileName={}",fileName);
8636 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8637 initParser(yyscanner);
static void initParser(yyscan_t yyscanner)
Definition scanner.l:7894
8638
8639 yyextra->inputString = fileBuf;
8640 yyextra->inputPosition = 0;
8641 yyextra->column = 0;
8642 scannerYYrestart(nullptr,yyscanner);
8643
8644 //depthIf = 0;
8645 yyextra->protection = Protection::Public;
8646 yyextra->mtype = MethodTypes::Method;
8647 yyextra->isStatic = FALSE;
8648 yyextra->exported = false;
8649 yyextra->virt = Specifier::Normal;
8650 yyextra->current_root = rt;
8651 yyextra->yyLineNr = 1 ;
8652 yyextra->yyBegLineNr = 1;
8653 yyextra->yyBegColNr = 0;
8654 yyextra->anonCount = 0;
8655 yyextra->anonNSCount = 0;
8656 yyextra->fileName = fileName;
8657 yyextra->clangParser = clangParser;
8658 setContext(yyscanner);
8659 rt->lang = yyextra->language;
8660 msg("Parsing file {}...\n",yyextra->fileName);
#define msg(fmt,...)
Definition message.h:94
static void setContext(yyscan_t yyscanner)
Definition scanner.l:8099
8661
8662 yyextra->current_root = rt;
8663 initParser(yyscanner);
8664 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
8665 yyextra->current = std::make_shared<Entry>();
8666 //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
8667 EntryType sec=guessSection(yyextra->fileName);
8668 if (!sec.isEmpty())
8669 {
8670 yyextra->current->name = yyextra->fileName;
8671 yyextra->current->section = sec;
8672 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8673 }
8674 yyextra->current->reset();
8675 initEntry(yyscanner);
8676 if ( yyextra->insidePHP )
8677 {
8678 BEGIN( FindMembersPHP );
8679 }
8680 else if ( yyextra->insideJava ) // add default java.lang package scope
8681 {
8682 yyextra->current->name="java::lang"; // '::' is used in doxygen's internal representation as a scope separator
8683 yyextra->current->fileName = yyextra->fileName;
8684 yyextra->current->section = EntryType::makeUsingDir();
8685 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8686 initEntry(yyscanner);
8687 BEGIN( FindMembers );
8688 }
8689 else
8690 {
8691 BEGIN( FindMembers );
8692 }
Wrapper class for the Entry type.
Definition types.h:816
EntryType guessSection(const QCString &name)
Definition util.cpp:339
8693
8694 scannerYYlex(yyscanner);
8695
8696 if (YY_START==Comment)
8697 {
8698 warn(yyextra->fileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?");
8699 }
#define warn(file, line, fmt,...)
Definition message.h:97
8700
8701 //forceEndGroup();
8702 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
8703
8704 yyextra->programStr.clear();
8705 rt->program.str(std::string());
8706
8707 parseCompounds(yyscanner,rt);
8708 parseConcepts(yyscanner,rt);
8709
8710 yyextra->anonNSCount++;
8711
8712 // add additional entries that were created during processing
8713 for (auto &[parent,child]: yyextra->outerScopeEntries)
8714 {
8715 //printf(">>> adding '%s' to scope '%s'\n",qPrint(child->name),qPrint(parent->name));
8716 parent->moveToSubEntryAndKeep(child);
8717 }
8718 yyextra->outerScopeEntries.clear();
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:1327
8719
8720}

References AUTO_TRACE, FALSE, guessSection(), initEntry(), initParser(), msg, parent(), parseCompounds(), parseConcepts(), setContext(), and warn.

◆ parsePrototype()

void parsePrototype ( yyscan_t yyscanner,
const QCString & text )
static

Definition at line 8724 of file scanner.l.

8725{
8726 AUTO_TRACE("text='{}'",Trace::trunc(text));
8727 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8728 if (text.isEmpty())
8729 {
8730 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8731 return;
8732 }
8733 if (!yyextra->current) // nothing to store (see bug683516)
8734 {
8735 return;
8736 }
8737
8738 const char *orgInputString;
8739 int orgInputPosition;
8740 YY_BUFFER_STATE orgState;
8741
8742 // save scanner state
8743 orgState = YY_CURRENT_BUFFER;
8744 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8745 orgInputString = yyextra->inputString;
8746 orgInputPosition = yyextra->inputPosition;
#define YY_BUF_SIZE
Definition commentcnv.l:19
8747
8748 // set new string
8749 yyextra->inputString = text.data();
8750 yyextra->inputPosition = 0;
8751 yyextra->column = 0;
8752 scannerYYrestart(nullptr, yyscanner);
8753 BEGIN(Prototype);
8754 scannerYYlex(yyscanner);
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
8755
8756 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8757 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.isEmpty())
8758 {
8759 yyextra->current->section = EntryType::makeVariableDoc();
8760 }
8761
8762 // restore original scanner state
8763 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8764 yy_switch_to_buffer(orgState, yyscanner);
8765 yyextra->inputString = orgInputString;
8766 yyextra->inputPosition = orgInputPosition;
8767
8768
8769 //printf("**** parsePrototype end\n");
8770}

References Trace::trunc().

◆ prependScope()

void prependScope ( yyscan_t yyscanner)
static

Definition at line 8121 of file scanner.l.

8122{
8123 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8124 if (yyextra->current_root->section.isScope())
8125 {
8126 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
8127 yyextra->current->name.prepend(yyextra->current_root->name+"::");
8128 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
8129 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
8130 {
8131 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
8132 }
8133 }
This class represents an function or template argument list.
Definition arguments.h:65
8134}

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 8099 of file scanner.l.

8100{
8101 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8102 yyextra->language = getLanguageFromFileName(yyextra->fileName);
8103 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
8104 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
8105 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
8106 yyextra->insideD = yyextra->language==SrcLangExt::D;
8107 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
8108 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
8109 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
8110 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
8111 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
8112 yyextra->language==SrcLangExt::Lex);
8113 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
8114 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
8115 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
8116 // );
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5191
8117}

Referenced by parseMain().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 8153 of file scanner.l.

8154{
8155 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8156 if (yyextra->insideJava)
8157 {
8158 QCString text=yytext;
8159 yyextra->current->protection = Protection::Public;
8160 if (text.find("protected")!=-1)
8161 yyextra->current->protection = Protection::Protected;
8162 else if (text.find("private")!=-1)
8163 yyextra->current->protection = Protection::Private;
8164 else if (text.find("package")!=-1)
8165 yyextra->current->protection = Protection::Package;
8166 }
8167}

References QCString::find().

◆ splitKnRArg()

void splitKnRArg ( yyscan_t yyscanner,
QCString & oldStyleArgPtr,
QCString & oldStyleArgName )
static

Definition at line 8170 of file scanner.l.

8171{
8172 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8173 int si = static_cast<int>(yyextra->current->args.length());
8174 if (yyextra->oldStyleArgType.isEmpty()) // new argument
8175 {
8176 std::string args = yyextra->current->args.str();
8177 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
8178 int bi1=-1;
8179 int bi2=-1;
8181 if (reg::search(args,match,re))
8182 {
8183 bi1=(int)match.position();
8184 size_t secondMatchStart = match.position()+match.length(); // search again after first match
8185 if (reg::search(args,match,re,secondMatchStart))
8186 {
8187 bi2=(int)match.position();
8188 }
8189 }
8190 char c;
8191 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
8192 {
8193 int s=bi2+1; // keep opening (
8194 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8195 int i=s;
8196 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8197 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8198 s=i;
8199 while (i<si && isId(yyextra->current->args.at(i))) i++;
8200 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8201 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
8202 }
8203 else if (bi1!=-1) // redundant braces like in "int (*var)"
8204 {
8205 int s=bi1; // strip opening (
8206 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8207 s++;
8208 int i=s+1;
8209 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8210 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8211 s=i;
8212 while (i<si && isId(yyextra->current->args.at(i))) i++;
8213 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8214 }
8215 else // normal "int *var"
8216 {
8217 int l=si,i=l-1,j;
8218 // look for start of name in "type *name"
8219 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
8220 j=i+1;
8221 // look for start of *'s
8222 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
8223 i++;
8224 if (i!=l)
8225 {
8226 yyextra->oldStyleArgType=yyextra->current->args.left(i);
8227 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
8228 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8229 }
8230 else
8231 {
8232 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8233 }
8234 }
8235 }
8236 else // continuation like *arg2 in "int *args,*arg2"
8237 {
8238 int l=si,j=0;
8239 char c;
8240 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
8241 if (j>0)
8242 {
8243 oldStyleArgPtr=yyextra->current->args.left(j);
8244 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8245 }
8246 else
8247 {
8248 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8249 }
8250 }
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
QCString left(size_t len) const
Definition qcstring.h:229
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:151
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:844
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:855
8251}

References isId(), QCString::mid(), reg::search(), and QCString::stripWhiteSpace().

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8302 of file scanner.l.

8303{
8304 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8305 if (brief)
8306 {
8307 yyextra->current->briefFile = yyextra->fileName;
8308 yyextra->current->briefLine = yyextra->yyLineNr;
8309 }
8310 else
8311 {
8312 yyextra->current->docFile = yyextra->fileName;
8313 yyextra->current->docLine = yyextra->yyLineNr;
8314 }
8315}

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 8080 of file scanner.l.

8081{
8082 QCString r = req.stripWhiteSpace();
8083 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:524
8084}

◆ startVerbatimBlock()

void startVerbatimBlock ( yyscan_t yyscanner,
const QCString & blockName,
size_t fencedSize = 0,
bool codeBlock = false )
static

Definition at line 8047 of file scanner.l.

8048{
8049 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8050 if (Config_getBool(MARKDOWN_SUPPORT))
8051 {
8052 yyextra->docBlock << "\\iskip";
8053 }
8054 yyextra->docBlockName=blockName;
8055 yyextra->fencedSize=fencedSize;
8056 yyextra->isCodeBlock=codeBlock;
8057 yyextra->nestedComment=0;
8058}

◆ stateToString()

const char * stateToString ( int state)
static

◆ storeClangId()

void storeClangId ( yyscan_t yyscanner,
const char * id )
static

Definition at line 7939 of file scanner.l.

7940{
7941 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7942 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
7943 {
7944 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
7945 }
7946}

◆ stripFuncPtr()

QCString stripFuncPtr ( const QCString & type)
static

Definition at line 8034 of file scanner.l.

8035{
8036 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
8037 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
8038 size_t i=type.length();
8039 bool funcPtr = i>0 && type[i-1]==')';
8040 if (funcPtr) i--;
8041 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
8042 if (funcPtr && i>0 && type[i-1]=='(') i--;
8043 return type.left(i);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
8044}

◆ stripQuotes()

QCString stripQuotes ( const char * s)
static

Definition at line 8022 of file scanner.l.

8023{
8024 QCString name;
8025 if (s==nullptr || *s==0) return name;
8026 name=s;
8027 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
8028 {
8029 name=name.mid(1,name.length()-2);
8030 }
8031 return name;
8032}

References QCString::length(), and QCString::mid().

◆ yylex()

int yylex ( yyscan_t yyscanner)

Slice states.

Prototype scanner states comment parsing states C++20 concepts Object-C Deprecated C++20 modules

Definition at line 510 of file scanner.l.

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

◆ yyread()

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

Definition at line 7880 of file scanner.l.

7881{
7882 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7883 int c=0;
7884 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7885 {
7886 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7887 //printf("%d (%c)\n",*buf,*buf);
7888 c++; buf++;
7889 }
7890 return c;
7891}