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

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

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

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 8061 of file scanner.l.

8062{
8063 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8064 size_t tl=yyextra->current->type.length();
8065 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8066 {
8067 yyextra->current->type += ' ' ;
8068 }
8069 yyextra->current->type += yyextra->current->name;
8070 yyextra->current->name.clear() ;
8071 tl=yyextra->current->type.length();
8072 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8073 {
8074 yyextra->current->type += ' ' ;
8075 }
8076 yyextra->current->type += yyextra->current->args ;
8077 yyextra->current->args.clear() ;
8078 yyextra->current->argList.clear();
8079}

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

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

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

◆ computeIndent()

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

Definition at line 8034 of file scanner.l.

8035{
8036 int col=startIndent;
8037 int tabSize=Config_getInt(TAB_SIZE);
8038 const char *p=s;
8039 char c;
8040 while ((c=*p++))
8041 {
8042 if (c=='\t') col+=tabSize-(col%tabSize);
8043 else if (c=='\n') col=0;
8044 else col++;
8045 }
8046 return col;
#define Config_getInt(name)
Definition config.h:34
8047}

References Config_getInt.

◆ endVerbatimBlock()

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

Definition at line 8121 of file scanner.l.

8122{
8123 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8124 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
8125 {
8126 if (Config_getBool(MARKDOWN_SUPPORT))
8127 {
8128 yyextra->docBlock << "\\endiskip";
8129 }
8130 yyextra->docBlockName="";
8131 return true;
8132 }
8133 return false;
#define Config_getBool(name)
Definition config.h:33
8134}

References Config_getBool.

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 8348 of file scanner.l.

8349{
8350 for (Argument &a : al)
8351 {
8352 if (!a.type.isEmpty() && a.name.isEmpty())
8353 { // a->type is actually the (typeless) parameter name, so move it
8354 a.name=a.type;
8355 a.type.clear();
8356 }
8357 }
8358}

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

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

References AUTO_TRACE, Config_getBool, FALSE, newEntry(), Markdown::process(), stripIndentation(), and Trace::trunc().

◆ handleParametersCommentBlocks()

void handleParametersCommentBlocks ( yyscan_t yyscanner,
ArgumentList & al )
static

Definition at line 8459 of file scanner.l.

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

References AUTO_TRACE, AUTO_TRACE_ADD, QCString::clear(), Config_getBool, Argument::docs, FALSE, QCString::isEmpty(), Argument::name, newEntry(), Markdown::process(), stripIndentation(), Trace::trunc(), and Argument::type.

◆ initEntry()

void initEntry ( yyscan_t yyscanner)
static

Definition at line 7978 of file scanner.l.

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

References FALSE.

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 8049 of file scanner.l.

8050{
8051 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8052 yyextra->current->protection = yyextra->protection = prot;
8053 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
8054 yyextra->current->type.clear();
8055 yyextra->current->name.clear();
8056 yyextra->current->args.clear();
8057 yyextra->current->argList.clear();
8058 lineCount(yyscanner) ;
#define lineCount(s, len)
8059}

References lineCount, and Entry::protection.

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 7954 of file scanner.l.

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

References Config_getBool, and FALSE.

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 8008 of file scanner.l.

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

References Config_getInt.

◆ nameIsOperator()

bool nameIsOperator ( QCString & name)
static

Definition at line 8148 of file scanner.l.

8149{
8150 int i=name.find("operator");
8151 if (i==-1) return FALSE;
8152 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
8153 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
8154 return FALSE; // case TEXToperatorTEXT
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:593
bool isId(int c)
Definition util.h:256
8155}

References QCString::at(), FALSE, QCString::find(), isId(), and TRUE.

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8379 of file scanner.l.

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

References initEntry().

◆ parseCompounds()

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

Definition at line 8525 of file scanner.l.

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

References AUTO_TRACE, AUTO_TRACE_ADD, Config_getBool, FALSE, initEntry(), parseCompounds(), TRUE, and Trace::trunc().

◆ parseConcepts()

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

Definition at line 8641 of file scanner.l.

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

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

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

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

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

References AUTO_TRACE, QCString::data(), QCString::isEmpty(), Trace::trunc(), warn, and YY_BUF_SIZE.

◆ prependScope()

void prependScope ( yyscan_t yyscanner)
static

Definition at line 8181 of file scanner.l.

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

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 8159 of file scanner.l.

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

References getLanguageFromFileName().

Referenced by parseMain().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 8213 of file scanner.l.

8214{
8215 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8216 if (yyextra->insideJava)
8217 {
8218 QCString text=yytext;
8219 yyextra->current->protection = Protection::Public;
8220 if (text.find("protected")!=-1)
8221 yyextra->current->protection = Protection::Protected;
8222 else if (text.find("private")!=-1)
8223 yyextra->current->protection = Protection::Private;
8224 else if (text.find("package")!=-1)
8225 yyextra->current->protection = Protection::Package;
8226 }
8227}

References QCString::find().

◆ splitKnRArg()

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

Definition at line 8230 of file scanner.l.

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

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

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8362 of file scanner.l.

8363{
8364 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8365 if (brief)
8366 {
8367 yyextra->current->briefFile = yyextra->fileName;
8368 yyextra->current->briefLine = yyextra->yyLineNr;
8369 }
8370 else
8371 {
8372 yyextra->current->docFile = yyextra->fileName;
8373 yyextra->current->docLine = yyextra->yyLineNr;
8374 }
8375}

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 8140 of file scanner.l.

8141{
8142 QCString r = req.stripWhiteSpace();
8143 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:524
8144}

References QCString::endsWith(), QCString::isEmpty(), and QCString::stripWhiteSpace().

◆ startVerbatimBlock()

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

Definition at line 8107 of file scanner.l.

8108{
8109 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8110 if (Config_getBool(MARKDOWN_SUPPORT))
8111 {
8112 yyextra->docBlock << "\\iskip";
8113 }
8114 yyextra->docBlockName=blockName;
8115 yyextra->fencedSize=fencedSize;
8116 yyextra->isCodeBlock=codeBlock;
8117 yyextra->nestedComment=0;
8118}

References Config_getBool.

◆ stateToString()

const char * stateToString ( int state)
static

◆ storeClangId()

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

Definition at line 7999 of file scanner.l.

8000{
8001 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8002 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
8003 {
8004 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
8005 }
8006}

◆ stripFuncPtr()

QCString stripFuncPtr ( const QCString & type)
static

Definition at line 8094 of file scanner.l.

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

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

◆ stripQuotes()

QCString stripQuotes ( const char * s)
static

Definition at line 8082 of file scanner.l.

8083{
8084 QCString name;
8085 if (s==nullptr || *s==0) return name;
8086 name=s;
8087 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
8088 {
8089 name=name.mid(1,name.length()-2);
8090 }
8091 return name;
8092}

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

◆ yyread()

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

Definition at line 7940 of file scanner.l.

7941{
7942 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7943 int c=0;
7944 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7945 {
7946 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7947 //printf("%d (%c)\n",*buf,*buf);
7948 c++; buf++;
7949 }
7950 return c;
7951}