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

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

8072{
8073 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8074 for (Argument &a : yyextra->current->argList)
8075 {
8076 if (a.type==name)
8077 {
8078 a.type=type.stripWhiteSpace();
8079 a.type.stripPrefix("register ");
8080 a.name=name.stripWhiteSpace();
8081 if (!brief.isEmpty() && !docs.isEmpty())
8082 {
8083 a.docs=brief+"\n\n"+docs;
8084 }
8085 else if (!brief.isEmpty())
8086 {
8087 a.docs=brief;
8088 }
8089 else
8090 {
8091 a.docs=docs;
8092 }
8093 }
8094 }
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:260
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:213
This class contains the information about the argument of a function or template.
Definition arguments.h:27
QCString type
Definition arguments.h:42
QCString name
Definition arguments.h:44
QCString docs
Definition arguments.h:47
8095}

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

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 7812 of file scanner.l.

7813{
7814 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7815 size_t tl=yyextra->current->type.length();
7816 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7817 {
7818 yyextra->current->type += ' ' ;
7819 }
7820 yyextra->current->type += yyextra->current->name;
7821 yyextra->current->name.clear() ;
7822 tl=yyextra->current->type.length();
7823 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7824 {
7825 yyextra->current->type += ' ' ;
7826 }
7827 yyextra->current->type += yyextra->current->args ;
7828 yyextra->current->args.clear() ;
7829 yyextra->current->argList.clear();
7830}

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

7951{
7952 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7953 if (!yyextra->fileName.lower().endsWith(".c")) return FALSE; // must be a C file
7954 if (yyextra->current->argList.empty()) return FALSE; // must have arguments
7955 for (const Argument &a : yyextra->current->argList)
7956 {
7957 // in K&R style argument do not have a type, but doxygen expects a type
7958 // so it will think the argument has no name
7959 if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE;
7960 }
7961 return TRUE;
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
7962}

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

◆ computeIndent()

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

Definition at line 7785 of file scanner.l.

7786{
7787 int col=startIndent;
7788 int tabSize=Config_getInt(TAB_SIZE);
7789 const char *p=s;
7790 char c;
7791 while ((c=*p++))
7792 {
7793 if (c=='\t') col+=tabSize-(col%tabSize);
7794 else if (c=='\n') col=0;
7795 else col++;
7796 }
7797 return col;
#define Config_getInt(name)
Definition config.h:34
7798}

References Config_getInt.

◆ endVerbatimBlock()

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

Definition at line 7872 of file scanner.l.

7873{
7874 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7875 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
7876 {
7877 if (Config_getBool(MARKDOWN_SUPPORT))
7878 {
7879 yyextra->docBlock << "\\endiskip";
7880 }
7881 yyextra->docBlockName="";
7882 return true;
7883 }
7884 return false;
#define Config_getBool(name)
Definition config.h:33
7885}

References Config_getBool.

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 8099 of file scanner.l.

8100{
8101 for (Argument &a : al)
8102 {
8103 if (!a.type.isEmpty() && a.name.isEmpty())
8104 { // a->type is actually the (typeless) parameter name, so move it
8105 a.name=a.type;
8106 a.type.clear();
8107 }
8108 }
8109}

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

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 259 of file scanner.l.

259{return __FILE__;}

◆ handleCommentBlock()

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

Definition at line 8150 of file scanner.l.

8151{
8152 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8153 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
8154 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
8155 if (yyextra->docBlockInBody && hideInBodyDocs) return;
8156 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
8157
8158 // fill in inbodyFile && inbodyLine the first time, see bug 633891
8159 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
8160 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
8161 {
8162 docEntry->inbodyFile = yyextra->fileName;
8163 docEntry->inbodyLine = lineNr;
8164 }
8165
8166 int position=0;
8167 bool needsEntry=FALSE;
8168 GuardedSectionStack guards;
8169 Markdown markdown(yyextra->fileName,lineNr);
8170 QCString strippedDoc = stripIndentation(doc);
8171 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8172 while (yyextra->commentScanner.parseCommentBlock(
8173 yyextra->thisParser,
8174 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8175 processedDoc, // text
8176 yyextra->fileName, // file
8177 lineNr, // line of block start
8178 yyextra->docBlockInBody ? FALSE : brief, // isBrief
8179 yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
8180 yyextra->docBlockInBody, // isInBody
8181 yyextra->protection,
8182 position,
8183 needsEntry,
8184 Config_getBool(MARKDOWN_SUPPORT),
8185 &guards
8186 )
8187 )
8188 {
8189 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8190 if (needsEntry)
8191 {
8192 QCString docFile = yyextra->current->docFile;
8193 newEntry(yyscanner);
8194 yyextra->current->docFile = docFile;
8195 yyextra->current->docLine = lineNr;
8196 }
8197 }
8198 if (needsEntry)
8199 {
8200 newEntry(yyscanner);
8201 }
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:8130
QCString stripIndentation(const QCString &s, bool skipFirstLine)
Definition util.cpp:5901
8202
8203 if (yyextra->docBlockTerm)
8204 {
8205 unput(yyextra->docBlockTerm);
8206 yyextra->docBlockTerm=0;
8207 }
8208}

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

8211{
8212 AUTO_TRACE();
8213 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8214 for (Argument &a : al)
8215 {
8216 AUTO_TRACE_ADD("Param '{}' docs='{}'",a.name,Trace::trunc(a.docs));
8217 if (!a.docs.isEmpty())
8218 {
8219 if (a.name.isEmpty() && a.type == "...") a.name= "...";
8220 int position=0;
8221 bool needsEntry;
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:47
8222
8223 // save context
8224 QCString orgDoc = yyextra->current->doc;
8225 QCString orgBrief = yyextra->current->brief;
8226 int orgDocLine = yyextra->current->docLine;
8227 int orgBriefLine = yyextra->current->briefLine;
8228
8229 yyextra->current->doc.clear();
8230 yyextra->current->brief.clear();
8231
8232 //printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
8233 int lineNr = orgDocLine;
8234 GuardedSectionStack guards;
8235 Markdown markdown(yyextra->fileName,lineNr);
8236 QCString strippedDoc = stripIndentation(a.docs);
8237 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8238 while (yyextra->commentScanner.parseCommentBlock(
8239 yyextra->thisParser,
8240 yyextra->current.get(),
8241 processedDoc, // text
8242 yyextra->fileName, // file
8243 lineNr,
8244 FALSE,
8245 FALSE,
8246 FALSE,
8247 yyextra->protection,
8248 position,
8249 needsEntry,
8250 Config_getBool(MARKDOWN_SUPPORT),
8251 &guards
8252 )
8253 )
8254 {
8255 //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8256 if (needsEntry) newEntry(yyscanner);
8257 }
8258 if (needsEntry)
8259 {
8260 newEntry(yyscanner);
8261 }
8262 a.docs = yyextra->current->doc;
8263
8264 // restore context
8265 yyextra->current->doc = orgDoc;
8266 yyextra->current->brief = orgBrief;
8267 yyextra->current->docLine = orgDocLine;
8268 yyextra->current->briefLine = orgBriefLine;
8269 }
8270 }
8271}

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

7730{
7731 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7732 if (yyextra->insideJava)
7733 {
7734 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
7735 }
7736 yyextra->current->protection = yyextra->protection;
7737 yyextra->current->exported = yyextra->exported ;
7738 yyextra->current->mtype = yyextra->mtype;
7739 yyextra->current->virt = yyextra->virt;
7740 yyextra->current->isStatic = yyextra->isStatic;
7741 yyextra->current->lang = yyextra->language;
7742 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
7743 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
7744 yyextra->isTypedef=FALSE;
7745}

References FALSE.

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 7800 of file scanner.l.

7801{
7802 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7803 yyextra->current->protection = yyextra->protection = prot;
7804 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
7805 yyextra->current->type.clear();
7806 yyextra->current->name.clear();
7807 yyextra->current->args.clear();
7808 yyextra->current->argList.clear();
7809 lineCount(yyscanner) ;
#define lineCount(s, len)
7810}

References lineCount, and Entry::protection.

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 7705 of file scanner.l.

7706{
7707 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7708 yyextra->outerScopeEntries.clear();
7709 yyextra->baseName.clear();
7710 yyextra->protection = Protection::Public;
7711 yyextra->baseProt = Protection::Public;
7712 yyextra->sharpCount = 0;
7713 yyextra->roundCount = 0;
7714 yyextra->curlyCount = 0;
7715 yyextra->mtype = MethodTypes::Method;
7716 yyextra->isStatic = FALSE;
7717 yyextra->virt = Specifier::Normal;
7718 yyextra->baseVirt = Specifier::Normal;
7719 yyextra->isTypedef = FALSE;
7720 yyextra->insideTryBlock = FALSE;
7721 yyextra->insideFormula = FALSE;
7722 yyextra->insideCode=FALSE;
7723 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
7724 yyextra->previous = 0;
7725 yyextra->firstTypedefEntry.reset();
7726 yyextra->memspecEntry.reset();
7727}

References Config_getBool, and FALSE.

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 7759 of file scanner.l.

7760{
7761 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7762 int tabSize = Config_getInt(TAB_SIZE);
7763 const char *p;
7764 for (p = yytext ; *p ; ++p )
7765 {
7766 if (*p=='\n')
7767 {
7768 yyextra->yyLineNr++;
7769 yyextra->column=0;
7770 yyextra->yyColNr=1;
7771 }
7772 else if (*p=='\t')
7773 {
7774 yyextra->column+=tabSize - (yyextra->column%tabSize);
7775 }
7776 else
7777 {
7778 yyextra->column++;
7779 yyextra->yyColNr++;
7780 }
7781 }
7782 //printf("lineCount()=%d\n",yyextra->column);
7783}

References Config_getInt.

◆ nameIsOperator()

bool nameIsOperator ( QCString & name)
static

Definition at line 7899 of file scanner.l.

7900{
7901 int i=name.find("operator");
7902 if (i==-1) return FALSE;
7903 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
7904 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
7905 return FALSE; // case TEXToperatorTEXT
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:593
bool isId(int c)
Definition util.h:207
7906}

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

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8130 of file scanner.l.

8131{
8132 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8133 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
8134 // and yyextra->current is actually replaced by yyextra->previous which was
8135 // already added to yyextra->current_root, so we should not add it again
8136 // (see bug723314)
8137 {
8138 yyextra->previous = yyextra->current;
8139 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8140 }
8141 else
8142 {
8143 yyextra->previous = yyextra->current;
8144 yyextra->current = yyextra->tempEntry;
8145 yyextra->tempEntry.reset();
8146 }
8147 initEntry(yyscanner);
static void initEntry(yyscan_t yyscanner)
Definition scanner.l:7729
8148}

References initEntry().

◆ parseCompounds()

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

Definition at line 8276 of file scanner.l.

8277{
8278 AUTO_TRACE("name={}",rt->name);
8279 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8280 for (const auto &ce : rt->children())
8281 {
8282 if (!ce->program.empty())
8283 {
8284 AUTO_TRACE_ADD("compound name='{}' program='{}'",Trace::trunc(ce->name),Trace::trunc(ce->program.str()));
8285 // init scanner state
8286 yyextra->padCount=0;
8287 //depthIf = 0;
8288 yyextra->column=0;
8289 yyextra->programStr = ce->program.str();
8290 yyextra->inputString = yyextra->programStr.data();
8291 yyextra->inputPosition = 0;
8292 if (ce->section.isEnum() || ce->spec.isEnum())
8293 BEGIN( FindFields ) ;
8294 else
8295 BEGIN( FindMembers ) ;
8296 yyextra->current_root = ce;
8297 yyextra->fileName = ce->fileName;
8298 //setContext();
8299 yyextra->yyLineNr = ce->bodyLine;
8300 yyextra->yyColNr = ce->bodyColumn;
8301 yyextra->insideObjC = ce->lang==SrcLangExt::ObjC;
8302 //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
8303 yyextra->current = std::make_shared<Entry>();
8304 yyextra->isStatic = FALSE;
8305 initEntry(yyscanner);
8306
8307 // deep copy group list from parent (see bug 727732)
8308 bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
8309 if (autoGroupNested && !rt->groups.empty() && !ce->section.isEnum() && !ce->spec.isEnum())
8310 {
8311 ce->groups = rt->groups;
8312 }
8313
8314 int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2;
8315 // set default protection based on the compound type
8316 if ( ce->section.isClass() ) // class
8317 {
8318 if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
8319 {
8320 yyextra->current->protection = yyextra->protection = Protection::Public ;
8321 }
8322 else if (yyextra->insideJava)
8323 {
8324 yyextra->current->protection = yyextra->protection = (ce->spec.isInterface() || ce->spec.isEnum()) ? Protection::Public : Protection::Package;
8325 }
8326 else if (ce->spec.isInterface() || ce->spec.isRef() || ce->spec.isValue() || ce->spec.isStruct() || ce->spec.isUnion())
8327 {
8328 if (ce->lang==SrcLangExt::ObjC)
8329 {
8330 yyextra->current->protection = yyextra->protection = Protection::Protected ;
8331 }
8332 else
8333 {
8334 yyextra->current->protection = yyextra->protection = Protection::Public ;
8335 }
8336 }
8337 else
8338 {
8339 yyextra->current->protection = yyextra->protection = Protection::Private ;
8340 }
8341 }
8342 else if (ce->section.isEnum() ) // enum
8343 {
8344 yyextra->current->protection = yyextra->protection = ce->protection;
8345 }
8346 else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
8347 {
8348 if (ce->section.isNamespace() ) // unnamed namespace
8349 {
8350 yyextra->current->isStatic = yyextra->isStatic = TRUE;
8351 }
8352 yyextra->current->protection = yyextra->protection = ce->protection;
8353 yyextra->current->exported = yyextra->exported = false;
8354 }
8355 else if (ce->section.isNamespace() )
8356 {
8357 yyextra->current->protection = yyextra->protection = Protection::Public ;
8358 yyextra->current->exported = yyextra->exported = ce->exported;
8359 }
8360 else // named struct, union, protocol, category
8361 {
8362 yyextra->current->protection = yyextra->protection = Protection::Public ;
8363 yyextra->current->exported = yyextra->exported = false;
8364 }
8365 yyextra->mtype = MethodTypes::Method;
8366 yyextra->virt = Specifier::Normal;
8367 //printf("name=%s yyextra->current->isStatic=%d yyextra->isStatic=%d\n",qPrint(ce->name),yyextra->current->isStatic,yyextra->isStatic);
8368
8369 //memberGroupId = DOX_NOGROUP;
8370 //memberGroupRelates.clear();
8371 //memberGroupInside.clear();
8372 QCString name = ce->name;
8373 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
8374
8375 scannerYYlex(yyscanner);
8376 yyextra->lexInit=TRUE;
8377 //forceEndGroup();
8378
8379 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
8380
8381 yyextra->programStr.clear();
8382 ce->program.str(std::string());
8383
8384
8385 //if (depthIf>0)
8386 //{
8387 // warn(yyextra->fileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
8388 //}
8389 }
8390 parseCompounds(yyscanner,ce);
8391 }
static void parseCompounds(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8276
8392}

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

8401{
8402 AUTO_TRACE("fileName={}",fileName);
8403 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8404 initParser(yyscanner);
static void initParser(yyscan_t yyscanner)
Definition scanner.l:7705
8405
8406 yyextra->inputString = fileBuf;
8407 yyextra->inputPosition = 0;
8408 yyextra->column = 0;
8409 scannerYYrestart(nullptr,yyscanner);
8410
8411 //depthIf = 0;
8412 yyextra->protection = Protection::Public;
8413 yyextra->mtype = MethodTypes::Method;
8414 yyextra->isStatic = FALSE;
8415 yyextra->exported = false;
8416 yyextra->virt = Specifier::Normal;
8417 yyextra->current_root = rt;
8418 yyextra->yyLineNr = 1 ;
8419 yyextra->yyBegLineNr = 1;
8420 yyextra->yyBegColNr = 0;
8421 yyextra->anonCount = 0;
8422 yyextra->anonNSCount = 0;
8423 yyextra->fileName = fileName;
8424 yyextra->clangParser = clangParser;
8425 setContext(yyscanner);
8426 rt->lang = yyextra->language;
8427 msg("Parsing file {}...\n",yyextra->fileName);
#define msg(fmt,...)
Definition message.h:94
static void setContext(yyscan_t yyscanner)
Definition scanner.l:7910
8428
8429 yyextra->current_root = rt;
8430 initParser(yyscanner);
8431 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
8432 yyextra->current = std::make_shared<Entry>();
8433 //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
8434 EntryType sec=guessSection(yyextra->fileName);
8435 if (!sec.isEmpty())
8436 {
8437 yyextra->current->name = yyextra->fileName;
8438 yyextra->current->section = sec;
8439 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8440 }
8441 yyextra->current->reset();
8442 initEntry(yyscanner);
8443 if ( yyextra->insidePHP )
8444 {
8445 BEGIN( FindMembersPHP );
8446 }
8447 else if ( yyextra->insideJava ) // add default java.lang package scope
8448 {
8449 yyextra->current->name="java::lang"; // '::' is used in doxygen's internal representation as a scope separator
8450 yyextra->current->fileName = yyextra->fileName;
8451 yyextra->current->section = EntryType::makeUsingDir();
8452 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8453 initEntry(yyscanner);
8454 BEGIN( FindMembers );
8455 }
8456 else
8457 {
8458 BEGIN( FindMembers );
8459 }
Wrapper class for the Entry type.
Definition types.h:813
EntryType guessSection(const QCString &name)
Definition util.cpp:339
8460
8461 scannerYYlex(yyscanner);
8462 yyextra->lexInit=TRUE;
8463
8464 if (YY_START==Comment)
8465 {
8466 warn(yyextra->fileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?");
8467 }
#define warn(file, line, fmt,...)
Definition message.h:97
8468
8469 //forceEndGroup();
8470 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
8471
8472 yyextra->programStr.clear();
8473 rt->program.str(std::string());
8474
8475 parseCompounds(yyscanner,rt);
8476
8477 yyextra->anonNSCount++;
8478
8479 // add additional entries that were created during processing
8480 for (auto &[parent,child]: yyextra->outerScopeEntries)
8481 {
8482 //printf(">>> adding '%s' to scope '%s'\n",qPrint(child->name),qPrint(parent->name));
8483 parent->moveToSubEntryAndKeep(child);
8484 }
8485 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
8486
8487}

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

8492{
8493 AUTO_TRACE("text='{}'",Trace::trunc(text));
8494 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8495 if (text.isEmpty())
8496 {
8497 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8498 return;
8499 }
8500 if (!yyextra->current) // nothing to store (see bug683516)
8501 {
8502 return;
8503 }
8504
8505 const char *orgInputString;
8506 int orgInputPosition;
8507 YY_BUFFER_STATE orgState;
8508
8509 // save scanner state
8510 orgState = YY_CURRENT_BUFFER;
8511 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8512 orgInputString = yyextra->inputString;
8513 orgInputPosition = yyextra->inputPosition;
#define YY_BUF_SIZE
Definition commentcnv.l:19
8514
8515 // set new string
8516 yyextra->inputString = text.data();
8517 yyextra->inputPosition = 0;
8518 yyextra->column = 0;
8519 scannerYYrestart(nullptr, yyscanner);
8520 BEGIN(Prototype);
8521 scannerYYlex(yyscanner);
8522 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:172
8523
8524 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8525 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.isEmpty())
8526 {
8527 yyextra->current->section = EntryType::makeVariableDoc();
8528 }
8529
8530 // restore original scanner state
8531 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8532 yy_switch_to_buffer(orgState, yyscanner);
8533 yyextra->inputString = orgInputString;
8534 yyextra->inputPosition = orgInputPosition;
8535
8536
8537 //printf("**** parsePrototype end\n");
8538}

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

7933{
7934 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7935 if (yyextra->current_root->section.isScope())
7936 {
7937 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
7938 yyextra->current->name.prepend(yyextra->current_root->name+"::");
7939 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
7940 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
7941 {
7942 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
7943 }
7944 }
This class represents an function or template argument list.
Definition arguments.h:65
7945}

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 7910 of file scanner.l.

7911{
7912 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7913 yyextra->language = getLanguageFromFileName(yyextra->fileName);
7914 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
7915 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
7916 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
7917 yyextra->insideD = yyextra->language==SrcLangExt::D;
7918 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
7919 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
7920 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
7921 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
7922 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
7923 yyextra->language==SrcLangExt::Lex);
7924 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
7925 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
7926 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
7927 // );
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5147
7928}

References getLanguageFromFileName().

Referenced by parseMain().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 7964 of file scanner.l.

7965{
7966 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7967 if (yyextra->insideJava)
7968 {
7969 QCString text=yytext;
7970 yyextra->current->protection = Protection::Public;
7971 if (text.find("protected")!=-1)
7972 yyextra->current->protection = Protection::Protected;
7973 else if (text.find("private")!=-1)
7974 yyextra->current->protection = Protection::Private;
7975 else if (text.find("package")!=-1)
7976 yyextra->current->protection = Protection::Package;
7977 }
7978}

References QCString::find().

◆ splitKnRArg()

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

Definition at line 7981 of file scanner.l.

7982{
7983 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7984 int si = static_cast<int>(yyextra->current->args.length());
7985 if (yyextra->oldStyleArgType.isEmpty()) // new argument
7986 {
7987 std::string args = yyextra->current->args.str();
7988 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
7989 int bi1=-1;
7990 int bi2=-1;
7992 if (reg::search(args,match,re))
7993 {
7994 bi1=(int)match.position();
7995 size_t secondMatchStart = match.position()+match.length(); // search again after first match
7996 if (reg::search(args,match,re,secondMatchStart))
7997 {
7998 bi2=(int)match.position();
7999 }
8000 }
8001 char c;
8002 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
8003 {
8004 int s=bi2+1; // keep opening (
8005 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8006 int i=s;
8007 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8008 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8009 s=i;
8010 while (i<si && isId(yyextra->current->args.at(i))) i++;
8011 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8012 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
8013 }
8014 else if (bi1!=-1) // redundant braces like in "int (*var)"
8015 {
8016 int s=bi1; // strip opening (
8017 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8018 s++;
8019 int i=s+1;
8020 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8021 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8022 s=i;
8023 while (i<si && isId(yyextra->current->args.at(i))) i++;
8024 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8025 }
8026 else // normal "int *var"
8027 {
8028 int l=si,i=l-1,j;
8029 // look for start of name in "type *name"
8030 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
8031 j=i+1;
8032 // look for start of *'s
8033 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
8034 i++;
8035 if (i!=l)
8036 {
8037 yyextra->oldStyleArgType=yyextra->current->args.left(i);
8038 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
8039 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8040 }
8041 else
8042 {
8043 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8044 }
8045 }
8046 }
8047 else // continuation like *arg2 in "int *args,*arg2"
8048 {
8049 int l=si,j=0;
8050 char c;
8051 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
8052 if (j>0)
8053 {
8054 oldStyleArgPtr=yyextra->current->args.left(j);
8055 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8056 }
8057 else
8058 {
8059 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8060 }
8061 }
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
QCString left(size_t len) const
Definition qcstring.h:229
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:151
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition regex.cpp:844
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:855
8062}

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

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8113 of file scanner.l.

8114{
8115 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8116 if (brief)
8117 {
8118 yyextra->current->briefFile = yyextra->fileName;
8119 yyextra->current->briefLine = yyextra->yyLineNr;
8120 }
8121 else
8122 {
8123 yyextra->current->docFile = yyextra->fileName;
8124 yyextra->current->docLine = yyextra->yyLineNr;
8125 }
8126}

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 7891 of file scanner.l.

7892{
7893 QCString r = req.stripWhiteSpace();
7894 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:524
7895}

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

7859{
7860 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7861 if (Config_getBool(MARKDOWN_SUPPORT))
7862 {
7863 yyextra->docBlock << "\\iskip";
7864 }
7865 yyextra->docBlockName=blockName;
7866 yyextra->fencedSize=fencedSize;
7867 yyextra->isCodeBlock=codeBlock;
7868 yyextra->nestedComment=0;
7869}

References Config_getBool.

◆ stateToString()

const char * stateToString ( int state)
static

◆ storeClangId()

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

Definition at line 7750 of file scanner.l.

7751{
7752 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7753 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
7754 {
7755 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
7756 }
7757}

◆ stripFuncPtr()

QCString stripFuncPtr ( const QCString & type)
static

Definition at line 7845 of file scanner.l.

7846{
7847 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
7848 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
7849 size_t i=type.length();
7850 bool funcPtr = i>0 && type[i-1]==')';
7851 if (funcPtr) i--;
7852 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
7853 if (funcPtr && i>0 && type[i-1]=='(') i--;
7854 return type.left(i);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
7855}

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

◆ stripQuotes()

QCString stripQuotes ( const char * s)
static

Definition at line 7833 of file scanner.l.

7834{
7835 QCString name;
7836 if (s==nullptr || *s==0) return name;
7837 name=s;
7838 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
7839 {
7840 name=name.mid(1,name.length()-2);
7841 }
7842 return name;
7843}

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

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

◆ yyread()

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

Definition at line 7691 of file scanner.l.

7692{
7693 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7694 int c=0;
7695 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7696 {
7697 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7698 //printf("%d (%c)\n",*buf,*buf);
7699 c++; buf++;
7700 }
7701 return c;
7702}