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

8403{
8404 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8405 for (Argument &a : yyextra->current->argList)
8406 {
8407 if (a.type==name)
8408 {
8409 a.type=type.stripWhiteSpace();
8410 a.type.stripPrefix("register ");
8411 a.name=name.stripWhiteSpace();
8412 if (!brief.isEmpty() && !docs.isEmpty())
8413 {
8414 a.docs=brief+"\n\n"+docs;
8415 }
8416 else if (!brief.isEmpty())
8417 {
8418 a.docs=brief;
8419 }
8420 else
8421 {
8422 a.docs=docs;
8423 }
8424 }
8425 }
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:167
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:264
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:217
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
8426}

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

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 8143 of file scanner.l.

8144{
8145 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8146 size_t tl=yyextra->current->type.length();
8147 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8148 {
8149 yyextra->current->type += ' ' ;
8150 }
8151 yyextra->current->type += yyextra->current->name;
8152 yyextra->current->name.clear() ;
8153 tl=yyextra->current->type.length();
8154 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
8155 {
8156 yyextra->current->type += ' ' ;
8157 }
8158 yyextra->current->type += yyextra->current->args ;
8159 yyextra->current->args.clear() ;
8160 yyextra->current->argList.clear();
8161}

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

8282{
8283 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8284 if (!yyextra->fileName.lower().endsWith(".c")) return FALSE; // must be a C file
8285 if (yyextra->current->argList.empty()) return FALSE; // must have arguments
8286 for (const Argument &a : yyextra->current->argList)
8287 {
8288 // in K&R style argument do not have a type, but doxygen expects a type
8289 // so it will think the argument has no name
8290 if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE;
8291 }
8292 return TRUE;
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
8293}

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

◆ computeIndent()

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

Definition at line 8116 of file scanner.l.

8117{
8118 int col=startIndent;
8119 int tabSize=Config_getInt(TAB_SIZE);
8120 const char *p=s;
8121 char c;
8122 while ((c=*p++))
8123 {
8124 if (c=='\t') col+=tabSize-(col%tabSize);
8125 else if (c=='\n') col=0;
8126 else col++;
8127 }
8128 return col;
#define Config_getInt(name)
Definition config.h:34
8129}

References Config_getInt.

◆ endVerbatimBlock()

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

Definition at line 8203 of file scanner.l.

8204{
8205 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8206 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
8207 {
8208 if (Config_getBool(MARKDOWN_SUPPORT))
8209 {
8210 yyextra->docBlock << "\\endiskip";
8211 }
8212 yyextra->docBlockName="";
8213 return true;
8214 }
8215 return false;
#define Config_getBool(name)
Definition config.h:33
8216}

References Config_getBool.

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 8430 of file scanner.l.

8431{
8432 for (Argument &a : al)
8433 {
8434 if (!a.type.isEmpty() && a.name.isEmpty())
8435 { // a->type is actually the (typeless) parameter name, so move it
8436 a.name=a.type;
8437 a.type.clear();
8438 }
8439 }
8440}

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

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 263 of file scanner.l.

263{return __FILE__;}

◆ handleCommentBlock()

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

Definition at line 8481 of file scanner.l.

8482{
8483 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8484 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
8485 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
8486 if (yyextra->docBlockInBody && hideInBodyDocs) return;
8487 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
8488
8489 // fill in inbodyFile && inbodyLine the first time, see bug 633891
8490 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
8491 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
8492 {
8493 docEntry->inbodyFile = yyextra->fileName;
8494 docEntry->inbodyLine = lineNr;
8495 }
8496
8497 int position=0;
8498 bool needsEntry=FALSE;
8499 GuardedSectionStack guards;
8500 Markdown markdown(yyextra->fileName,lineNr);
8501 QCString strippedDoc = stripIndentation(doc);
8502 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8503 while (yyextra->commentScanner.parseCommentBlock(
8504 yyextra->thisParser,
8505 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8506 processedDoc, // text
8507 yyextra->fileName, // file
8508 lineNr, // line of block start
8509 yyextra->docBlockInBody ? FALSE : brief, // isBrief
8510 yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
8511 yyextra->docBlockInBody, // isInBody
8512 yyextra->protection,
8513 position,
8514 needsEntry,
8515 Config_getBool(MARKDOWN_SUPPORT),
8516 &guards
8517 )
8518 )
8519 {
8520 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8521 if (needsEntry)
8522 {
8523 QCString docFile = yyextra->current->docFile;
8524 newEntry(yyscanner);
8525 yyextra->current->docFile = docFile;
8526 yyextra->current->docLine = lineNr;
8527 }
8528 }
8529 if (needsEntry)
8530 {
8531 newEntry(yyscanner);
8532 }
Helper class to process markdown formatted text.
Definition markdown.h:32
This is an alternative implementation of QCString.
Definition qcstring.h:103
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
static void newEntry(yyscan_t yyscanner)
Definition scanner.l:8461
QCString stripIndentation(const QCString &s, bool skipFirstLine)
Definition util.cpp:5967
8533
8534 if (yyextra->docBlockTerm)
8535 {
8536 unput(yyextra->docBlockTerm);
8537 yyextra->docBlockTerm=0;
8538 }
8539}

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

8542{
8543 AUTO_TRACE();
8544 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8545 for (Argument &a : al)
8546 {
8547 AUTO_TRACE_ADD("Param '{}' docs='{}'",a.name,Trace::trunc(a.docs));
8548 if (!a.docs.isEmpty())
8549 {
8550 if (a.name.isEmpty() && a.type == "...") a.name= "...";
8551 int position=0;
8552 bool needsEntry;
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:49
8553
8554 // save context
8555 QCString orgDoc = yyextra->current->doc;
8556 QCString orgBrief = yyextra->current->brief;
8557 int orgDocLine = yyextra->current->docLine;
8558 int orgBriefLine = yyextra->current->briefLine;
8559
8560 yyextra->current->doc.clear();
8561 yyextra->current->brief.clear();
8562
8563 //printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
8564 int lineNr = orgDocLine;
8565 GuardedSectionStack guards;
8566 Markdown markdown(yyextra->fileName,lineNr);
8567 QCString strippedDoc = stripIndentation(a.docs);
8568 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8569 while (yyextra->commentScanner.parseCommentBlock(
8570 yyextra->thisParser,
8571 yyextra->current.get(),
8572 processedDoc, // text
8573 yyextra->fileName, // file
8574 lineNr,
8575 FALSE,
8576 FALSE,
8577 FALSE,
8578 yyextra->protection,
8579 position,
8580 needsEntry,
8581 Config_getBool(MARKDOWN_SUPPORT),
8582 &guards
8583 )
8584 )
8585 {
8586 //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8587 if (needsEntry) newEntry(yyscanner);
8588 }
8589 if (needsEntry)
8590 {
8591 newEntry(yyscanner);
8592 }
8593 a.docs = yyextra->current->doc;
8594
8595 // restore context
8596 yyextra->current->doc = orgDoc;
8597 yyextra->current->brief = orgBrief;
8598 yyextra->current->docLine = orgDocLine;
8599 yyextra->current->briefLine = orgBriefLine;
8600 }
8601 }
8602}

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

8061{
8062 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8063 if (yyextra->insideJava)
8064 {
8065 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
8066 }
8067 yyextra->current->protection = yyextra->protection;
8068 yyextra->current->exported = yyextra->exported ;
8069 yyextra->current->mtype = yyextra->mtype;
8070 yyextra->current->virt = yyextra->virt;
8071 yyextra->current->isStatic = yyextra->isStatic;
8072 yyextra->current->lang = yyextra->language;
8073 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
8074 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
8075 yyextra->isTypedef=FALSE;
8076}

References FALSE.

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 8131 of file scanner.l.

8132{
8133 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8134 yyextra->current->protection = yyextra->protection = prot;
8135 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
8136 yyextra->current->type.clear();
8137 yyextra->current->name.clear();
8138 yyextra->current->args.clear();
8139 yyextra->current->argList.clear();
8140 lineCount(yyscanner) ;
#define lineCount(s, len)
8141}

References lineCount, and Entry::protection.

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 8036 of file scanner.l.

8037{
8038 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8039 yyextra->outerScopeEntries.clear();
8040 yyextra->baseName.clear();
8041 yyextra->protection = Protection::Public;
8042 yyextra->baseProt = Protection::Public;
8043 yyextra->sharpCount = 0;
8044 yyextra->roundCount = 0;
8045 yyextra->curlyCount = 0;
8046 yyextra->mtype = MethodTypes::Method;
8047 yyextra->isStatic = FALSE;
8048 yyextra->virt = Specifier::Normal;
8049 yyextra->baseVirt = Specifier::Normal;
8050 yyextra->isTypedef = FALSE;
8051 yyextra->insideTryBlock = FALSE;
8052 yyextra->insideFormula = FALSE;
8053 yyextra->insideCode=FALSE;
8054 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
8055 yyextra->previous = 0;
8056 yyextra->firstTypedefEntry.reset();
8057 yyextra->memspecEntry.reset();
8058}

References Config_getBool, and FALSE.

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 8090 of file scanner.l.

8091{
8092 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8093 int tabSize = Config_getInt(TAB_SIZE);
8094 const char *p;
8095 for (p = yytext ; *p ; ++p )
8096 {
8097 if (*p=='\n')
8098 {
8099 yyextra->yyLineNr++;
8100 yyextra->column=0;
8101 yyextra->yyColNr=1;
8102 }
8103 else if (*p=='\t')
8104 {
8105 yyextra->column+=tabSize - (yyextra->column%tabSize);
8106 }
8107 else
8108 {
8109 yyextra->column++;
8110 yyextra->yyColNr++;
8111 }
8112 }
8113 //printf("lineCount()=%d\n",yyextra->column);
8114}

References Config_getInt.

◆ nameIsOperator()

bool nameIsOperator ( QCString & name)
static

Definition at line 8230 of file scanner.l.

8231{
8232 int i=name.find("operator");
8233 if (i==-1) return FALSE;
8234 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
8235 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
8236 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:597
bool isId(int c)
Definition util.h:256
8237}

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

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8461 of file scanner.l.

8462{
8463 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8464 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
8465 // and yyextra->current is actually replaced by yyextra->previous which was
8466 // already added to yyextra->current_root, so we should not add it again
8467 // (see bug723314)
8468 {
8469 yyextra->previous = yyextra->current;
8470 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8471 }
8472 else
8473 {
8474 yyextra->previous = yyextra->current;
8475 yyextra->current = yyextra->tempEntry;
8476 yyextra->tempEntry.reset();
8477 }
8478 initEntry(yyscanner);
static void initEntry(yyscan_t yyscanner)
Definition scanner.l:8060
8479}

References initEntry().

◆ parseCompounds()

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

Definition at line 8607 of file scanner.l.

8608{
8609 AUTO_TRACE("name={}",rt->name);
8610 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8611 for (const auto &ce : rt->children())
8612 {
8613 if (!ce->program.empty())
8614 {
8615 AUTO_TRACE_ADD("compound name='{}' program='{}'",Trace::trunc(ce->name),Trace::trunc(ce->program.str()));
8616 // init scanner state
8617 yyextra->padCount=0;
8618 yyextra->column=0;
8619 yyextra->programStr = ce->program.str();
8620 yyextra->inputString = yyextra->programStr.data();
8621 yyextra->inputPosition = 0;
8622 if (ce->section.isEnum() || ce->spec.isEnum())
8623 BEGIN( FindFields ) ;
8624 else
8625 BEGIN( FindMembers ) ;
8626 yyextra->current_root = ce;
8627 yyextra->fileName = ce->fileName;
8628 //setContext();
8629 yyextra->yyLineNr = ce->bodyLine;
8630 yyextra->yyColNr = ce->bodyColumn;
8631 yyextra->insideObjC = ce->lang==SrcLangExt::ObjC;
8632 //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
8633 yyextra->current = std::make_shared<Entry>();
8634 yyextra->isStatic = FALSE;
8635 initEntry(yyscanner);
8636
8637 // deep copy group list from parent (see bug 727732)
8638 bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
8639 if (autoGroupNested && !rt->groups.empty() && !ce->section.isEnum() && !ce->spec.isEnum())
8640 {
8641 ce->groups = rt->groups;
8642 }
8643
8644 int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2;
8645 // set default protection based on the compound type
8646 if ( ce->section.isClass() ) // class
8647 {
8648 if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
8649 {
8650 yyextra->current->protection = yyextra->protection = Protection::Public ;
8651 }
8652 else if (yyextra->insideJava)
8653 {
8654 yyextra->current->protection = yyextra->protection = (ce->spec.isInterface() || ce->spec.isEnum()) ? Protection::Public : Protection::Package;
8655 }
8656 else if (ce->spec.isInterface() || ce->spec.isRef() || ce->spec.isValue() || ce->spec.isStruct() || ce->spec.isUnion())
8657 {
8658 if (ce->lang==SrcLangExt::ObjC)
8659 {
8660 yyextra->current->protection = yyextra->protection = Protection::Protected ;
8661 }
8662 else
8663 {
8664 yyextra->current->protection = yyextra->protection = Protection::Public ;
8665 }
8666 }
8667 else
8668 {
8669 yyextra->current->protection = yyextra->protection = Protection::Private ;
8670 }
8671 }
8672 else if (ce->section.isEnum() ) // enum
8673 {
8674 yyextra->current->protection = yyextra->protection = ce->protection;
8675 }
8676 else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
8677 {
8678 if (ce->section.isNamespace() ) // unnamed namespace
8679 {
8680 yyextra->current->isStatic = yyextra->isStatic = TRUE;
8681 }
8682 yyextra->current->protection = yyextra->protection = ce->protection;
8683 yyextra->current->exported = yyextra->exported = false;
8684 }
8685 else if (ce->section.isNamespace() )
8686 {
8687 yyextra->current->protection = yyextra->protection = Protection::Public ;
8688 yyextra->current->exported = yyextra->exported = ce->exported;
8689 }
8690 else // named struct, union, protocol, category
8691 {
8692 yyextra->current->protection = yyextra->protection = Protection::Public ;
8693 yyextra->current->exported = yyextra->exported = false;
8694 }
8695 yyextra->mtype = MethodTypes::Method;
8696 yyextra->virt = Specifier::Normal;
8697 //printf("name=%s yyextra->current->isStatic=%d yyextra->isStatic=%d\n",qPrint(ce->name),yyextra->current->isStatic,yyextra->isStatic);
8698
8699 //memberGroupId = DOX_NOGROUP;
8700 //memberGroupRelates.clear();
8701 //memberGroupInside.clear();
8702 QCString name = ce->name;
8703 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
8704
8705 scannerYYlex(yyscanner);
8706 //forceEndGroup();
8707
8708 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
8709
8710 yyextra->programStr.clear();
8711 ce->program.str(std::string());
8712
8713
8714 //if (depthIf>0)
8715 //{
8716 // warn(yyextra->fileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
8717 //}
8718 }
8719 parseCompounds(yyscanner,ce);
8720 }
static void parseCompounds(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8607
8721}

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

8724{
8725 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8726 for (const auto &ce : rt->children())
8727 {
8728 if (ce->section.isConcept())
8729 {
8730 //printf("*** found concept '%s' value=[[\n%s\n]] line=%d,col=%d\n",
8731 // qPrint(ce->name),qPrint(ce->initializer.str()),ce->startLine,ce->startColumn);
8732 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8733 // init scanner state
8734 yyextra->padCount =0;
8735 yyextra->column =0;
8736 yyextra->programStr = ce->initializer.str();
8737 yyextra->inputString = yyextra->programStr.data();
8738 yyextra->inputPosition = 0;
8739 yyextra->current_root = ce;
8740 yyextra->fileName = ce->fileName;
8741 yyextra->yyLineNr = ce->bodyLine;
8742 yyextra->yyColNr = ce->bodyColumn;
8743 yyextra->insideObjC = false;
8744 yyextra->current = std::make_shared<Entry>();
8745
8746 // hack to reconstruct what was in the code before the concept expression
8747 QCString indent;
8748 indent.fill(' ',std::max(0,ce->startColumn-1));
8749 QCString templArgs;
8750 if (!ce->args.isEmpty())
8751 {
8752 templArgs=indent+"template"+ce->args+"\n";
8753 }
8754 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:197
const std::string & str() const
Definition qcstring.h:556
8755
8756 yyextra->isStatic = FALSE;
8757 initEntry(yyscanner);
8758 yyextra->current->section = EntryType::makeConceptCodePart();
8759 yyextra->current->startLine = yyextra->yyLineNr;
8760 BEGIN( FindConceptParts );
8761 scannerYYlex(yyscanner);
8762 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8763
8764 }
8765 parseConcepts(yyscanner,ce);
8766 }
static void parseConcepts(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8723
8767}

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

8776{
8777 AUTO_TRACE("fileName={}",fileName);
8778 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8779 initParser(yyscanner);
static void initParser(yyscan_t yyscanner)
Definition scanner.l:8036
8780
8781 yyextra->inputString = fileBuf;
8782 yyextra->inputPosition = 0;
8783 yyextra->column = 0;
8784 scannerYYrestart(nullptr,yyscanner);
8785
8786 //depthIf = 0;
8787 yyextra->protection = Protection::Public;
8788 yyextra->mtype = MethodTypes::Method;
8789 yyextra->isStatic = FALSE;
8790 yyextra->exported = false;
8791 yyextra->virt = Specifier::Normal;
8792 yyextra->current_root = rt;
8793 yyextra->yyLineNr = 1 ;
8794 yyextra->yyBegLineNr = 1;
8795 yyextra->yyBegColNr = 0;
8796 yyextra->anonCount = 0;
8797 yyextra->anonNSCount = 0;
8798 yyextra->fileName = fileName;
8799 yyextra->clangParser = clangParser;
8800 setContext(yyscanner);
8801 rt->lang = yyextra->language;
8802 msg("Parsing file {}...\n",yyextra->fileName);
#define msg(fmt,...)
Definition message.h:94
static void setContext(yyscan_t yyscanner)
Definition scanner.l:8241
8803
8804 yyextra->current_root = rt;
8805 initParser(yyscanner);
8806 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
8807 yyextra->current = std::make_shared<Entry>();
8808 //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
8809 EntryType sec=guessSection(yyextra->fileName);
8810 if (!sec.isEmpty())
8811 {
8812 yyextra->current->name = yyextra->fileName;
8813 yyextra->current->section = sec;
8814 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8815 }
8816 yyextra->current->reset();
8817 initEntry(yyscanner);
8818 if ( yyextra->insidePHP )
8819 {
8820 BEGIN( FindMembersPHP );
8821 }
8822 else if ( yyextra->insideJava ) // add default java.lang package scope
8823 {
8824 yyextra->current->name="java::lang"; // '::' is used in doxygen's internal representation as a scope separator
8825 yyextra->current->fileName = yyextra->fileName;
8826 yyextra->current->section = EntryType::makeUsingDir();
8827 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8828 initEntry(yyscanner);
8829 BEGIN( FindMembers );
8830 }
8831 else
8832 {
8833 BEGIN( FindMembers );
8834 }
Wrapper class for the Entry type.
Definition types.h:856
EntryType guessSection(const QCString &name)
Definition util.cpp:338
8835
8836 scannerYYlex(yyscanner);
8837
8838 if (YY_START==Comment)
8839 {
8840 warn(yyextra->fileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?");
8841 }
#define warn(file, line, fmt,...)
Definition message.h:97
8842
8843 //forceEndGroup();
8844 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
8845
8846 yyextra->programStr.clear();
8847 rt->program.str(std::string());
8848
8849 parseCompounds(yyscanner,rt);
8850 parseConcepts(yyscanner,rt);
8851
8852 yyextra->anonNSCount++;
8853
8854 // add additional entries that were created during processing
8855 for (auto &[parent,child]: yyextra->outerScopeEntries)
8856 {
8857 //printf(">>> adding '%s' to scope '%s'\n",qPrint(child->name),qPrint(parent->name));
8858 parent->moveToSubEntryAndKeep(child);
8859 }
8860 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:1335
8861
8862}

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

8867{
8868 AUTO_TRACE("text='{}'",Trace::trunc(text));
8869 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8870 if (text.isEmpty())
8871 {
8872 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8873 return;
8874 }
8875 if (!yyextra->current) // nothing to store (see bug683516)
8876 {
8877 return;
8878 }
8879
8880 const char *orgInputString;
8881 int orgInputPosition;
8882 YY_BUFFER_STATE orgState;
8883
8884 // save scanner state
8885 orgState = YY_CURRENT_BUFFER;
8886 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8887 orgInputString = yyextra->inputString;
8888 orgInputPosition = yyextra->inputPosition;
#define YY_BUF_SIZE
Definition commentcnv.l:19
8889
8890 // set new string
8891 yyextra->inputString = text.data();
8892 yyextra->inputPosition = 0;
8893 yyextra->column = 0;
8894 scannerYYrestart(nullptr, yyscanner);
8895 BEGIN(Prototype);
8896 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:176
8897
8898 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8899 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.isEmpty())
8900 {
8901 yyextra->current->section = EntryType::makeVariableDoc();
8902 }
8903
8904 // restore original scanner state
8905 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8906 yy_switch_to_buffer(orgState, yyscanner);
8907 yyextra->inputString = orgInputString;
8908 yyextra->inputPosition = orgInputPosition;
8909
8910
8911 //printf("**** parsePrototype end\n");
8912}

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

◆ prependScope()

void prependScope ( yyscan_t yyscanner)
static

Definition at line 8263 of file scanner.l.

8264{
8265 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8266 if (yyextra->current_root->section.isScope())
8267 {
8268 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
8269 yyextra->current->name.prepend(yyextra->current_root->name+"::");
8270 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
8271 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
8272 {
8273 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
8274 }
8275 }
This class represents an function or template argument list.
Definition arguments.h:65
8276}

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 8241 of file scanner.l.

8242{
8243 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8244 yyextra->language = getLanguageFromFileName(yyextra->fileName);
8245 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
8246 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
8247 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
8248 yyextra->insideD = yyextra->language==SrcLangExt::D;
8249 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
8250 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
8251 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
8252 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
8253 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
8254 yyextra->language==SrcLangExt::Lex);
8255 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
8256 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
8257 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
8258 // );
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5231
8259}

References getLanguageFromFileName().

Referenced by parseMain().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 8295 of file scanner.l.

8296{
8297 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8298 if (yyextra->insideJava)
8299 {
8300 QCString text=yytext;
8301 yyextra->current->protection = Protection::Public;
8302 if (text.find("protected")!=-1)
8303 yyextra->current->protection = Protection::Protected;
8304 else if (text.find("private")!=-1)
8305 yyextra->current->protection = Protection::Private;
8306 else if (text.find("package")!=-1)
8307 yyextra->current->protection = Protection::Package;
8308 }
8309}

References QCString::find().

◆ splitKnRArg()

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

Definition at line 8312 of file scanner.l.

8313{
8314 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8315 int si = static_cast<int>(yyextra->current->args.length());
8316 if (yyextra->oldStyleArgType.isEmpty()) // new argument
8317 {
8318 std::string args = yyextra->current->args.str();
8319 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
8320 int bi1=-1;
8321 int bi2=-1;
8323 if (reg::search(args,match,re))
8324 {
8325 bi1=(int)match.position();
8326 size_t secondMatchStart = match.position()+match.length(); // search again after first match
8327 if (reg::search(args,match,re,secondMatchStart))
8328 {
8329 bi2=(int)match.position();
8330 }
8331 }
8332 char c;
8333 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
8334 {
8335 int s=bi2+1; // keep opening (
8336 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8337 int i=s;
8338 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8339 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8340 s=i;
8341 while (i<si && isId(yyextra->current->args.at(i))) i++;
8342 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8343 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
8344 }
8345 else if (bi1!=-1) // redundant braces like in "int (*var)"
8346 {
8347 int s=bi1; // strip opening (
8348 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8349 s++;
8350 int i=s+1;
8351 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8352 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8353 s=i;
8354 while (i<si && isId(yyextra->current->args.at(i))) i++;
8355 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8356 }
8357 else // normal "int *var"
8358 {
8359 int l=si,i=l-1,j;
8360 // look for start of name in "type *name"
8361 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
8362 j=i+1;
8363 // look for start of *'s
8364 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
8365 i++;
8366 if (i!=l)
8367 {
8368 yyextra->oldStyleArgType=yyextra->current->args.left(i);
8369 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
8370 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8371 }
8372 else
8373 {
8374 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8375 }
8376 }
8377 }
8378 else // continuation like *arg2 in "int *args,*arg2"
8379 {
8380 int l=si,j=0;
8381 char c;
8382 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
8383 if (j>0)
8384 {
8385 oldStyleArgPtr=yyextra->current->args.left(j);
8386 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8387 }
8388 else
8389 {
8390 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8391 }
8392 }
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:245
QCString left(size_t len) const
Definition qcstring.h:233
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
8393}

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

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8444 of file scanner.l.

8445{
8446 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8447 if (brief)
8448 {
8449 yyextra->current->briefFile = yyextra->fileName;
8450 yyextra->current->briefLine = yyextra->yyLineNr;
8451 }
8452 else
8453 {
8454 yyextra->current->docFile = yyextra->fileName;
8455 yyextra->current->docLine = yyextra->yyLineNr;
8456 }
8457}

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 8222 of file scanner.l.

8223{
8224 QCString r = req.stripWhiteSpace();
8225 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:528
8226}

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

8190{
8191 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8192 if (Config_getBool(MARKDOWN_SUPPORT))
8193 {
8194 yyextra->docBlock << "\\iskip";
8195 }
8196 yyextra->docBlockName=blockName;
8197 yyextra->fencedSize=fencedSize;
8198 yyextra->isCodeBlock=codeBlock;
8199 yyextra->nestedComment=0;
8200}

References Config_getBool.

◆ stateToString()

const char * stateToString ( int state)
static

◆ storeClangId()

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

Definition at line 8081 of file scanner.l.

8082{
8083 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8084 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
8085 {
8086 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
8087 }
8088}

◆ stripFuncPtr()

QCString stripFuncPtr ( const QCString & type)
static

Definition at line 8176 of file scanner.l.

8177{
8178 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
8179 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
8180 size_t i=type.length();
8181 bool funcPtr = i>0 && type[i-1]==')';
8182 if (funcPtr) i--;
8183 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
8184 if (funcPtr && i>0 && type[i-1]=='(') i--;
8185 return type.left(i);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:170
8186}

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

◆ stripQuotes()

QCString stripQuotes ( const char * s)
static

Definition at line 8164 of file scanner.l.

8165{
8166 QCString name;
8167 if (s==nullptr || *s==0) return name;
8168 name=s;
8169 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
8170 {
8171 name=name.mid(1,name.length()-2);
8172 }
8173 return name;
8174}

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

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

◆ yyread()

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

Definition at line 8022 of file scanner.l.

8023{
8024 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8025 int c=0;
8026 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
8027 {
8028 *buf = yyextra->inputString[yyextra->inputPosition++] ;
8029 //printf("%d (%c)\n",*buf,*buf);
8030 c++; buf++;
8031 }
8032 return c;
8033}