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 8313 of file scanner.l.

8315{
8316 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8317 for (Argument &a : yyextra->current->argList)
8318 {
8319 if (a.type==name)
8320 {
8321 a.type=type.stripWhiteSpace();
8322 a.type.stripPrefix("register ");
8323 a.name=name.stripWhiteSpace();
8324 if (!brief.isEmpty() && !docs.isEmpty())
8325 {
8326 a.docs=brief+"\n\n"+docs;
8327 }
8328 else if (!brief.isEmpty())
8329 {
8330 a.docs=brief;
8331 }
8332 else
8333 {
8334 a.docs=docs;
8335 }
8336 }
8337 }
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
8338}

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

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 8055 of file scanner.l.

8056{
8057 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8058 size_t tl=yyextra->current->type.length();
8059 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8060 {
8061 yyextra->current->type += ' ' ;
8062 }
8063 yyextra->current->type += yyextra->current->name;
8064 yyextra->current->name.clear() ;
8065 tl=yyextra->current->type.length();
8066 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8067 {
8068 yyextra->current->type += ' ' ;
8069 }
8070 yyextra->current->type += yyextra->current->args ;
8071 yyextra->current->args.clear() ;
8072 yyextra->current->argList.clear();
8073}

◆ 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 8193 of file scanner.l.

8194{
8195 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8196 if (!yyextra->fileName.lower().endsWith(".c")) return FALSE; // must be a C file
8197 if (yyextra->current->argList.empty()) return FALSE; // must have arguments
8198 for (const Argument &a : yyextra->current->argList)
8199 {
8200 // in K&R style argument do not have a type, but doxygen expects a type
8201 // so it will think the argument has no name
8202 if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE;
8203 }
8204 return TRUE;
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
8205}

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

◆ computeIndent()

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

Definition at line 8028 of file scanner.l.

8029{
8030 int col=startIndent;
8031 int tabSize=Config_getInt(TAB_SIZE);
8032 const char *p=s;
8033 char c;
8034 while ((c=*p++))
8035 {
8036 if (c=='\t') col+=tabSize-(col%tabSize);
8037 else if (c=='\n') col=0;
8038 else col++;
8039 }
8040 return col;
#define Config_getInt(name)
Definition config.h:34
8041}

◆ endVerbatimBlock()

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

Definition at line 8115 of file scanner.l.

8116{
8117 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8118 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
8119 {
8120 if (Config_getBool(MARKDOWN_SUPPORT))
8121 {
8122 yyextra->docBlock << "\\endiskip";
8123 }
8124 yyextra->docBlockName="";
8125 return true;
8126 }
8127 return false;
#define Config_getBool(name)
Definition config.h:33
8128}

References Config_getBool.

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 8342 of file scanner.l.

8343{
8344 for (Argument &a : al)
8345 {
8346 if (!a.type.isEmpty() && a.name.isEmpty())
8347 { // a->type is actually the (typeless) parameter name, so move it
8348 a.name=a.type;
8349 a.type.clear();
8350 }
8351 }
8352}

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 8393 of file scanner.l.

8394{
8395 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8396 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
8397 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
8398 if (yyextra->docBlockInBody && hideInBodyDocs) return;
8399 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
8400
8401 // fill in inbodyFile && inbodyLine the first time, see bug 633891
8402 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
8403 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
8404 {
8405 docEntry->inbodyFile = yyextra->fileName;
8406 docEntry->inbodyLine = lineNr;
8407 }
8408
8409 int position=0;
8410 bool needsEntry=FALSE;
8411 GuardedSectionStack guards;
8412 Markdown markdown(yyextra->fileName,lineNr);
8413 QCString strippedDoc = stripIndentation(doc);
8414 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8415 while (yyextra->commentScanner.parseCommentBlock(
8416 yyextra->thisParser,
8417 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8418 processedDoc, // text
8419 yyextra->fileName, // file
8420 lineNr, // line of block start
8421 yyextra->docBlockInBody ? FALSE : brief, // isBrief
8422 yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
8423 yyextra->docBlockInBody, // isInBody
8424 yyextra->protection,
8425 position,
8426 needsEntry,
8427 Config_getBool(MARKDOWN_SUPPORT),
8428 &guards
8429 )
8430 )
8431 {
8432 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8433 if (needsEntry)
8434 {
8435 QCString docFile = yyextra->current->docFile;
8436 newEntry(yyscanner);
8437 yyextra->current->docFile = docFile;
8438 yyextra->current->docLine = lineNr;
8439 }
8440 }
8441 if (needsEntry)
8442 {
8443 newEntry(yyscanner);
8444 }
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:8373
QCString stripIndentation(const QCString &s, bool skipFirstLine)
Definition util.cpp:5972
8445
8446 if (yyextra->docBlockTerm)
8447 {
8448 unput(yyextra->docBlockTerm);
8449 yyextra->docBlockTerm=0;
8450 }
8451}

References Trace::trunc().

◆ handleParametersCommentBlocks()

void handleParametersCommentBlocks ( yyscan_t yyscanner,
ArgumentList & al )
static

Definition at line 8453 of file scanner.l.

8454{
8455 AUTO_TRACE();
8456 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8457 for (Argument &a : al)
8458 {
8459 AUTO_TRACE_ADD("Param '{}' docs='{}'",a.name,Trace::trunc(a.docs));
8460 if (!a.docs.isEmpty())
8461 {
8462 if (a.name.isEmpty() && a.type == "...") a.name= "...";
8463 int position=0;
8464 bool needsEntry;
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:48
8465
8466 // save context
8467 QCString orgDoc = yyextra->current->doc;
8468 QCString orgBrief = yyextra->current->brief;
8469 int orgDocLine = yyextra->current->docLine;
8470 int orgBriefLine = yyextra->current->briefLine;
8471
8472 yyextra->current->doc.clear();
8473 yyextra->current->brief.clear();
8474
8475 //printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
8476 int lineNr = orgDocLine;
8477 GuardedSectionStack guards;
8478 Markdown markdown(yyextra->fileName,lineNr);
8479 QCString strippedDoc = stripIndentation(a.docs);
8480 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8481 while (yyextra->commentScanner.parseCommentBlock(
8482 yyextra->thisParser,
8483 yyextra->current.get(),
8484 processedDoc, // text
8485 yyextra->fileName, // file
8486 lineNr,
8487 FALSE,
8488 FALSE,
8489 FALSE,
8490 yyextra->protection,
8491 position,
8492 needsEntry,
8493 Config_getBool(MARKDOWN_SUPPORT),
8494 &guards
8495 )
8496 )
8497 {
8498 //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8499 if (needsEntry) newEntry(yyscanner);
8500 }
8501 if (needsEntry)
8502 {
8503 newEntry(yyscanner);
8504 }
8505 a.docs = yyextra->current->doc;
8506
8507 // restore context
8508 yyextra->current->doc = orgDoc;
8509 yyextra->current->brief = orgBrief;
8510 yyextra->current->docLine = orgDocLine;
8511 yyextra->current->briefLine = orgBriefLine;
8512 }
8513 }
8514}

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

◆ initEntry()

void initEntry ( yyscan_t yyscanner)
static

Definition at line 7972 of file scanner.l.

7973{
7974 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7975 if (yyextra->insideJava)
7976 {
7977 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
7978 }
7979 yyextra->current->protection = yyextra->protection;
7980 yyextra->current->exported = yyextra->exported ;
7981 yyextra->current->mtype = yyextra->mtype;
7982 yyextra->current->virt = yyextra->virt;
7983 yyextra->current->isStatic = yyextra->isStatic;
7984 yyextra->current->lang = yyextra->language;
7985 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
7986 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
7987 yyextra->isTypedef=FALSE;
7988}

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 8043 of file scanner.l.

8044{
8045 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8046 yyextra->current->protection = yyextra->protection = prot;
8047 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
8048 yyextra->current->type.clear();
8049 yyextra->current->name.clear();
8050 yyextra->current->args.clear();
8051 yyextra->current->argList.clear();
8052 lineCount(yyscanner) ;
#define lineCount(s, len)
8053}

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 7948 of file scanner.l.

7949{
7950 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7951 yyextra->outerScopeEntries.clear();
7952 yyextra->baseName.clear();
7953 yyextra->protection = Protection::Public;
7954 yyextra->baseProt = Protection::Public;
7955 yyextra->sharpCount = 0;
7956 yyextra->roundCount = 0;
7957 yyextra->curlyCount = 0;
7958 yyextra->mtype = MethodTypes::Method;
7959 yyextra->isStatic = FALSE;
7960 yyextra->virt = Specifier::Normal;
7961 yyextra->baseVirt = Specifier::Normal;
7962 yyextra->isTypedef = FALSE;
7963 yyextra->insideTryBlock = FALSE;
7964 yyextra->insideFormula = FALSE;
7965 yyextra->insideCode=FALSE;
7966 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
7967 yyextra->previous = 0;
7968 yyextra->firstTypedefEntry.reset();
7969 yyextra->memspecEntry.reset();
7970}

References FALSE.

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 8002 of file scanner.l.

8003{
8004 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8005 int tabSize = Config_getInt(TAB_SIZE);
8006 const char *p;
8007 for (p = yytext ; *p ; ++p )
8008 {
8009 if (*p=='\n')
8010 {
8011 yyextra->yyLineNr++;
8012 yyextra->column=0;
8013 yyextra->yyColNr=1;
8014 }
8015 else if (*p=='\t')
8016 {
8017 yyextra->column+=tabSize - (yyextra->column%tabSize);
8018 }
8019 else
8020 {
8021 yyextra->column++;
8022 yyextra->yyColNr++;
8023 }
8024 }
8025 //printf("lineCount()=%d\n",yyextra->column);
8026}

◆ nameIsOperator()

bool nameIsOperator ( QCString & name)
static

Definition at line 8142 of file scanner.l.

8143{
8144 int i=name.find("operator");
8145 if (i==-1) return FALSE;
8146 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
8147 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
8148 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:256
8149}

References FALSE, isId(), and TRUE.

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8373 of file scanner.l.

8374{
8375 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8376 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
8377 // and yyextra->current is actually replaced by yyextra->previous which was
8378 // already added to yyextra->current_root, so we should not add it again
8379 // (see bug723314)
8380 {
8381 yyextra->previous = yyextra->current;
8382 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8383 }
8384 else
8385 {
8386 yyextra->previous = yyextra->current;
8387 yyextra->current = yyextra->tempEntry;
8388 yyextra->tempEntry.reset();
8389 }
8390 initEntry(yyscanner);
static void initEntry(yyscan_t yyscanner)
Definition scanner.l:7972
8391}

◆ parseCompounds()

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

Definition at line 8519 of file scanner.l.

8520{
8521 AUTO_TRACE("name={}",rt->name);
8522 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8523 for (const auto &ce : rt->children())
8524 {
8525 if (!ce->program.empty())
8526 {
8527 AUTO_TRACE_ADD("compound name='{}' program='{}'",Trace::trunc(ce->name),Trace::trunc(ce->program.str()));
8528 // init scanner state
8529 yyextra->padCount=0;
8530 yyextra->column=0;
8531 yyextra->programStr = ce->program.str();
8532 yyextra->inputString = yyextra->programStr.data();
8533 yyextra->inputPosition = 0;
8534 if (ce->section.isEnum() || ce->spec.isEnum())
8535 BEGIN( FindFields ) ;
8536 else
8537 BEGIN( FindMembers ) ;
8538 yyextra->current_root = ce;
8539 yyextra->fileName = ce->fileName;
8540 //setContext();
8541 yyextra->yyLineNr = ce->bodyLine;
8542 yyextra->yyColNr = ce->bodyColumn;
8543 yyextra->insideObjC = ce->lang==SrcLangExt::ObjC;
8544 //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
8545 yyextra->current = std::make_shared<Entry>();
8546 yyextra->isStatic = FALSE;
8547 initEntry(yyscanner);
8548
8549 // deep copy group list from parent (see bug 727732)
8550 bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
8551 if (autoGroupNested && !rt->groups.empty() && !ce->section.isEnum() && !ce->spec.isEnum())
8552 {
8553 ce->groups = rt->groups;
8554 }
8555
8556 int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2;
8557 // set default protection based on the compound type
8558 if ( ce->section.isClass() ) // class
8559 {
8560 if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
8561 {
8562 yyextra->current->protection = yyextra->protection = Protection::Public ;
8563 }
8564 else if (yyextra->insideJava)
8565 {
8566 yyextra->current->protection = yyextra->protection = (ce->spec.isInterface() || ce->spec.isEnum()) ? Protection::Public : Protection::Package;
8567 }
8568 else if (ce->spec.isInterface() || ce->spec.isRef() || ce->spec.isValue() || ce->spec.isStruct() || ce->spec.isUnion())
8569 {
8570 if (ce->lang==SrcLangExt::ObjC)
8571 {
8572 yyextra->current->protection = yyextra->protection = Protection::Protected ;
8573 }
8574 else
8575 {
8576 yyextra->current->protection = yyextra->protection = Protection::Public ;
8577 }
8578 }
8579 else
8580 {
8581 yyextra->current->protection = yyextra->protection = Protection::Private ;
8582 }
8583 }
8584 else if (ce->section.isEnum() ) // enum
8585 {
8586 yyextra->current->protection = yyextra->protection = ce->protection;
8587 }
8588 else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
8589 {
8590 if (ce->section.isNamespace() ) // unnamed namespace
8591 {
8592 yyextra->current->isStatic = yyextra->isStatic = TRUE;
8593 }
8594 yyextra->current->protection = yyextra->protection = ce->protection;
8595 yyextra->current->exported = yyextra->exported = false;
8596 }
8597 else if (ce->section.isNamespace() )
8598 {
8599 yyextra->current->protection = yyextra->protection = Protection::Public ;
8600 yyextra->current->exported = yyextra->exported = ce->exported;
8601 }
8602 else // named struct, union, protocol, category
8603 {
8604 yyextra->current->protection = yyextra->protection = Protection::Public ;
8605 yyextra->current->exported = yyextra->exported = false;
8606 }
8607 yyextra->mtype = MethodTypes::Method;
8608 yyextra->virt = Specifier::Normal;
8609 //printf("name=%s yyextra->current->isStatic=%d yyextra->isStatic=%d\n",qPrint(ce->name),yyextra->current->isStatic,yyextra->isStatic);
8610
8611 //memberGroupId = DOX_NOGROUP;
8612 //memberGroupRelates.clear();
8613 //memberGroupInside.clear();
8614 QCString name = ce->name;
8615 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
8616
8617 scannerYYlex(yyscanner);
8618 //forceEndGroup();
8619
8620 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
8621
8622 yyextra->programStr.clear();
8623 ce->program.str(std::string());
8624
8625
8626 //if (depthIf>0)
8627 //{
8628 // warn(yyextra->fileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
8629 //}
8630 }
8631 parseCompounds(yyscanner,ce);
8632 }
static void parseCompounds(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8519
8633}

References FALSE, and Trace::trunc().

◆ parseConcepts()

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

Definition at line 8635 of file scanner.l.

8636{
8637 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8638 for (const auto &ce : rt->children())
8639 {
8640 if (ce->section.isConcept())
8641 {
8642 //printf("*** found concept '%s' value=[[\n%s\n]] line=%d,col=%d\n",
8643 // qPrint(ce->name),qPrint(ce->initializer.str()),ce->startLine,ce->startColumn);
8644 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8645 // init scanner state
8646 yyextra->padCount =0;
8647 yyextra->column =0;
8648 yyextra->programStr = ce->initializer.str();
8649 yyextra->inputString = yyextra->programStr.data();
8650 yyextra->inputPosition = 0;
8651 yyextra->current_root = ce;
8652 yyextra->fileName = ce->fileName;
8653 yyextra->yyLineNr = ce->bodyLine;
8654 yyextra->yyColNr = ce->bodyColumn;
8655 yyextra->insideObjC = false;
8656 yyextra->current = std::make_shared<Entry>();
8657
8658 // hack to reconstruct what was in the code before the concept expression
8659 QCString indent;
8660 indent.fill(' ',std::max(0,ce->startColumn-1));
8661 QCString templArgs;
8662 if (!ce->args.isEmpty())
8663 {
8664 templArgs=indent+"template"+ce->args+"\n";
8665 }
8666 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
8667
8668 yyextra->isStatic = FALSE;
8669 initEntry(yyscanner);
8670 yyextra->current->section = EntryType::makeConceptCodePart();
8671 yyextra->current->startLine = yyextra->yyLineNr;
8672 BEGIN( FindConceptParts );
8673 scannerYYlex(yyscanner);
8674 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8675
8676 }
8677 parseConcepts(yyscanner,ce);
8678 }
static void parseConcepts(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8635
8679}

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 8683 of file scanner.l.

8688{
8689 AUTO_TRACE("fileName={}",fileName);
8690 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8691 initParser(yyscanner);
static void initParser(yyscan_t yyscanner)
Definition scanner.l:7948
8692
8693 yyextra->inputString = fileBuf;
8694 yyextra->inputPosition = 0;
8695 yyextra->column = 0;
8696 scannerYYrestart(nullptr,yyscanner);
8697
8698 //depthIf = 0;
8699 yyextra->protection = Protection::Public;
8700 yyextra->mtype = MethodTypes::Method;
8701 yyextra->isStatic = FALSE;
8702 yyextra->exported = false;
8703 yyextra->virt = Specifier::Normal;
8704 yyextra->current_root = rt;
8705 yyextra->yyLineNr = 1 ;
8706 yyextra->yyBegLineNr = 1;
8707 yyextra->yyBegColNr = 0;
8708 yyextra->anonCount = 0;
8709 yyextra->anonNSCount = 0;
8710 yyextra->fileName = fileName;
8711 yyextra->clangParser = clangParser;
8712 setContext(yyscanner);
8713 rt->lang = yyextra->language;
8714 msg("Parsing file {}...\n",yyextra->fileName);
#define msg(fmt,...)
Definition message.h:94
static void setContext(yyscan_t yyscanner)
Definition scanner.l:8153
8715
8716 yyextra->current_root = rt;
8717 initParser(yyscanner);
8718 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
8719 yyextra->current = std::make_shared<Entry>();
8720 //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
8721 EntryType sec=guessSection(yyextra->fileName);
8722 if (!sec.isEmpty())
8723 {
8724 yyextra->current->name = yyextra->fileName;
8725 yyextra->current->section = sec;
8726 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8727 }
8728 yyextra->current->reset();
8729 initEntry(yyscanner);
8730 if ( yyextra->insidePHP )
8731 {
8732 BEGIN( FindMembersPHP );
8733 }
8734 else if ( yyextra->insideJava ) // add default java.lang package scope
8735 {
8736 yyextra->current->name="java::lang"; // '::' is used in doxygen's internal representation as a scope separator
8737 yyextra->current->fileName = yyextra->fileName;
8738 yyextra->current->section = EntryType::makeUsingDir();
8739 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8740 initEntry(yyscanner);
8741 BEGIN( FindMembers );
8742 }
8743 else
8744 {
8745 BEGIN( FindMembers );
8746 }
Wrapper class for the Entry type.
Definition types.h:816
EntryType guessSection(const QCString &name)
Definition util.cpp:338
8747
8748 scannerYYlex(yyscanner);
8749
8750 if (YY_START==Comment)
8751 {
8752 warn(yyextra->fileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?");
8753 }
#define warn(file, line, fmt,...)
Definition message.h:97
8754
8755 //forceEndGroup();
8756 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
8757
8758 yyextra->programStr.clear();
8759 rt->program.str(std::string());
8760
8761 parseCompounds(yyscanner,rt);
8762 parseConcepts(yyscanner,rt);
8763
8764 yyextra->anonNSCount++;
8765
8766 // add additional entries that were created during processing
8767 for (auto &[parent,child]: yyextra->outerScopeEntries)
8768 {
8769 //printf(">>> adding '%s' to scope '%s'\n",qPrint(child->name),qPrint(parent->name));
8770 parent->moveToSubEntryAndKeep(child);
8771 }
8772 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
8773
8774}

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 8778 of file scanner.l.

8779{
8780 AUTO_TRACE("text='{}'",Trace::trunc(text));
8781 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8782 if (text.isEmpty())
8783 {
8784 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8785 return;
8786 }
8787 if (!yyextra->current) // nothing to store (see bug683516)
8788 {
8789 return;
8790 }
8791
8792 const char *orgInputString;
8793 int orgInputPosition;
8794 YY_BUFFER_STATE orgState;
8795
8796 // save scanner state
8797 orgState = YY_CURRENT_BUFFER;
8798 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8799 orgInputString = yyextra->inputString;
8800 orgInputPosition = yyextra->inputPosition;
#define YY_BUF_SIZE
Definition commentcnv.l:19
8801
8802 // set new string
8803 yyextra->inputString = text.data();
8804 yyextra->inputPosition = 0;
8805 yyextra->column = 0;
8806 scannerYYrestart(nullptr, yyscanner);
8807 BEGIN(Prototype);
8808 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
8809
8810 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8811 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.isEmpty())
8812 {
8813 yyextra->current->section = EntryType::makeVariableDoc();
8814 }
8815
8816 // restore original scanner state
8817 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8818 yy_switch_to_buffer(orgState, yyscanner);
8819 yyextra->inputString = orgInputString;
8820 yyextra->inputPosition = orgInputPosition;
8821
8822
8823 //printf("**** parsePrototype end\n");
8824}

References Trace::trunc().

◆ prependScope()

void prependScope ( yyscan_t yyscanner)
static

Definition at line 8175 of file scanner.l.

8176{
8177 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8178 if (yyextra->current_root->section.isScope())
8179 {
8180 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
8181 yyextra->current->name.prepend(yyextra->current_root->name+"::");
8182 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
8183 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
8184 {
8185 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
8186 }
8187 }
This class represents an function or template argument list.
Definition arguments.h:65
8188}

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 8153 of file scanner.l.

8154{
8155 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8156 yyextra->language = getLanguageFromFileName(yyextra->fileName);
8157 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
8158 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
8159 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
8160 yyextra->insideD = yyextra->language==SrcLangExt::D;
8161 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
8162 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
8163 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
8164 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
8165 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
8166 yyextra->language==SrcLangExt::Lex);
8167 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
8168 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
8169 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
8170 // );
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5214
8171}

Referenced by parseMain().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 8207 of file scanner.l.

8208{
8209 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8210 if (yyextra->insideJava)
8211 {
8212 QCString text=yytext;
8213 yyextra->current->protection = Protection::Public;
8214 if (text.find("protected")!=-1)
8215 yyextra->current->protection = Protection::Protected;
8216 else if (text.find("private")!=-1)
8217 yyextra->current->protection = Protection::Private;
8218 else if (text.find("package")!=-1)
8219 yyextra->current->protection = Protection::Package;
8220 }
8221}

References QCString::find().

◆ splitKnRArg()

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

Definition at line 8224 of file scanner.l.

8225{
8226 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8227 int si = static_cast<int>(yyextra->current->args.length());
8228 if (yyextra->oldStyleArgType.isEmpty()) // new argument
8229 {
8230 std::string args = yyextra->current->args.str();
8231 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
8232 int bi1=-1;
8233 int bi2=-1;
8235 if (reg::search(args,match,re))
8236 {
8237 bi1=(int)match.position();
8238 size_t secondMatchStart = match.position()+match.length(); // search again after first match
8239 if (reg::search(args,match,re,secondMatchStart))
8240 {
8241 bi2=(int)match.position();
8242 }
8243 }
8244 char c;
8245 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
8246 {
8247 int s=bi2+1; // keep opening (
8248 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8249 int i=s;
8250 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8251 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8252 s=i;
8253 while (i<si && isId(yyextra->current->args.at(i))) i++;
8254 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8255 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
8256 }
8257 else if (bi1!=-1) // redundant braces like in "int (*var)"
8258 {
8259 int s=bi1; // strip opening (
8260 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8261 s++;
8262 int i=s+1;
8263 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8264 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8265 s=i;
8266 while (i<si && isId(yyextra->current->args.at(i))) i++;
8267 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8268 }
8269 else // normal "int *var"
8270 {
8271 int l=si,i=l-1,j;
8272 // look for start of name in "type *name"
8273 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
8274 j=i+1;
8275 // look for start of *'s
8276 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
8277 i++;
8278 if (i!=l)
8279 {
8280 yyextra->oldStyleArgType=yyextra->current->args.left(i);
8281 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
8282 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8283 }
8284 else
8285 {
8286 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8287 }
8288 }
8289 }
8290 else // continuation like *arg2 in "int *args,*arg2"
8291 {
8292 int l=si,j=0;
8293 char c;
8294 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
8295 if (j>0)
8296 {
8297 oldStyleArgPtr=yyextra->current->args.left(j);
8298 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8299 }
8300 else
8301 {
8302 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8303 }
8304 }
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
8305}

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

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8356 of file scanner.l.

8357{
8358 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8359 if (brief)
8360 {
8361 yyextra->current->briefFile = yyextra->fileName;
8362 yyextra->current->briefLine = yyextra->yyLineNr;
8363 }
8364 else
8365 {
8366 yyextra->current->docFile = yyextra->fileName;
8367 yyextra->current->docLine = yyextra->yyLineNr;
8368 }
8369}

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 8134 of file scanner.l.

8135{
8136 QCString r = req.stripWhiteSpace();
8137 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:524
8138}

◆ startVerbatimBlock()

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

Definition at line 8101 of file scanner.l.

8102{
8103 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8104 if (Config_getBool(MARKDOWN_SUPPORT))
8105 {
8106 yyextra->docBlock << "\\iskip";
8107 }
8108 yyextra->docBlockName=blockName;
8109 yyextra->fencedSize=fencedSize;
8110 yyextra->isCodeBlock=codeBlock;
8111 yyextra->nestedComment=0;
8112}

◆ stateToString()

const char * stateToString ( int state)
static

◆ storeClangId()

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

Definition at line 7993 of file scanner.l.

7994{
7995 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7996 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
7997 {
7998 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
7999 }
8000}

◆ stripFuncPtr()

QCString stripFuncPtr ( const QCString & type)
static

Definition at line 8088 of file scanner.l.

8089{
8090 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
8091 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
8092 size_t i=type.length();
8093 bool funcPtr = i>0 && type[i-1]==')';
8094 if (funcPtr) i--;
8095 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
8096 if (funcPtr && i>0 && type[i-1]=='(') i--;
8097 return type.left(i);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
8098}

◆ stripQuotes()

QCString stripQuotes ( const char * s)
static

Definition at line 8076 of file scanner.l.

8077{
8078 QCString name;
8079 if (s==nullptr || *s==0) return name;
8080 name=s;
8081 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
8082 {
8083 name=name.mid(1,name.length()-2);
8084 }
8085 return name;
8086}

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 511 of file scanner.l.

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

◆ yyread()

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

Definition at line 7934 of file scanner.l.

7935{
7936 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7937 int c=0;
7938 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7939 {
7940 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7941 //printf("%d (%c)\n",*buf,*buf);
7942 c++; buf++;
7943 }
7944 return c;
7945}