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

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

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

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 8048 of file scanner.l.

8049{
8050 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8051 size_t tl=yyextra->current->type.length();
8052 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8053 {
8054 yyextra->current->type += ' ' ;
8055 }
8056 yyextra->current->type += yyextra->current->name;
8057 yyextra->current->name.clear() ;
8058 tl=yyextra->current->type.length();
8059 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8060 {
8061 yyextra->current->type += ' ' ;
8062 }
8063 yyextra->current->type += yyextra->current->args ;
8064 yyextra->current->args.clear() ;
8065 yyextra->current->argList.clear();
8066}

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

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

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

◆ computeIndent()

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

Definition at line 8021 of file scanner.l.

8022{
8023 int col=startIndent;
8024 int tabSize=Config_getInt(TAB_SIZE);
8025 const char *p=s;
8026 char c;
8027 while ((c=*p++))
8028 {
8029 if (c=='\t') col+=tabSize-(col%tabSize);
8030 else if (c=='\n') col=0;
8031 else col++;
8032 }
8033 return col;
#define Config_getInt(name)
Definition config.h:34
8034}

◆ endVerbatimBlock()

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

Definition at line 8108 of file scanner.l.

8109{
8110 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8111 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
8112 {
8113 if (Config_getBool(MARKDOWN_SUPPORT))
8114 {
8115 yyextra->docBlock << "\\endiskip";
8116 }
8117 yyextra->docBlockName="";
8118 return true;
8119 }
8120 return false;
#define Config_getBool(name)
Definition config.h:33
8121}

References Config_getBool.

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 8335 of file scanner.l.

8336{
8337 for (Argument &a : al)
8338 {
8339 if (!a.type.isEmpty() && a.name.isEmpty())
8340 { // a->type is actually the (typeless) parameter name, so move it
8341 a.name=a.type;
8342 a.type.clear();
8343 }
8344 }
8345}

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

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

References Trace::trunc().

◆ handleParametersCommentBlocks()

void handleParametersCommentBlocks ( yyscan_t yyscanner,
ArgumentList & al )
static

Definition at line 8446 of file scanner.l.

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

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

◆ initEntry()

void initEntry ( yyscan_t yyscanner)
static

Definition at line 7965 of file scanner.l.

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

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 8036 of file scanner.l.

8037{
8038 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8039 yyextra->current->protection = yyextra->protection = prot;
8040 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
8041 yyextra->current->type.clear();
8042 yyextra->current->name.clear();
8043 yyextra->current->args.clear();
8044 yyextra->current->argList.clear();
8045 lineCount(yyscanner) ;
#define lineCount(s, len)
8046}

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 7941 of file scanner.l.

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

References FALSE.

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 7995 of file scanner.l.

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

◆ nameIsOperator()

bool nameIsOperator ( QCString & name)
static

Definition at line 8135 of file scanner.l.

8136{
8137 int i=name.find("operator");
8138 if (i==-1) return FALSE;
8139 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
8140 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
8141 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:208
8142}

References FALSE, isId(), and TRUE.

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8366 of file scanner.l.

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

◆ parseCompounds()

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

Definition at line 8512 of file scanner.l.

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

References FALSE, and Trace::trunc().

◆ parseConcepts()

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

Definition at line 8628 of file scanner.l.

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

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

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

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

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

References Trace::trunc().

◆ prependScope()

void prependScope ( yyscan_t yyscanner)
static

Definition at line 8168 of file scanner.l.

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

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 8146 of file scanner.l.

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

Referenced by parseMain().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 8200 of file scanner.l.

8201{
8202 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8203 if (yyextra->insideJava)
8204 {
8205 QCString text=yytext;
8206 yyextra->current->protection = Protection::Public;
8207 if (text.find("protected")!=-1)
8208 yyextra->current->protection = Protection::Protected;
8209 else if (text.find("private")!=-1)
8210 yyextra->current->protection = Protection::Private;
8211 else if (text.find("package")!=-1)
8212 yyextra->current->protection = Protection::Package;
8213 }
8214}

References QCString::find().

◆ splitKnRArg()

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

Definition at line 8217 of file scanner.l.

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

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

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8349 of file scanner.l.

8350{
8351 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8352 if (brief)
8353 {
8354 yyextra->current->briefFile = yyextra->fileName;
8355 yyextra->current->briefLine = yyextra->yyLineNr;
8356 }
8357 else
8358 {
8359 yyextra->current->docFile = yyextra->fileName;
8360 yyextra->current->docLine = yyextra->yyLineNr;
8361 }
8362}

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 8127 of file scanner.l.

8128{
8129 QCString r = req.stripWhiteSpace();
8130 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:524
8131}

◆ startVerbatimBlock()

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

Definition at line 8094 of file scanner.l.

8095{
8096 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8097 if (Config_getBool(MARKDOWN_SUPPORT))
8098 {
8099 yyextra->docBlock << "\\iskip";
8100 }
8101 yyextra->docBlockName=blockName;
8102 yyextra->fencedSize=fencedSize;
8103 yyextra->isCodeBlock=codeBlock;
8104 yyextra->nestedComment=0;
8105}

◆ stateToString()

const char * stateToString ( int state)
static

◆ storeClangId()

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

Definition at line 7986 of file scanner.l.

7987{
7988 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7989 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
7990 {
7991 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
7992 }
7993}

◆ stripFuncPtr()

QCString stripFuncPtr ( const QCString & type)
static

Definition at line 8081 of file scanner.l.

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

◆ stripQuotes()

QCString stripQuotes ( const char * s)
static

Definition at line 8069 of file scanner.l.

8070{
8071 QCString name;
8072 if (s==nullptr || *s==0) return name;
8073 name=s;
8074 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
8075 {
8076 name=name.mid(1,name.length()-2);
8077 }
8078 return name;
8079}

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:8036
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:8048
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:7986
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:1234
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:8200
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:568
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:2874
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:8135
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:8127
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:8386
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:8069
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:8021
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:8349
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:6937
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:6945
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:8081
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:8168
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:3542
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:8335
static void handleParametersCommentBlocks(yyscan_t yyscanner, ArgumentList &al)
Definition scanner.l:8446
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:4954
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:8186
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:8306
static void splitKnRArg(yyscan_t yyscanner, QCString &oldStyleArgPtr, QCString &oldStyleArgName)
Definition scanner.l:8217
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:4970
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:4932
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 unput('{'); // dummy start body
6991 }
6992 else
6993 {
6994 yyless(1);
6995 }
6996 }
6997 else
6998 {
6999 if (*yytext==',' && yyextra->insideObjC) // Begin of protocol list
7000 {
7001 yyextra->insideProtocolList=TRUE;
7002 }
7003 BEGIN(BasesProt);
7004 }
7005 }
7006<Bases>{B}*"{"{B}* {
7007 yyextra->current->program.str(std::string());
7008 yyextra->current->fileName = yyextra->fileName ;
7009 yyextra->current->bodyLine = yyextra->yyLineNr;
7010 yyextra->current->bodyColumn = yyextra->yyColNr;
7011 yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name);
7012 if (!yyextra->baseName.isEmpty())
7013 {
7014 yyextra->current->extends.emplace_back(
7015 yyextra->baseName,yyextra->baseProt,yyextra->baseVirt
7016 );
7017 yyextra->baseName.clear();
7018 }
7019 yyextra->curlyCount=0;
7020 if (yyextra->insideObjC)
7021 {
7022 BEGIN( ReadBodyIntf );
7023 }
7024 else
7025 {
7026 BEGIN( ReadBody ) ;
7027 }
7028 }
7029<SkipUnionSwitch>{B}*"(" {
7030 yyextra->roundCount++;
7031 }
7032<SkipUnionSwitch>")" {
7033 if (--yyextra->roundCount==0)
7034 {
7035 BEGIN(ClassVar);
7036 }
7037 }
7038<SkipUnionSwitch>\n { lineCount(yyscanner); }
7039<SkipUnionSwitch>.
7040<Comment>{BN}+ { yyextra->current->program << yytext ;
7041 lineCount(yyscanner) ;
7042 }
7043<Comment>{CCS} { yyextra->current->program << yytext ; }
7044<Comment>{CPPC} { yyextra->current->program << yytext ; }
7045<Comment>{CMD}("code"|"verbatim"|"iliteral") {
7046 if (yyextra->doxygenComment) yyextra->insideCode=TRUE;
7047 yyextra->current->program << yytext ;
7048 }
7049<Comment>{CMD}("endcode"|"endverbatim"|"endiliteral") {
7050 if (yyextra->doxygenComment) yyextra->insideCode=FALSE;
7051 yyextra->current->program << yytext ;
7052 }
7053<Comment>[^ \.\t\r\n\/\*]+ { yyextra->current->program << yytext ; }
7054<Comment>{CCE} { yyextra->current->program << yytext ;
7055 if (!yyextra->insideCode)
7056 {
7057 yyextra->doxygenComment=false;
7058 BEGIN( yyextra->lastContext );
7059 }
7060 }
7061<Comment>. { yyextra->current->program << *yytext ; }
7062
7063<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,SkipC11Inits,SkipC11Attribute,ReadExpressionBody,Bases,OldStyleArgs>({CPPC}{B}*)?{CCS}"!" {
7064 //printf("Start doc block at %d\n",yyextra->yyLineNr);
7065 if (!yyextra->current->doc.isEmpty())
7066 {
7067 yyextra->current->doc+="\n\n";
7068 }
7069 else
7070 {
7071 yyextra->current->docLine = yyextra->yyLineNr;
7072 yyextra->current->docFile = yyextra->fileName;
7073 }
7074
7075 yyextra->lastDocContext = YY_START;
7076 if (yyextra->current_root->section.isScope())
7077 {
7078 yyextra->current->inside = yyextra->current_root->name+"::";
7079 }
7080 yyextra->docBlockContext = YY_START;
7081 yyextra->docBlockInBody = YY_START==SkipCurly || YY_START==ReadExpressionBody;
7082 yyextra->docBlockAutoBrief = Config_getBool(QT_AUTOBRIEF);
7083
7084 QCString indent;
7085 indent.fill(' ',computeIndent(yytext,yyextra->column));
7086 yyextra->docBlock.str(indent.str());
7087
7088 if (yyextra->docBlockAutoBrief)
7089 {
7090 yyextra->current->briefLine = yyextra->yyLineNr;
7091 yyextra->current->briefFile = yyextra->fileName;
7092 }
7093 startCommentBlock(yyscanner,FALSE);
7094 BEGIN( DocBlock );
7095 }
7096<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,SkipInits,ReadExpressionBody,Bases,OldStyleArgs>{CCS}"*"[*]+{BL} {
7097 bool javadocBanner = Config_getBool(JAVADOC_BANNER);
7098 lineCount(yyscanner);
7099
7100 if( javadocBanner )
7101 {
7102 yyextra->lastDocContext = YY_START;
7103
7104 //printf("Found comment banner at %s:%d\n",yyextra->fileName,yyextra->yyLineNr);
7105 if (yyextra->current_root->section.isScope())
7106 {
7107 yyextra->current->inside = yyextra->current_root->name+"::";
7108 }
7109 yyextra->current->docLine = yyextra->yyLineNr;
7110 yyextra->current->docFile = yyextra->fileName;
7111 yyextra->docBlockContext = YY_START;
7112 yyextra->docBlockInBody = YY_START==SkipCurly || YY_START==ReadExpressionBody;
7113 bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF);
7114 yyextra->docBlockAutoBrief = javadocAutoBrief;
7115
7116 QCString indent;
7117 indent.fill(' ',computeIndent(yytext,yyextra->column));
7118 yyextra->docBlock.str(indent.str());
7119
7120 if (yyextra->docBlockAutoBrief)
7121 {
7122 yyextra->current->briefLine = yyextra->yyLineNr;
7123 yyextra->current->briefFile = yyextra->fileName;
7124 }
7125 startCommentBlock(yyscanner,FALSE);
7126 BEGIN( DocBlock );
7127 }
7128 else
7129 {
7130 yyextra->current->program << yytext ;
7131 yyextra->lastContext = YY_START ;
7132 yyextra->doxygenComment=true;
7133 BEGIN( Comment ) ;
7134 }
7135 }
7136<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,Operator,ClassVar,ReadExpressionBody,SkipInits,Bases,OldStyleArgs>^{B}+({CPPC}{B}*)?{CCS}"*"/{NCOMM} {
7137 lineCount(yyscanner);
7138 yyextra->yyColNr=1;
7139 REJECT;
7140 }
7141<FindMembers,FindFields,MemberSpec,FuncQual,SkipCurly,ReadExpressionBody,Operator,ClassVar,SkipInits,Bases,OldStyleArgs>({CPPC}{B}*)?{CCS}"*"/{NCOMM} {
7142 yyextra->lastDocContext = YY_START;
7143
7144 //printf("Found comment block at %s:%d\n",yyextra->fileName,yyextra->yyLineNr);
7145 if (yyextra->current_root->section.isScope())
7146 {
7147 yyextra->current->inside = yyextra->current_root->name+"::";
7148 }
7149 yyextra->current->docLine = yyextra->yyLineNr;
7150 yyextra->current->docFile = yyextra->fileName;
7151 yyextra->docBlockContext = YY_START;
7152 yyextra->docBlockInBody = YY_START==SkipCurly || YY_START==ReadExpressionBody;
7153 bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF);
7154 yyextra->docBlockAutoBrief = javadocAutoBrief;
7155
7156 QCString indent;
7157 indent.fill(' ',computeIndent(yytext,yyextra->column));
7158 yyextra->docBlock.str(indent.str());
7159
7160 if (yyextra->docBlockAutoBrief)
7161 {
7162 yyextra->current->briefLine = yyextra->yyLineNr;
7163 yyextra->current->briefFile = yyextra->fileName;
7164 }
7165 startCommentBlock(yyscanner,FALSE);
7166 BEGIN( DocBlock );
7167 }
7168<FindMembers,FindFields,MemberSpec,SkipCurly,ReadExpressionBody,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>{CPPC}"!" {
7169 yyextra->lastDocContext = YY_START;
7170 if (yyextra->current_root->section.isScope())
7171 {
7172 yyextra->current->inside = yyextra->current_root->name+"::";
7173 }
7174 yyextra->docBlockContext = YY_START;
7175 yyextra->docBlockInBody = YY_START==SkipCurly || YY_START==ReadExpressionBody;
7176 yyextra->docBlockAutoBrief = FALSE;
7177
7178 QCString indent;
7179 indent.fill(' ',computeIndent(yytext,yyextra->column));
7180 yyextra->docBlock.str(indent.str());
7181
7182 startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
7183 BEGIN( DocLine );
7184 }
7185<FindMembers,FindFields,MemberSpec,SkipCurly,ReadExpressionBody,FuncQual,Operator,ClassVar,Bases,OldStyleArgs>{CPPC}"/"/[^/] {
7186 yyextra->lastDocContext = YY_START;
7187 if (yyextra->current_root->section.isScope())
7188 {
7189 yyextra->current->inside = yyextra->current_root->name+"::";
7190 }
7191 yyextra->docBlockContext = YY_START;
7192 yyextra->docBlockInBody = YY_START==SkipCurly || YY_START==ReadExpressionBody;
7193 yyextra->docBlockAutoBrief = FALSE;
7194 QCString indent;
7195 indent.fill(' ',computeIndent(yytext,yyextra->column));
7196 yyextra->docBlock.str(indent.str());
7197 startCommentBlock(yyscanner,yyextra->current->brief.isEmpty());
7198 BEGIN( DocLine );
7199 }
7200<FindMembers>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
7201 lineCount(yyscanner);
7202 yyextra->externLinkage=TRUE;
7203 }
7204<FindMembers>"{" {
7205 if (yyextra->externLinkage)
7206 {
7207 yyextra->externLinkage=FALSE;
7208 }
7209 else if (yyextra->insideCS &&
7210 !yyextra->current->name.isEmpty() &&
7211 !yyextra->current->type.isEmpty())
7212 {
7213 if (yyextra->current->mtype == MethodTypes::Event)
7214 {
7215 yyextra->mtype = MethodTypes::Event;
7216 }
7217 else if (containsWord(yyextra->current->type,"event")) // event
7218 {
7219 yyextra->current->mtype = yyextra->mtype = MethodTypes::Event;
7220 }
7221 else // property
7222 {
7223 yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
7224 }
7225 yyextra->current->bodyLine = yyextra->yyLineNr;
7226 yyextra->current->bodyColumn = yyextra->yyColNr;
7227 yyextra->curlyCount=0;
7228 BEGIN( CSAccessorDecl );
7229 }
7230 else if (yyextra->insideIDL && yyextra->current->spec.isAttribute())
7231 {
7232 // UNO IDL: attributes may have setter and getter
7233 // exception specifications
7234 yyextra->current->exception = " {";
7235 BEGIN(UNOIDLAttributeBlock);
7236 }
7237 else
7238 {
7239 if ((yyextra->insideJava || yyextra->insideCS || yyextra->insideD) &&
7240 yyextra->current->name.isEmpty()
7241 )
7242 {
7243 // static Java initializer
7244 yyextra->needsSemi = FALSE;
7245 if (yyextra->current->isStatic)
7246 {
7247 yyextra->current->name="[static initializer]";
7248 yyextra->current->type.clear();
7249 }
7250 else
7251 {
7252 yyextra->current->name="[instance initializer]";
7253 }
7254 unput(*yytext);
7255 BEGIN( SFunction );
7256 }
7257 else
7258 {
7259 // pre C++11 code -> ignore the initializer
7260 //yyextra->needsSemi = TRUE;
7261 //yyextra->current->type.clear();
7262 //yyextra->current->name.clear();
7263 //yyextra->current->args.clear();
7264 //yyextra->current->argList.clear();
7265 //yyextra->curlyCount=0;
7266 //BEGIN( SkipCurlyBlock );
7267
7268 // C++11 style initializer list
7269 yyextra->current->bodyLine = yyextra->yyLineNr;
7270 yyextra->current->bodyColumn = yyextra->yyColNr;
7271 yyextra->current->initializer.str(yytext);
7272 yyextra->lastInitializerContext = YY_START;
7273 yyextra->sharpCount=0;
7274 yyextra->initBracketCount=1;
7275 BEGIN(ReadInitializer);
7276 }
7277 }
7278 }
7279<CSAccessorDecl>"{" { yyextra->curlyCount++; }
7280<CSAccessorDecl>"}"{B}*"=" {
7281 // fall back to next rule if it's not the right bracket
7282 if (yyextra->curlyCount != 0) REJECT;
7283 yyextra->current->initializer.str("=");
7284 yyextra->current->endBodyLine=yyextra->yyLineNr;
7285 yyextra->lastInitializerContext = FindMembers;
7286 BEGIN(ReadInitializer);
7287 }
7288<CSAccessorDecl>"}" {
7289 if (yyextra->curlyCount)
7290 {
7291 yyextra->curlyCount--;
7292 }
7293 else
7294 {
7295 yyextra->mtype = MethodTypes::Method;
7296 yyextra->virt = Specifier::Normal;
7297 // not really important, but while we are at it
7298 yyextra->current->endBodyLine=yyextra->yyLineNr;
7299 unput(';');
7300 BEGIN(FindMembers);
7301 }
7302 }
7303<CSAccessorDecl>"private "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec.setPrivateSettable(true); }
7304<CSAccessorDecl>"protected "{BN}*"set" { if (yyextra->curlyCount==0) yyextra->current->spec.setProtectedSettable(true); }
7305<CSAccessorDecl>"private "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec.setPrivateGettable(true); }
7306<CSAccessorDecl>"protected "{BN}*"get" { if (yyextra->curlyCount==0) yyextra->current->spec.setProtectedGettable(true); }
7307<CSAccessorDecl>"set" { if (yyextra->curlyCount==0) yyextra->current->spec.setSettable(true); }
7308<CSAccessorDecl>"get" { if (yyextra->curlyCount==0) yyextra->current->spec.setGettable(true); }
7309<CSAccessorDecl>"add" { if (yyextra->curlyCount==0) yyextra->current->spec.setAddable(true); }
7310<CSAccessorDecl>"remove" { if (yyextra->curlyCount==0) yyextra->current->spec.setRemovable(true); }
7311<CSAccessorDecl>"raise" { if (yyextra->curlyCount==0) yyextra->current->spec.setRaisable(true); }
7312<CSAccessorDecl>{CHARLIT} {}
7313<CSAccessorDecl>"\"" { BEGIN(CSString);}
7314<CSAccessorDecl>"." {}
7315<CSAccessorDecl>\n { lineCount(yyscanner); }
7316<CSString>"\"" { BEGIN(CSAccessorDecl);}
7317<CSString>{CPPC} {} // Otherwise the rule <*>"//" will kick in
7318<CSString>{CCS} {} // Otherwise the rule <*>"/*" will kick in
7319<CSString>\n { lineCount(yyscanner); }
7320<CSString>"." {}
7321
7322 /* ---- Slice-specific rules ------ */
7323
7324<SliceSequence>{SCOPENAME} {
7325 if (yyextra->current->spec.isLocal())
7326 {
7327 yyextra->current->type = "local ";
7328 }
7329 yyextra->current->type += "sequence<";
7330 yyextra->current->type += yytext;
7331 yyextra->current->type += ">";
7332 }
7333
7334<SliceSequence>{BN}*">"{BN}* {
7335 lineCount(yyscanner);
7336 BEGIN(SliceSequenceName);
7337 }
7338
7339<SliceSequenceName>{ID}{BN}* {
7340 lineCount(yyscanner);
7341 yyextra->current->name = yytext ;
7342 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
7343 }
7344
7345<SliceSequenceName>";" {
7346 yyextra->current->section = EntryType::makeVariable();
7347 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
7348 initEntry(yyscanner);
7349 BEGIN(FindMembers);
7350 }
7351
7352<SliceDictionary>{SCOPENAME}{BN}*","{BN}*{SCOPENAME} {
7353 lineCount(yyscanner);
7354 if (yyextra->current->spec.isLocal())
7355 {
7356 yyextra->current->type = "local ";
7357 }
7358 yyextra->current->type += "dictionary<";
7359 yyextra->current->type += yytext;
7360 yyextra->current->type += ">";
7361 yyextra->current->type = yyextra->current->type.simplifyWhiteSpace();
7362 }
7363
7364<SliceDictionary>{BN}*">"{BN}* {
7365 lineCount(yyscanner);
7366 BEGIN(SliceDictionaryName);
7367 }
7368
7369<SliceDictionaryName>{ID}{BN}* {
7370 lineCount(yyscanner);
7371 yyextra->current->name = yytext ;
7372 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
7373 }
7374
7375<SliceDictionaryName>";" {
7376 yyextra->current->section = EntryType::makeVariable();
7377 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
7378 initEntry(yyscanner);
7379 BEGIN(FindMembers);
7380 }
7381
7382 /**********************************************************************************/
7383 /******************** Documentation block related rules ***************************/
7384 /**********************************************************************************/
7385
7386 /* ---- Single line comments ------ */
7387<DocLine>[^\n]*"\n"[ \t]*{CPPC}[/!][<]? { // continuation of multiline C++-style comment
7388 int markerLen = yytext[yyleng-1]=='<' ? 4 : 3;
7389 yyextra->docBlock << std::string(yytext).substr(0,yyleng-markerLen);
7390 lineCount(yyscanner);
7391 }
7392<DocLine>{B}*{CPPC}"/"[/]+{Bopt}/"\n" { // ignore marker line (see bug700345)
7393 handleCommentBlock(yyscanner,yyextra->docBlock.str(),yyextra->current->brief.isEmpty());
7394 BEGIN( yyextra->docBlockContext );
7395 }
7396<DocLine>{NONLopt}/"\n"{B}*{CPPC}[!/]{B}*{CMD}"}" { // next line is an end group marker, see bug 752712
7397 yyextra->docBlock << yytext;
7398 handleCommentBlock(yyscanner,yyextra->docBlock.str(),yyextra->current->brief.isEmpty());
7399 BEGIN( yyextra->docBlockContext );
7400 }
7401<DocLine>{NONLopt}/"\n" { // whole line
7402 yyextra->docBlock << yytext;
7403 handleCommentBlock(yyscanner,yyextra->docBlock.str(),yyextra->current->brief.isEmpty());
7404 BEGIN( yyextra->docBlockContext );
7405 }
7406
7407 /* ---- Comments blocks ------ */
7408
7409<DocBlock>"*"*{CCE} { // end of comment block
7410 handleCommentBlock(yyscanner,yyextra->docBlock.str(),FALSE);
7411 BEGIN(yyextra->docBlockContext);
7412 }
7413<DocBlock>"\\ilinebr "{B}*"*"/[^/] {
7414 QCString indent;
7415 indent.fill(' ',computeIndent(yytext+8,yyextra->column));
7416 yyextra->docBlock << "\\ilinebr " << indent;
7417 }
7418<DocBlock>^{B}*"*"+/[^/] {
7419 QCString indent;
7420 indent.fill(' ',computeIndent(yytext,yyextra->column));
7421 yyextra->docBlock << indent;
7422 }
7423<DocBlock>^{B}*({CPPC})?{B}*"*"+/[^/a-z_A-Z0-9*] { // start of a comment line
7424 QCString indent;
7425 indent.fill(' ',computeIndent(yytext,yyextra->column));
7426 yyextra->docBlock << indent;
7427 }
7428<DocBlock>^{B}*({CPPC}){B}* { // strip embedded C++ comments if at the start of a line
7429 }
7430<DocBlock>{CPPC} { // slashes in the middle of a comment block
7431 yyextra->docBlock << yytext;
7432 }
7433<DocBlock>{CCS} { // start of a new comment in the
7434 // middle of a comment block
7435 yyextra->docBlock << yytext;
7436 }
7437<DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] { // escaped command
7438 yyextra->docBlock << yytext;
7439 }
7440<DocBlock>{CMD}("f$"|"f["|"f{"|"f(") {
7441 yyextra->docBlock << yytext;
7442 char blockName[] = "f$";
7443 char c = yytext[2];
7444 if (c=='[') blockName[1]=']';
7445 else if (c=='{') blockName[1]='}';
7446 else if (c=='(') blockName[1]=')';
7447 startVerbatimBlock(yyscanner,blockName);
7448 BEGIN(DocCopyBlock);
7449 }
static void startVerbatimBlock(yyscan_t yyscanner, const QCString &blockName, size_t fencedSize=0, bool codeBlock=false)
Definition scanner.l:8094
7450<DocBlock>{CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
7451 yyextra->fileName = &yytext[6];
7452 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
7453 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
7454 yyextra->docBlock << yytext;
7455 }
7456<DocBlock>{CMD}"ifile"{B}+{FILEMASK} {
7457 yyextra->fileName = &yytext[6];
7458 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
7459 yyextra->docBlock << yytext;
7460 }
7461<DocBlock>{CMD}"iline"{LINENR}{B} {
7462 bool ok = false;
7463 int nr = QCString(&yytext[6]).toInt(&ok);
7464 if (!ok)
7465 {
7466 warn(yyextra->fileName,yyextra->yyLineNr,"Invalid line number '{}' for iline command",yytext);
7467 }
7468 else
7469 {
7470 yyextra->yyLineNr = nr;
7471 }
7472 yyextra->docBlock << yytext;
7473 }
7474<DocBlock>{B}*"<"{PRE}">" {
7475 yyextra->docBlock << yytext;
7476 startVerbatimBlock(yyscanner,"<pre>");
7477 BEGIN(DocCopyBlock);
7478 }
7479<DocBlock>{CMD}"startuml"/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
7480 yyextra->docBlock << yytext;
7481 startVerbatimBlock(yyscanner,"uml");
7482 BEGIN(DocCopyBlock);
7483 }
7484<DocBlock>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
7485 yyextra->docBlock << yytext;
7486 startVerbatimBlock(yyscanner,&yytext[1]);
7487 BEGIN(DocCopyBlock);
7488 }
7489<DocBlock>{CMD}("code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!)
7490 yyextra->docBlock << yytext;
7491 startVerbatimBlock(yyscanner,&yytext[1],0,true);
7492 BEGIN(DocCopyBlock);
7493 }
7494<DocBlock>"\\ilinebr "({B}*"*"+)?{B}{0,3}"~~~"[~]* {
7495 QCString pat = substitute(yytext+9,"*"," "); // skip over "\ilinebr " part
7496 yyextra->docBlock << "\\ilinebr ";
7497 yyextra->docBlock << pat;
7498 startVerbatimBlock(yyscanner,"~~~",pat.stripWhiteSpace().length(),true);
7499 BEGIN(DocCopyBlock);
7500 }
7501<DocBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
7502 QCString pat = substitute(yytext,"*"," ");
7503 yyextra->docBlock << pat;
7504 startVerbatimBlock(yyscanner,"~~~",pat.stripWhiteSpace().length(),true);
7505 BEGIN(DocCopyBlock);
7506 }
7507<DocBlock>"\\ilinebr "({B}*"*"+)?{B}{0,3}"```"[`]*/(".")?[a-zA-Z0-9#_-]+ |
7508<DocBlock>"\\ilinebr "({B}*"*"+)?{B}{0,3}"```"[`]*/"{"[^}]+"}" |
7509<DocBlock>"\\ilinebr "({B}*"*"+)?{B}{0,3}"```"[`]* {
7510 QCString pat = substitute(yytext+9,"*"," "); // skip over "\ilinebr " part
7511 yyextra->docBlock << "\\ilinebr ";
7512 yyextra->docBlock << pat;
7513 startVerbatimBlock(yyscanner,"```",pat.stripWhiteSpace().length(),true);
7514 BEGIN(DocCopyBlock);
7515 }
7516<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]*/(".")?[a-zA-Z0-9#_-]+ |
7517<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]*/"{"[^}]+"}" |
7518<DocBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
7519 QCString pat = substitute(yytext,"*"," ");
7520 yyextra->docBlock << pat;
7521 startVerbatimBlock(yyscanner,"```",pat.stripWhiteSpace().length(),true);
7522 BEGIN(DocCopyBlock);
7523 }
7524<DocBlock>"```" { // skip ``` if not at the start of a line
7525 yyextra->docBlock << "```";
7526 }
7527<DocBlock>"\\`" { // skip escaped backtick
7528 yyextra->docBlock << yytext;
7529 }
7530<DocBlock>"`"{1,2} {
7531 yyextra->docBlock << yytext;
7532 startVerbatimBlock(yyscanner,yytext,yyleng,true);
7533 BEGIN(DocCopyBlock);
7534 }
7535<DocBlock>{B}*"<"{CODE}">" {
7536 if (yyextra->insideCS)
7537 {
7538 yyextra->docBlock << yytext;
7539 startVerbatimBlock(yyscanner,"<code>",0,true);
7540 BEGIN(DocCopyBlock);
7541 }
7542 else
7543 {
7544 REJECT;
7545 }
7546 }
7547<DocBlock>[^@*~`'\/\\\n]+ { // any character that isn't special
7548 yyextra->docBlock << yytext;
7549 }
7550<DocBlock>\n { // newline
7551 lineCount(yyscanner);
7552 yyextra->docBlock << *yytext;
7553 }
7554<DocBlock>. { // command block
7555 yyextra->docBlock << *yytext;
7556 }
7557
7558 /* ---- Copy verbatim sections ------ */
7559
7560<DocCopyBlock>"</"{PRE}">" { // end of a <pre> block
7561 if (endVerbatimBlock(yyscanner,"<pre>"))
7562 {
7563 BEGIN(DocBlock);
7564 }
7565 yyextra->docBlock << yytext;
7566 }
static bool endVerbatimBlock(yyscan_t yyscanner, const QCString &blockName, size_t fencedSize=0)
Definition scanner.l:8108
7567<DocCopyBlock>"</"{CODE}">" { // end of a <code> block
7568 if (endVerbatimBlock(yyscanner,"<code>"))
7569 {
7570 BEGIN(DocBlock);
7571 }
7572 yyextra->docBlock << yytext;
7573 }
7574<DocCopyBlock>[\\@]("f$"|"f]"|"f}"|"f)") {
7575 if (endVerbatimBlock(yyscanner,&yytext[1]))
7576 {
7577 BEGIN(DocBlock);
7578 }
7579 yyextra->docBlock << yytext;
7580 }
7581<DocCopyBlock>[\\@]("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block
7582 if (endVerbatimBlock(yyscanner,&yytext[4]))
7583 {
7584 BEGIN(DocBlock);
7585 }
7586 yyextra->docBlock << yytext;
7587 }
7588<DocCopyBlock>^{B}*"*"+/{BN}+ { // start of a comment line
7589 if ((yyextra->docBlockName=="verbatim") || (yyextra->docBlockName=="code") || (yyextra->docBlockName=="iliteral"))
7590 {
7591 REJECT;
7592 }
7593 else
7594 {
7595 QCString indent;
7596 indent.fill(' ',computeIndent(yytext,0));
7597 yyextra->docBlock << indent;
7598 }
7599 }
7600<DocCopyBlock>^{B}*"*"+/{B}+"*"{BN}* { // start of a comment line with two *'s
7601 if ((yyextra->docBlockName=="code") || (yyextra->docBlockName=="iliteral"))
7602 {
7603 QCString indent;
7604 indent.fill(' ',computeIndent(yytext,0));
7605 yyextra->docBlock << indent;
7606 }
7607 else
7608 {
7609 REJECT;
7610 }
7611 }
7612<DocCopyBlock>^{B}*"*"+/({ID}|"(") { // Assume *var or *(... is part of source code (see bug723516)
7613 if ((yyextra->docBlockName=="code") || (yyextra->docBlockName=="iliteral"))
7614 {
7615 QCString indent;
7616 indent.fill(' ',computeIndent(yytext,-1));
7617 yyextra->docBlock << indent+"*";
7618 }
7619 else
7620 {
7621 REJECT;
7622 }
7623 }
7624<DocCopyBlock>^{B}*"*"+/{BN}* { // start of a comment line with one *
7625 if ((yyextra->docBlockName=="code") || (yyextra->docBlockName=="iliteral"))
7626 {
7627 QCString indent;
7628 if (yyextra->nestedComment>0) // keep * it is part of the code
7629 {
7630 indent.fill(' ',computeIndent(yytext,-1));
7631 yyextra->docBlock << indent+"*";
7632 }
7633 else // remove * it is part of the comment block
7634 {
7635 indent.fill(' ',computeIndent(yytext,0));
7636 yyextra->docBlock << indent;
7637 }
7638 }
7639 else
7640 {
7641 REJECT;
7642 }
7643 }
7644<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
7645 QCString pat = substitute(yytext,"*"," ");
7646 if (endVerbatimBlock(yyscanner,"~~~",pat.stripWhiteSpace().length()))
7647 {
7648 BEGIN(DocBlock);
7649 }
7650 yyextra->docBlock << pat;
7651 }
7652<DocCopyBlock>^({B}*"*"+)?{B}{0,3}"```"[`]* {
7653 QCString pat = substitute(yytext,"*"," ");
7654 if (endVerbatimBlock(yyscanner,"```",pat.stripWhiteSpace().length()))
7655 {
7656 BEGIN(DocBlock);
7657 }
7658 yyextra->docBlock << pat;
7659 }
7660<DocCopyBlock>"```" { // backtick + end marker
7661 if (yyextra->docBlockName=="``")
7662 {
7663 yyextra->docBlock << "`";
7664 endVerbatimBlock(yyscanner,"``",2);
7665 yyextra->docBlock << "``";
7666 BEGIN(DocBlock);
7667 }
7668 else
7669 {
7670 yyextra->docBlock << yytext;
7671 }
7672 }
7673<DocCopyBlock>"''"/[^a-z_A-Z0-9-] {
7674 if (!Config_getBool(MARKDOWN_STRICT) && endVerbatimBlock(yyscanner,"``",2))
7675 {
7676 BEGIN(DocBlock);
7677 }
7678 yyextra->docBlock << yytext;
7679 }
7680<DocCopyBlock>"'"/[^'a-z_A-Z0-9-] {
7681 if (!Config_getBool(MARKDOWN_STRICT) && endVerbatimBlock(yyscanner,"`",1))
7682 {
7683 BEGIN(DocBlock);
7684 }
7685 yyextra->docBlock << yytext;
7686 }
7687<DocCopyBlock>"`"{1,2} {
7688 if (endVerbatimBlock(yyscanner,yytext,yyleng))
7689 {
7690 BEGIN(DocBlock);
7691 }
7692 yyextra->docBlock << yytext;
7693 }
7694<DocCopyBlock>[^<@/\*\‍]`'~"\$\\\n]+ { // any character that is not special
7695 yyextra->docBlock << yytext;
7696 }
7697<DocCopyBlock>\" {
7698 yyextra->docBlock << yytext;
7699 if (yyextra->docBlockName=="code" || yyextra->docBlockName=="iliteral")
7700 // to support end of comment character sequences inside
7701 // a string literal of a code block, see #6737
7702 {
7703 yyextra->lastStringContext=YY_START;
7704 yyextra->pCopyQuotedGString=&yyextra->docBlock;
7705 yyextra->stopAtInvalidString=true;
7706 BEGIN(CopyGString);
7707 }
7708 }
7709<DocCopyBlock>{CCS}|{CCE}|{CPPC} {
7710 if (yytext[1]=='*') // start comment
7711 {
7712 yyextra->nestedComment++;
7713 }
7714 else if (yytext[0]=='*' && yyextra->nestedComment>0) // end comment
7715 {
7716 yyextra->nestedComment--;
7717 }
7718 else if (yytext[0]=='*' && yyextra->nestedComment==0 && yyextra->isCodeBlock) // end comment without start
7719 {
7720 warn(yyextra->fileName,yyextra->yyLineNr,
7721 "Found end of C comment inside a '{}' block without matching start of the comment!"
7722 " Maybe the end marker for the block is missing?",
7723 yyextra->docBlockName);
7724 BEGIN(DocBlock);
7725 }
7726 yyextra->docBlock << yytext;
7727 }
7728<DocCopyBlock>\n { // newline
7729 yyextra->docBlock << *yytext;
7730 lineCount(yyscanner);
7731 }
7732<DocCopyBlock>. { // any other character
7733 yyextra->docBlock << *yytext;
7734 }
7735<DocCopyBlock><<EOF>> {
7736 warn(yyextra->fileName,yyextra->yyLineNr,
7737 "reached end of file while inside a '{}' block!"
7738 " The command that should end the block seems to be missing!",
7739 yyextra->docBlockName);
7740 yyterminate();
7741 }
7742
7743
7744 /* ------------- Prototype parser -------------- */
7745
7746<Prototype>"operator"{B}*"("{B}*")" {
7747 yyextra->current->name+=yytext;
7748 }
7749<Prototype>"(" {
7750 yyextra->current->args+=*yytext;
7751 yyextra->currentArgumentContext = PrototypeQual;
7752 yyextra->fullArgString = yyextra->current->args;
7753 yyextra->copyArgString = &yyextra->current->args;
7754 BEGIN( ReadFuncArgType ) ;
7755 }
7756<Prototype>"("({ID}"::")*({B}*[&*])+ {
7757 if (yyextra->insidePHP) // reference parameter
7758 {
7759 REJECT;
7760 }
7761 else
7762 {
7763 yyextra->current->type+=yyextra->current->name+yytext;
7764 yyextra->current->name.clear();
7765 BEGIN( PrototypePtr );
7766 }
7767 }
7768<PrototypePtr>{SCOPENAME} {
7769 yyextra->current->name+=yytext;
7770 }
7771<PrototypePtr>"(" {
7772 yyextra->current->args+=*yytext;
7773 yyextra->currentArgumentContext = PrototypeQual;
7774 yyextra->fullArgString = yyextra->current->args;
7775 yyextra->copyArgString = &yyextra->current->args;
7776 BEGIN( ReadFuncArgType ) ;
7777 }
7778<PrototypePtr>")" {
7779 yyextra->current->type+=')';
7780 BEGIN( Prototype );
7781 }
7782<PrototypePtr>. {
7783 yyextra->current->name+=yytext;
7784 }
7785<PrototypeQual>"{" {
7786 BEGIN( PrototypeSkipLine);
7787 }
7788<PrototypeQual>{B}*"const"{B}* {
7789 yyextra->current->args += " const ";
7790 yyextra->current->argList.setConstSpecifier(TRUE);
7791 }
7792<PrototypeQual>{B}*"volatile"{B}* {
7793 yyextra->current->args += " volatile ";
7794 yyextra->current->argList.setVolatileSpecifier(TRUE);
7795 }
7796<PrototypeQual>{B}*"="{B}*"0"{B}* {
7797 yyextra->current->args += " = 0";
7798 yyextra->current->virt = Specifier::Pure;
7799 yyextra->current->argList.setPureSpecifier(TRUE);
7800 }
7801<PrototypeQual>"throw"{B}*"(" {
7802 yyextra->current->exception = "throw(";
7803 BEGIN(PrototypeExc);
7804 }
7805<PrototypeExc>")" {
7806 yyextra->current->exception += ')';
7807 BEGIN(PrototypeQual);
7808 }
7809<PrototypeExc>. {
7810 yyextra->current->exception += *yytext;
7811 }
7812<PrototypeQual>. {
7813 yyextra->current->args += *yytext;
7814 }
7815<Prototype>. {
7816 yyextra->current->name += *yytext;
7817 }
7818<PrototypeSkipLine>. {
7819 }
7820
7821
7822
7823
7824<SkipCxxComment>.*"\\\n" { // line continuation
7825 if (yyextra->insideCS)
7826 {
7827 REJECT;
7828 }
7829 else
7830 {
7831 lineCount(yyscanner);
7832 }
7833 }
7834<SkipCxxComment>{ANYopt}/\n {
7835 BEGIN( yyextra->lastCContext ) ;
7836 }
7837<SkipComment>[^\*\n]+
7838
7839 /* ------------ Generic rules -------------- */
7840
7841<*>"[[" { // C++11 attribute
7842 if (!yyextra->insideCpp) REJECT;
7843 if (YY_START == CopyGString || YY_START == CopyGString) REJECT;
7844 yyextra->lastC11AttributeContext = YY_START;
7845 BEGIN( SkipC11Attribute );
7846 }
7847
7848<*>\n { lineCount(yyscanner); }
7849<*>\" {
7850 if (yyextra->insideIDL && yyextra->insideCppQuote)
7851 {
7852 BEGIN(EndCppQuote);
7853 }
7854 else if (yyextra->insidePHP)
7855 {
7856 yyextra->lastStringContext=YY_START;
7857 BEGIN(SkipString);
7858 }
7859 }
7860<*>^{B}*"#" {
7861 if (!yyextra->insidePHP)
7862 {
7863 yyextra->lastCPPContext = YY_START;
7864 BEGIN( SkipCPP ) ;
7865 }
7866 else
7867 {
7868 yyextra->lastCContext = YY_START ;
7869 BEGIN( SkipCxxComment ) ;
7870 }
7871 }
7872<*>"#" {
7873 if (!yyextra->insidePHP)
7874 REJECT;
7875 yyextra->lastCContext = YY_START ;
7876 BEGIN( SkipCxxComment ) ;
7877 }
7878<*>\' {
7879 if (yyextra->insidePHP)
7880 {
7881 yyextra->lastStringContext=YY_START;
7882 BEGIN(SkipPHPString);
7883 }
7884 }
7885<*>\? {
7886 if (yyextra->insideCS && (YY_START != SkipRound) && (YY_START != CSAccessorDecl))
7887 {
7888 if (yyextra->current->type.isEmpty())
7889 {
7890 if (yyextra->current->name.isEmpty())
7891 yyextra->current->name="?";
7892 else
7893 yyextra->current->name+="?";
7894 }
7895 else
7896 {
7897 yyextra->current->type+="?";
7898 }
7899 }
7900 }
7901<*>"}" { yyextra->exported=false; }
7902<*>.
7903<SkipComment>{CPPC}|{CCS}
7904<*>{CCS} { yyextra->lastCContext = YY_START ;
7905 BEGIN( SkipComment ) ;
7906 }
7907<SkipComment>{B}*{CCE} { BEGIN( yyextra->lastCContext ) ; }
7908<*>{CPPC} {
7909 yyextra->lastCContext = YY_START ;
7910 BEGIN( SkipCxxComment ) ;
7911 }
7912<<EOF>> {
7913 if (yyextra->insideCS && yyextra->fakeNS)
7914 {
7915 yyextra->fakeNS--;
7916 unput('}');
7917 BEGIN ( ReadNSBody);
7918 }
7919 else
7920 {
7921 yyterminate();
7922 }
7923 }
7924%%

◆ yyread()

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

Definition at line 7927 of file scanner.l.

7928{
7929 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7930 int c=0;
7931 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7932 {
7933 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7934 //printf("%d (%c)\n",*buf,*buf);
7935 c++; buf++;
7936 }
7937 return c;
7938}