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 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:3992

Definition at line 254 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 7969 of file scanner.l.

7971{
7972 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7973 for (Argument &a : yyextra->current->argList)
7974 {
7975 if (a.type==name)
7976 {
7977 a.type=type.stripWhiteSpace();
7978 a.type.stripPrefix("register ");
7979 a.name=name.stripWhiteSpace();
7980 if (!brief.isEmpty() && !docs.isEmpty())
7981 {
7982 a.docs=brief+"\n\n"+docs;
7983 }
7984 else if (!brief.isEmpty())
7985 {
7986 a.docs=brief;
7987 }
7988 else
7989 {
7990 a.docs=docs;
7991 }
7992 }
7993 }
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:198
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
7994}

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

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 7711 of file scanner.l.

7712{
7713 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7714 size_t tl=yyextra->current->type.length();
7715 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7716 {
7717 yyextra->current->type += ' ' ;
7718 }
7719 yyextra->current->type += yyextra->current->name;
7720 yyextra->current->name.clear() ;
7721 tl=yyextra->current->type.length();
7722 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7723 {
7724 yyextra->current->type += ' ' ;
7725 }
7726 yyextra->current->type += yyextra->current->args ;
7727 yyextra->current->args.clear() ;
7728 yyextra->current->argList.clear();
7729}

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

7850{
7851 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7852 if (!yyextra->fileName.lower().endsWith(".c")) return FALSE; // must be a C file
7853 if (yyextra->current->argList.empty()) return FALSE; // must have arguments
7854 for (const Argument &a : yyextra->current->argList)
7855 {
7856 // in K&R style argument do not have a type, but doxygen expects a type
7857 // so it will think the argument has no name
7858 if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE;
7859 }
7860 return TRUE;
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
7861}

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

◆ computeIndent()

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

Definition at line 7684 of file scanner.l.

7685{
7686 int col=startIndent;
7687 int tabSize=Config_getInt(TAB_SIZE);
7688 const char *p=s;
7689 char c;
7690 while ((c=*p++))
7691 {
7692 if (c=='\t') col+=tabSize-(col%tabSize);
7693 else if (c=='\n') col=0;
7694 else col++;
7695 }
7696 return col;
#define Config_getInt(name)
Definition config.h:34
7697}

References Config_getInt.

◆ endVerbatimBlock()

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

Definition at line 7771 of file scanner.l.

7772{
7773 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7774 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
7775 {
7776 if (Config_getBool(MARKDOWN_SUPPORT))
7777 {
7778 yyextra->docBlock << "\\endiskip";
7779 }
7780 yyextra->docBlockName="";
7781 return true;
7782 }
7783 return false;
#define Config_getBool(name)
Definition config.h:33
7784}

References Config_getBool.

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 7998 of file scanner.l.

7999{
8000 for (Argument &a : al)
8001 {
8002 if (!a.type.isEmpty() && a.name.isEmpty())
8003 { // a->type is actually the (typeless) parameter name, so move it
8004 a.name=a.type;
8005 a.type.clear();
8006 }
8007 }
8008}

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

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 257 of file scanner.l.

257{return __FILE__;}

◆ handleCommentBlock()

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

Definition at line 8049 of file scanner.l.

8050{
8051 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8052 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
8053 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
8054 if (yyextra->docBlockInBody && hideInBodyDocs) return;
8055 int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine; // line of block start
#define AUTO_TRACE(...)
Definition docnode.cpp:46
QCString trunc(const QCString &s, size_t numChars=15)
Definition trace.h:56
8056
8057 // fill in inbodyFile && inbodyLine the first time, see bug 633891
8058 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
8059 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
8060 {
8061 docEntry->inbodyFile = yyextra->fileName;
8062 docEntry->inbodyLine = lineNr;
8063 }
8064
8065 int position=0;
8066 bool needsEntry=FALSE;
8067 GuardedSectionStack guards;
8068 Markdown markdown(yyextra->fileName,lineNr);
8069 QCString strippedDoc = stripIndentation(doc);
8070 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8071 while (yyextra->commentScanner.parseCommentBlock(
8072 yyextra->thisParser,
8073 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8074 processedDoc, // text
8075 yyextra->fileName, // file
8076 lineNr, // line of block start
8077 yyextra->docBlockInBody ? FALSE : brief, // isBrief
8078 yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
8079 yyextra->docBlockInBody, // isInBody
8080 yyextra->protection,
8081 position,
8082 needsEntry,
8083 Config_getBool(MARKDOWN_SUPPORT),
8084 &guards
8085 )
8086 )
8087 {
8088 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8089 if (needsEntry)
8090 {
8091 QCString docFile = yyextra->current->docFile;
8092 newEntry(yyscanner);
8093 yyextra->current->docFile = docFile;
8094 yyextra->current->docLine = lineNr;
8095 }
8096 }
8097 if (needsEntry)
8098 {
8099 newEntry(yyscanner);
8100 }
Helper class to process markdown formatted text.
Definition markdown.h:32
This is an alternative implementation of QCString.
Definition qcstring.h:101
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
static void newEntry(yyscan_t yyscanner)
Definition scanner.l:8029
QCString stripIndentation(const QCString &s, bool skipFirstLine)
Definition util.cpp:6468
8101
8102 if (yyextra->docBlockTerm)
8103 {
8104 unput(yyextra->docBlockTerm);
8105 yyextra->docBlockTerm=0;
8106 }
8107}

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

8110{
8111 AUTO_TRACE();
8112 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8113 for (Argument &a : al)
8114 {
8115 AUTO_TRACE_ADD("Param '{}' docs='{}'",a.name,Trace::trunc(a.docs));
8116 if (!a.docs.isEmpty())
8117 {
8118 if (a.name.isEmpty() && a.type == "...") a.name= "...";
8119 int position=0;
8120 bool needsEntry;
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:47
8121
8122 // save context
8123 QCString orgDoc = yyextra->current->doc;
8124 QCString orgBrief = yyextra->current->brief;
8125 int orgDocLine = yyextra->current->docLine;
8126 int orgBriefLine = yyextra->current->briefLine;
8127
8128 yyextra->current->doc.clear();
8129 yyextra->current->brief.clear();
8130
8131 //printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
8132 int lineNr = orgDocLine;
8133 GuardedSectionStack guards;
8134 Markdown markdown(yyextra->fileName,lineNr);
8135 QCString strippedDoc = stripIndentation(a.docs);
8136 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8137 while (yyextra->commentScanner.parseCommentBlock(
8138 yyextra->thisParser,
8139 yyextra->current.get(),
8140 processedDoc, // text
8141 yyextra->fileName, // file
8142 lineNr,
8143 FALSE,
8144 FALSE,
8145 FALSE,
8146 yyextra->protection,
8147 position,
8148 needsEntry,
8149 Config_getBool(MARKDOWN_SUPPORT),
8150 &guards
8151 )
8152 )
8153 {
8154 //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8155 if (needsEntry) newEntry(yyscanner);
8156 }
8157 if (needsEntry)
8158 {
8159 newEntry(yyscanner);
8160 }
8161 a.docs = yyextra->current->doc;
8162
8163 // restore context
8164 yyextra->current->doc = orgDoc;
8165 yyextra->current->brief = orgBrief;
8166 yyextra->current->docLine = orgDocLine;
8167 yyextra->current->briefLine = orgBriefLine;
8168 }
8169 }
8170}

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

7632{
7633 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7634 if (yyextra->insideJava)
7635 {
7636 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
7637 }
7638 yyextra->current->protection = yyextra->protection;
7639 yyextra->current->exported = yyextra->exported ;
7640 yyextra->current->mtype = yyextra->mtype;
7641 yyextra->current->virt = yyextra->virt;
7642 yyextra->current->isStatic = yyextra->isStatic;
7643 yyextra->current->lang = yyextra->language;
7644 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
7645 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
7646 yyextra->isTypedef=FALSE;
7647}

References FALSE.

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 7699 of file scanner.l.

7700{
7701 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7702 yyextra->current->protection = yyextra->protection = prot;
7703 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
7704 yyextra->current->type.clear();
7705 yyextra->current->name.clear();
7706 yyextra->current->args.clear();
7707 yyextra->current->argList.clear();
7708 lineCount(yyscanner) ;
#define lineCount(s, len)
7709}

References lineCount, and Entry::protection.

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 7607 of file scanner.l.

7608{
7609 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7610 yyextra->outerScopeEntries.clear();
7611 yyextra->baseName.clear();
7612 yyextra->protection = Protection::Public;
7613 yyextra->baseProt = Protection::Public;
7614 yyextra->sharpCount = 0;
7615 yyextra->roundCount = 0;
7616 yyextra->curlyCount = 0;
7617 yyextra->mtype = MethodTypes::Method;
7618 yyextra->isStatic = FALSE;
7619 yyextra->virt = Specifier::Normal;
7620 yyextra->baseVirt = Specifier::Normal;
7621 yyextra->isTypedef = FALSE;
7622 yyextra->insideTryBlock = FALSE;
7623 yyextra->insideFormula = FALSE;
7624 yyextra->insideCode=FALSE;
7625 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
7626 yyextra->previous = 0;
7627 yyextra->firstTypedefEntry.reset();
7628 yyextra->memspecEntry.reset();
7629}

References Config_getBool, and FALSE.

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 7661 of file scanner.l.

7662{
7663 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7664 int tabSize = Config_getInt(TAB_SIZE);
7665 const char *p;
7666 for (p = yytext ; *p ; ++p )
7667 {
7668 if (*p=='\n')
7669 {
7670 yyextra->yyLineNr++,yyextra->column=0,yyextra->yyColNr=1;
7671 }
7672 else if (*p=='\t')
7673 {
7674 yyextra->column+=tabSize - (yyextra->column%tabSize);
7675 }
7676 else
7677 {
7678 yyextra->column++,yyextra->yyColNr++;
7679 }
7680 }
7681 //printf("lineCount()=%d\n",yyextra->column);
7682}

References Config_getInt.

◆ nameIsOperator()

bool nameIsOperator ( QCString & name)
static

Definition at line 7798 of file scanner.l.

7799{
7800 int i=name.find("operator");
7801 if (i==-1) return FALSE;
7802 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
7803 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
7804 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:578
bool isId(int c)
Definition util.h:208
7805}

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

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8029 of file scanner.l.

8030{
8031 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8032 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
8033 // and yyextra->current is actually replaced by yyextra->previous which was
8034 // already added to yyextra->current_root, so we should not add it again
8035 // (see bug723314)
8036 {
8037 yyextra->previous = yyextra->current;
8038 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8039 }
8040 else
8041 {
8042 yyextra->previous = yyextra->current;
8043 yyextra->current = yyextra->tempEntry;
8044 yyextra->tempEntry.reset();
8045 }
8046 initEntry(yyscanner);
static void initEntry(yyscan_t yyscanner)
Definition scanner.l:7631
8047}

References initEntry().

◆ parseCompounds()

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

Definition at line 8175 of file scanner.l.

8176{
8177 AUTO_TRACE("name={}",rt->name);
8178 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8179 for (const auto &ce : rt->children())
8180 {
8181 if (!ce->program.empty())
8182 {
8183 AUTO_TRACE_ADD("compound name='{}' program='{}'",Trace::trunc(ce->name),Trace::trunc(ce->program.str()));
8184 // init scanner state
8185 yyextra->padCount=0;
8186 //depthIf = 0;
8187 yyextra->column=0;
8188 yyextra->programStr = ce->program.str();
8189 yyextra->inputString = yyextra->programStr.data();
8190 yyextra->inputPosition = 0;
8191 if (ce->section.isEnum() || ce->spec.isEnum())
8192 BEGIN( FindFields ) ;
8193 else
8194 BEGIN( FindMembers ) ;
8195 yyextra->current_root = ce;
8196 yyextra->fileName = ce->fileName;
8197 //setContext();
8198 yyextra->yyLineNr = ce->bodyLine;
8199 yyextra->yyColNr = ce->bodyColumn;
8200 yyextra->insideObjC = ce->lang==SrcLangExt::ObjC;
8201 //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
8202 yyextra->current = std::make_shared<Entry>();
8203 yyextra->isStatic = FALSE;
8204 initEntry(yyscanner);
8205
8206 // deep copy group list from parent (see bug 727732)
8207 bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
8208 if (autoGroupNested && !rt->groups.empty() && !ce->section.isEnum() && !ce->spec.isEnum())
8209 {
8210 ce->groups = rt->groups;
8211 }
8212
8213 int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2;
8214 // set default protection based on the compound type
8215 if ( ce->section.isClass() ) // class
8216 {
8217 if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
8218 {
8219 yyextra->current->protection = yyextra->protection = Protection::Public ;
8220 }
8221 else if (yyextra->insideJava)
8222 {
8223 yyextra->current->protection = yyextra->protection = (ce->spec.isInterface() || ce->spec.isEnum()) ? Protection::Public : Protection::Package;
8224 }
8225 else if (ce->spec.isInterface() || ce->spec.isRef() || ce->spec.isValue() || ce->spec.isStruct() || ce->spec.isUnion())
8226 {
8227 if (ce->lang==SrcLangExt::ObjC)
8228 {
8229 yyextra->current->protection = yyextra->protection = Protection::Protected ;
8230 }
8231 else
8232 {
8233 yyextra->current->protection = yyextra->protection = Protection::Public ;
8234 }
8235 }
8236 else
8237 {
8238 yyextra->current->protection = yyextra->protection = Protection::Private ;
8239 }
8240 }
8241 else if (ce->section.isEnum() ) // enum
8242 {
8243 yyextra->current->protection = yyextra->protection = ce->protection;
8244 }
8245 else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
8246 {
8247 if (ce->section.isNamespace() ) // unnamed namespace
8248 {
8249 yyextra->current->isStatic = yyextra->isStatic = TRUE;
8250 }
8251 yyextra->current->protection = yyextra->protection = ce->protection;
8252 yyextra->current->exported = yyextra->exported = false;
8253 }
8254 else if (ce->section.isNamespace() )
8255 {
8256 yyextra->current->protection = yyextra->protection = Protection::Public ;
8257 yyextra->current->exported = yyextra->exported = ce->exported;
8258 }
8259 else // named struct, union, protocol, category
8260 {
8261 yyextra->current->protection = yyextra->protection = Protection::Public ;
8262 yyextra->current->exported = yyextra->exported = false;
8263 }
8264 yyextra->mtype = MethodTypes::Method;
8265 yyextra->virt = Specifier::Normal;
8266 //printf("name=%s yyextra->current->isStatic=%d yyextra->isStatic=%d\n",qPrint(ce->name),yyextra->current->isStatic,yyextra->isStatic);
8267
8268 //memberGroupId = DOX_NOGROUP;
8269 //memberGroupRelates.clear();
8270 //memberGroupInside.clear();
8271 QCString name = ce->name;
8272 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
8273
8274 scannerYYlex(yyscanner);
8275 yyextra->lexInit=TRUE;
8276 //forceEndGroup();
8277
8278 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
8279
8280 yyextra->programStr.clear();
8281 ce->program.str(std::string());
8282
8283
8284 //if (depthIf>0)
8285 //{
8286 // warn(yyextra->fileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
8287 //}
8288 }
8289 parseCompounds(yyscanner,ce);
8290 }
static void parseCompounds(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8175
8291}

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

◆ parseMain()

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

Definition at line 8295 of file scanner.l.

8300{
8301 AUTO_TRACE("fileName={}",fileName);
8302 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8303 initParser(yyscanner);
static void initParser(yyscan_t yyscanner)
Definition scanner.l:7607
8304
8305 yyextra->inputString = fileBuf;
8306 yyextra->inputPosition = 0;
8307 yyextra->column = 0;
8308 scannerYYrestart(nullptr,yyscanner);
8309
8310 //depthIf = 0;
8311 yyextra->protection = Protection::Public;
8312 yyextra->mtype = MethodTypes::Method;
8313 yyextra->isStatic = FALSE;
8314 yyextra->exported = false;
8315 yyextra->virt = Specifier::Normal;
8316 yyextra->current_root = rt;
8317 yyextra->yyLineNr = 1 ;
8318 yyextra->yyBegLineNr = 1;
8319 yyextra->yyBegColNr = 0;
8320 yyextra->anonCount = 0;
8321 yyextra->anonNSCount = 0;
8322 yyextra->fileName = fileName;
8323 yyextra->clangParser = clangParser;
8324 setContext(yyscanner);
8325 rt->lang = yyextra->language;
8326 msg("Parsing file {}...\n",yyextra->fileName);
#define msg(fmt,...)
Definition message.h:94
static void setContext(yyscan_t yyscanner)
Definition scanner.l:7809
8327
8328 yyextra->current_root = rt;
8329 initParser(yyscanner);
8330 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
8331 yyextra->current = std::make_shared<Entry>();
8332 //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
8333 EntryType sec=guessSection(yyextra->fileName);
8334 if (!sec.isEmpty())
8335 {
8336 yyextra->current->name = yyextra->fileName;
8337 yyextra->current->section = sec;
8338 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8339 }
8340 yyextra->current->reset();
8341 initEntry(yyscanner);
8342 if ( yyextra->insidePHP )
8343 {
8344 BEGIN( FindMembersPHP );
8345 }
8346 else if ( yyextra->insideJava ) // add default java.lang package scope
8347 {
8348 yyextra->current->name="java::lang"; // '::' is used in doxygen's internal representation as a scope separator
8349 yyextra->current->fileName = yyextra->fileName;
8350 yyextra->current->section = EntryType::makeUsingDir();
8351 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8352 initEntry(yyscanner);
8353 BEGIN( FindMembers );
8354 }
8355 else
8356 {
8357 BEGIN( FindMembers );
8358 }
Wrapper class for the Entry type.
Definition types.h:793
EntryType guessSection(const QCString &name)
Definition util.cpp:350
8359
8360 scannerYYlex(yyscanner);
8361 yyextra->lexInit=TRUE;
8362
8363 if (YY_START==Comment)
8364 {
8365 warn(yyextra->fileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?");
8366 }
#define warn(file, line, fmt,...)
Definition message.h:97
8367
8368 //forceEndGroup();
8369 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
8370
8371 yyextra->programStr.clear();
8372 rt->program.str(std::string());
8373
8374 parseCompounds(yyscanner,rt);
8375
8376 yyextra->anonNSCount++;
8377
8378 // add additional entries that were created during processing
8379 for (auto &[parent,child]: yyextra->outerScopeEntries)
8380 {
8381 //printf(">>> adding '%s' to scope '%s'\n",qPrint(child->name),qPrint(parent->name));
8382 parent->moveToSubEntryAndKeep(child);
8383 }
8384 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:1330
8385
8386}

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

◆ parsePrototype()

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

Definition at line 8390 of file scanner.l.

8391{
8392 AUTO_TRACE("text='{}'",Trace::trunc(text));
8393 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8394 if (text.isEmpty())
8395 {
8396 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8397 return;
8398 }
8399 if (!yyextra->current) // nothing to store (see bug683516)
8400 {
8401 return;
8402 }
8403
8404 const char *orgInputString;
8405 int orgInputPosition;
8406 YY_BUFFER_STATE orgState;
8407
8408 // save scanner state
8409 orgState = YY_CURRENT_BUFFER;
8410 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8411 orgInputString = yyextra->inputString;
8412 orgInputPosition = yyextra->inputPosition;
#define YY_BUF_SIZE
Definition commentcnv.l:19
8413
8414 // set new string
8415 yyextra->inputString = text.data();
8416 yyextra->inputPosition = 0;
8417 yyextra->column = 0;
8418 scannerYYrestart(nullptr, yyscanner);
8419 BEGIN(Prototype);
8420 scannerYYlex(yyscanner);
8421 yyextra->lexInit=TRUE;
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:159
8422
8423 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8424 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.isEmpty())
8425 {
8426 yyextra->current->section = EntryType::makeVariableDoc();
8427 }
8428
8429 // restore original scanner state
8430 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8431 yy_switch_to_buffer(orgState, yyscanner);
8432 yyextra->inputString = orgInputString;
8433 yyextra->inputPosition = orgInputPosition;
8434
8435
8436 //printf("**** parsePrototype end\n");
8437}

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

◆ prependScope()

void prependScope ( yyscan_t yyscanner)
static

Definition at line 7831 of file scanner.l.

7832{
7833 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7834 if (yyextra->current_root->section.isScope())
7835 {
7836 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
7837 yyextra->current->name.prepend(yyextra->current_root->name+"::");
7838 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
7839 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
7840 {
7841 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
7842 }
7843 }
This class represents an function or template argument list.
Definition arguments.h:65
7844}

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 7809 of file scanner.l.

7810{
7811 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7812 yyextra->language = getLanguageFromFileName(yyextra->fileName);
7813 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
7814 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
7815 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
7816 yyextra->insideD = yyextra->language==SrcLangExt::D;
7817 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
7818 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
7819 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
7820 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
7821 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
7822 yyextra->language==SrcLangExt::Lex);
7823 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
7824 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
7825 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
7826 // );
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5724
7827}

References getLanguageFromFileName().

Referenced by parseMain().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 7863 of file scanner.l.

7864{
7865 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7866 if (yyextra->insideJava)
7867 {
7868 QCString text=yytext;
7869 yyextra->current->protection = Protection::Public;
7870 if (text.find("protected")!=-1)
7871 yyextra->current->protection = Protection::Protected;
7872 else if (text.find("private")!=-1)
7873 yyextra->current->protection = Protection::Private;
7874 else if (text.find("package")!=-1)
7875 yyextra->current->protection = Protection::Package;
7876 }
7877}

References QCString::find().

◆ splitKnRArg()

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

Definition at line 7880 of file scanner.l.

7881{
7882 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7883 int si = static_cast<int>(yyextra->current->args.length());
7884 if (yyextra->oldStyleArgType.isEmpty()) // new argument
7885 {
7886 std::string args = yyextra->current->args.str();
7887 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
7888 int bi1=-1;
7889 int bi2=-1;
7891 if (reg::search(args,match,re))
7892 {
7893 bi1=(int)match.position();
7894 size_t secondMatchStart = match.position()+match.length(); // search again after first match
7895 if (reg::search(args,match,re,secondMatchStart))
7896 {
7897 bi2=(int)match.position();
7898 }
7899 }
7900 char c;
7901 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
7902 {
7903 int s=bi2+1; // keep opening (
7904 yyextra->oldStyleArgType = yyextra->current->args.left(s);
7905 int i=s;
7906 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
7907 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
7908 s=i;
7909 while (i<si && isId(yyextra->current->args.at(i))) i++;
7910 oldStyleArgName = yyextra->current->args.mid(s,i-s);
7911 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
7912 }
7913 else if (bi1!=-1) // redundant braces like in "int (*var)"
7914 {
7915 int s=bi1; // strip opening (
7916 yyextra->oldStyleArgType = yyextra->current->args.left(s);
7917 s++;
7918 int i=s+1;
7919 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
7920 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
7921 s=i;
7922 while (i<si && isId(yyextra->current->args.at(i))) i++;
7923 oldStyleArgName = yyextra->current->args.mid(s,i-s);
7924 }
7925 else // normal "int *var"
7926 {
7927 int l=si,i=l-1,j;
7928 // look for start of name in "type *name"
7929 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
7930 j=i+1;
7931 // look for start of *'s
7932 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
7933 i++;
7934 if (i!=l)
7935 {
7936 yyextra->oldStyleArgType=yyextra->current->args.left(i);
7937 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
7938 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
7939 }
7940 else
7941 {
7942 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
7943 }
7944 }
7945 }
7946 else // continuation like *arg2 in "int *args,*arg2"
7947 {
7948 int l=si,j=0;
7949 char c;
7950 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
7951 if (j>0)
7952 {
7953 oldStyleArgPtr=yyextra->current->args.left(j);
7954 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
7955 }
7956 else
7957 {
7958 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
7959 }
7960 }
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
QCString left(size_t len) const
Definition qcstring.h:214
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:153
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:748
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:759
7961}

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

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8012 of file scanner.l.

8013{
8014 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8015 if (brief)
8016 {
8017 yyextra->current->briefFile = yyextra->fileName;
8018 yyextra->current->briefLine = yyextra->yyLineNr;
8019 }
8020 else
8021 {
8022 yyextra->current->docFile = yyextra->fileName;
8023 yyextra->current->docLine = yyextra->yyLineNr;
8024 }
8025}

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 7790 of file scanner.l.

7791{
7792 QCString r = req.stripWhiteSpace();
7793 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:509
7794}

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

7758{
7759 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7760 if (Config_getBool(MARKDOWN_SUPPORT))
7761 {
7762 yyextra->docBlock << "\\iskip";
7763 }
7764 yyextra->docBlockName=blockName;
7765 yyextra->fencedSize=fencedSize;
7766 yyextra->isCodeBlock=codeBlock;
7767 yyextra->nestedComment=0;
7768}

References Config_getBool.

◆ stateToString()

const char * stateToString ( int state)
static

◆ storeClangId()

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

Definition at line 7652 of file scanner.l.

7653{
7654 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7655 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
7656 {
7657 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
7658 }
7659}

◆ stripFuncPtr()

QCString stripFuncPtr ( const QCString & type)
static

Definition at line 7744 of file scanner.l.

7745{
7746 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
7747 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
7748 size_t i=type.length();
7749 bool funcPtr = i>0 && type[i-1]==')';
7750 if (funcPtr) i--;
7751 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
7752 if (funcPtr && i>0 && type[i-1]=='(') i--;
7753 return type.left(i);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
7754}

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

◆ stripQuotes()

QCString stripQuotes ( const char * s)
static

Definition at line 7732 of file scanner.l.

7733{
7734 QCString name;
7735 if (s==nullptr || *s==0) return name;
7736 name=s;
7737 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
7738 {
7739 name=name.mid(1,name.length()-2);
7740 }
7741 return name;
7742}

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

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

◆ yyread()

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

Definition at line 7593 of file scanner.l.

7594{
7595 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7596 int c=0;
7597 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7598 {
7599 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7600 //printf("%d (%c)\n",*buf,*buf);
7601 c++; buf++;
7602 }
7603 return c;
7604}