Doxygen
Loading...
Searching...
No Matches
scanner.l File Reference
#include <stdint.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cctype>
#include "scanner.h"
#include "entry.h"
#include "message.h"
#include "config.h"
#include "doxygen.h"
#include "util.h"
#include "defargs.h"
#include "language.h"
#include "commentscan.h"
#include "arguments.h"
#include "moduledef.h"
#include "stringutil.h"
#include "clangparser.h"
#include "markdown.h"
#include "regex.h"
#include "trace.h"
#include "debug.h"
#include "doxygen_lex.h"
#include "scanner.l.h"
Include dependency graph for scanner.l:

Go to the source code of this file.

Classes

struct  scannerYY_state
struct  COutlineParser::Private

Macros

#define YY_TYPEDEF_YY_SCANNER_T
#define YY_NO_INPUT   1
#define YY_NO_UNISTD_H   1
#define YY_INPUT(buf, result, max_size)

Typedefs

typedef yyguts_t * yyscan_t

Functions

static const char * stateToString (int state)
static int computeIndent (const char *s, int startIndent)
static void initMethodProtection (yyscan_t yyscanner, Protection prot)
static QCString stripQuotes (const char *s)
static QCString stripFuncPtr (const QCString &type)
static bool nameIsOperator (QCString &name)
void fixArgumentListForJavaScript (ArgumentList &al)
static bool startOfRequiresExpression (const QCString &req)
static void initParser (yyscan_t yyscanner)
static void initEntry (yyscan_t yyscanner)
static void lineCount (yyscan_t yyscanner)
static void addType (yyscan_t yyscanner)
static void setContext (yyscan_t yyscanner)
static void prependScope (yyscan_t yyscanner)
static void startCommentBlock (yyscan_t yyscanner, bool)
static void handleCommentBlock (yyscan_t yyscanner, const QCString &doc, bool brief)
static void handleParametersCommentBlocks (yyscan_t yyscanner, ArgumentList &al)
static bool checkForKnRstyleC (yyscan_t yyscanner)
static void splitKnRArg (yyscan_t yyscanner, QCString &oldStyleArgPtr, QCString &oldStyleArgName)
static void addKnRArgInfo (yyscan_t yyscanner, const QCString &type, const QCString &name, const QCString &brief, const QCString &docs)
static int yyread (yyscan_t yyscanner, char *buf, int max_size)
static void setJavaProtection (yyscan_t yyscanner)
static void storeClangId (yyscan_t yyscanner, const char *id)
static void startVerbatimBlock (yyscan_t yyscanner, const QCString &blockName, size_t fencedSize=0, bool codeBlock=false)
static bool endVerbatimBlock (yyscan_t yyscanner, const QCString &blockName, size_t fencedSize=0)
static const char * getLexerFILE ()
int yylex (yyscan_t yyscanner)
 Slice states.
static void newEntry (yyscan_t yyscanner)
static void parseCompounds (yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
static void parseConcepts (yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
static void parseMain (yyscan_t yyscanner, const QCString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &rt, ClangTUParser *clangParser)
static void parsePrototype (yyscan_t yyscanner, const QCString &text)

Macro Definition Documentation

◆ YY_INPUT

#define YY_INPUT ( buf,
result,
max_size )
Value:
result=yyread(yyscanner,buf,max_size);
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
Definition code.l:3971

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

8209{
8210 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8211 for (Argument &a : yyextra->current->argList)
8212 {
8213 if (a.type==name)
8214 {
8215 a.type=type.stripWhiteSpace();
8216 a.type.stripPrefix("register ");
8217 a.name=name.stripWhiteSpace();
8218 if (!brief.isEmpty() && !docs.isEmpty())
8219 {
8220 a.docs=brief+"\n\n"+docs;
8221 }
8222 else if (!brief.isEmpty())
8223 {
8224 a.docs=brief;
8225 }
8226 else
8227 {
8228 a.docs=docs;
8229 }
8230 }
8231 }
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
8232}

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

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 7949 of file scanner.l.

7950{
7951 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7952 size_t tl=yyextra->current->type.length();
7953 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7954 {
7955 yyextra->current->type += ' ' ;
7956 }
7957 yyextra->current->type += yyextra->current->name;
7958 yyextra->current->name.clear() ;
7959 tl=yyextra->current->type.length();
7960 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7961 {
7962 yyextra->current->type += ' ' ;
7963 }
7964 yyextra->current->type += yyextra->current->args ;
7965 yyextra->current->args.clear() ;
7966 yyextra->current->argList.clear();
7967}

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

8088{
8089 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8090 if (!yyextra->fileName.lower().endsWith(".c")) return FALSE; // must be a C file
8091 if (yyextra->current->argList.empty()) return FALSE; // must have arguments
8092 for (const Argument &a : yyextra->current->argList)
8093 {
8094 // in K&R style argument do not have a type, but doxygen expects a type
8095 // so it will think the argument has no name
8096 if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE;
8097 }
8098 return TRUE;
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
8099}

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

◆ computeIndent()

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

Definition at line 7922 of file scanner.l.

7923{
7924 int col=startIndent;
7925 int tabSize=Config_getInt(TAB_SIZE);
7926 const char *p=s;
7927 char c;
7928 while ((c=*p++))
7929 {
7930 if (c=='\t') col+=tabSize-(col%tabSize);
7931 else if (c=='\n') col=0;
7932 else col++;
7933 }
7934 return col;
#define Config_getInt(name)
Definition config.h:34
7935}

◆ endVerbatimBlock()

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

Definition at line 8009 of file scanner.l.

8010{
8011 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8012 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
8013 {
8014 if (Config_getBool(MARKDOWN_SUPPORT))
8015 {
8016 yyextra->docBlock << "\\endiskip";
8017 }
8018 yyextra->docBlockName="";
8019 return true;
8020 }
8021 return false;
#define Config_getBool(name)
Definition config.h:33
8022}

References Config_getBool.

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 8236 of file scanner.l.

8237{
8238 for (Argument &a : al)
8239 {
8240 if (!a.type.isEmpty() && a.name.isEmpty())
8241 { // a->type is actually the (typeless) parameter name, so move it
8242 a.name=a.type;
8243 a.type.clear();
8244 }
8245 }
8246}

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

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 260 of file scanner.l.

260{return __FILE__;}

◆ handleCommentBlock()

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

Definition at line 8287 of file scanner.l.

8288{
8289 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8290 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
8291 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
8292 if (yyextra->docBlockInBody && hideInBodyDocs) return;
8293 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
8294
8295 // fill in inbodyFile && inbodyLine the first time, see bug 633891
8296 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
8297 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
8298 {
8299 docEntry->inbodyFile = yyextra->fileName;
8300 docEntry->inbodyLine = lineNr;
8301 }
8302
8303 int position=0;
8304 bool needsEntry=FALSE;
8305 GuardedSectionStack guards;
8306 Markdown markdown(yyextra->fileName,lineNr);
8307 QCString strippedDoc = stripIndentation(doc);
8308 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8309 while (yyextra->commentScanner.parseCommentBlock(
8310 yyextra->thisParser,
8311 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8312 processedDoc, // text
8313 yyextra->fileName, // file
8314 lineNr, // line of block start
8315 yyextra->docBlockInBody ? FALSE : brief, // isBrief
8316 yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
8317 yyextra->docBlockInBody, // isInBody
8318 yyextra->protection,
8319 position,
8320 needsEntry,
8321 Config_getBool(MARKDOWN_SUPPORT),
8322 &guards
8323 )
8324 )
8325 {
8326 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8327 if (needsEntry)
8328 {
8329 QCString docFile = yyextra->current->docFile;
8330 newEntry(yyscanner);
8331 yyextra->current->docFile = docFile;
8332 yyextra->current->docLine = lineNr;
8333 }
8334 }
8335 if (needsEntry)
8336 {
8337 newEntry(yyscanner);
8338 }
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:8267
QCString stripIndentation(const QCString &s, bool skipFirstLine)
Definition util.cpp:5918
8339
8340 if (yyextra->docBlockTerm)
8341 {
8342 unput(yyextra->docBlockTerm);
8343 yyextra->docBlockTerm=0;
8344 }
8345}

References Trace::trunc().

◆ handleParametersCommentBlocks()

void handleParametersCommentBlocks ( yyscan_t yyscanner,
ArgumentList & al )
static

Definition at line 8347 of file scanner.l.

8348{
8349 AUTO_TRACE();
8350 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8351 for (Argument &a : al)
8352 {
8353 AUTO_TRACE_ADD("Param '{}' docs='{}'",a.name,Trace::trunc(a.docs));
8354 if (!a.docs.isEmpty())
8355 {
8356 if (a.name.isEmpty() && a.type == "...") a.name= "...";
8357 int position=0;
8358 bool needsEntry;
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:47
8359
8360 // save context
8361 QCString orgDoc = yyextra->current->doc;
8362 QCString orgBrief = yyextra->current->brief;
8363 int orgDocLine = yyextra->current->docLine;
8364 int orgBriefLine = yyextra->current->briefLine;
8365
8366 yyextra->current->doc.clear();
8367 yyextra->current->brief.clear();
8368
8369 //printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
8370 int lineNr = orgDocLine;
8371 GuardedSectionStack guards;
8372 Markdown markdown(yyextra->fileName,lineNr);
8373 QCString strippedDoc = stripIndentation(a.docs);
8374 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8375 while (yyextra->commentScanner.parseCommentBlock(
8376 yyextra->thisParser,
8377 yyextra->current.get(),
8378 processedDoc, // text
8379 yyextra->fileName, // file
8380 lineNr,
8381 FALSE,
8382 FALSE,
8383 FALSE,
8384 yyextra->protection,
8385 position,
8386 needsEntry,
8387 Config_getBool(MARKDOWN_SUPPORT),
8388 &guards
8389 )
8390 )
8391 {
8392 //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8393 if (needsEntry) newEntry(yyscanner);
8394 }
8395 if (needsEntry)
8396 {
8397 newEntry(yyscanner);
8398 }
8399 a.docs = yyextra->current->doc;
8400
8401 // restore context
8402 yyextra->current->doc = orgDoc;
8403 yyextra->current->brief = orgBrief;
8404 yyextra->current->docLine = orgDocLine;
8405 yyextra->current->briefLine = orgBriefLine;
8406 }
8407 }
8408}

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

◆ initEntry()

void initEntry ( yyscan_t yyscanner)
static

Definition at line 7866 of file scanner.l.

7867{
7868 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7869 if (yyextra->insideJava)
7870 {
7871 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
7872 }
7873 yyextra->current->protection = yyextra->protection;
7874 yyextra->current->exported = yyextra->exported ;
7875 yyextra->current->mtype = yyextra->mtype;
7876 yyextra->current->virt = yyextra->virt;
7877 yyextra->current->isStatic = yyextra->isStatic;
7878 yyextra->current->lang = yyextra->language;
7879 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
7880 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
7881 yyextra->isTypedef=FALSE;
7882}

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 7937 of file scanner.l.

7938{
7939 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7940 yyextra->current->protection = yyextra->protection = prot;
7941 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
7942 yyextra->current->type.clear();
7943 yyextra->current->name.clear();
7944 yyextra->current->args.clear();
7945 yyextra->current->argList.clear();
7946 lineCount(yyscanner) ;
#define lineCount(s, len)
7947}

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 7842 of file scanner.l.

7843{
7844 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7845 yyextra->outerScopeEntries.clear();
7846 yyextra->baseName.clear();
7847 yyextra->protection = Protection::Public;
7848 yyextra->baseProt = Protection::Public;
7849 yyextra->sharpCount = 0;
7850 yyextra->roundCount = 0;
7851 yyextra->curlyCount = 0;
7852 yyextra->mtype = MethodTypes::Method;
7853 yyextra->isStatic = FALSE;
7854 yyextra->virt = Specifier::Normal;
7855 yyextra->baseVirt = Specifier::Normal;
7856 yyextra->isTypedef = FALSE;
7857 yyextra->insideTryBlock = FALSE;
7858 yyextra->insideFormula = FALSE;
7859 yyextra->insideCode=FALSE;
7860 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
7861 yyextra->previous = 0;
7862 yyextra->firstTypedefEntry.reset();
7863 yyextra->memspecEntry.reset();
7864}

References FALSE.

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 7896 of file scanner.l.

7897{
7898 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7899 int tabSize = Config_getInt(TAB_SIZE);
7900 const char *p;
7901 for (p = yytext ; *p ; ++p )
7902 {
7903 if (*p=='\n')
7904 {
7905 yyextra->yyLineNr++;
7906 yyextra->column=0;
7907 yyextra->yyColNr=1;
7908 }
7909 else if (*p=='\t')
7910 {
7911 yyextra->column+=tabSize - (yyextra->column%tabSize);
7912 }
7913 else
7914 {
7915 yyextra->column++;
7916 yyextra->yyColNr++;
7917 }
7918 }
7919 //printf("lineCount()=%d\n",yyextra->column);
7920}

◆ nameIsOperator()

bool nameIsOperator ( QCString & name)
static

Definition at line 8036 of file scanner.l.

8037{
8038 int i=name.find("operator");
8039 if (i==-1) return FALSE;
8040 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
8041 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
8042 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
8043}

References FALSE, isId(), and TRUE.

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8267 of file scanner.l.

8268{
8269 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8270 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
8271 // and yyextra->current is actually replaced by yyextra->previous which was
8272 // already added to yyextra->current_root, so we should not add it again
8273 // (see bug723314)
8274 {
8275 yyextra->previous = yyextra->current;
8276 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8277 }
8278 else
8279 {
8280 yyextra->previous = yyextra->current;
8281 yyextra->current = yyextra->tempEntry;
8282 yyextra->tempEntry.reset();
8283 }
8284 initEntry(yyscanner);
static void initEntry(yyscan_t yyscanner)
Definition scanner.l:7866
8285}

◆ parseCompounds()

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

Definition at line 8413 of file scanner.l.

8414{
8415 AUTO_TRACE("name={}",rt->name);
8416 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8417 for (const auto &ce : rt->children())
8418 {
8419 if (!ce->program.empty())
8420 {
8421 AUTO_TRACE_ADD("compound name='{}' program='{}'",Trace::trunc(ce->name),Trace::trunc(ce->program.str()));
8422 // init scanner state
8423 yyextra->padCount=0;
8424 yyextra->column=0;
8425 yyextra->programStr = ce->program.str();
8426 yyextra->inputString = yyextra->programStr.data();
8427 yyextra->inputPosition = 0;
8428 if (ce->section.isEnum() || ce->spec.isEnum())
8429 BEGIN( FindFields ) ;
8430 else
8431 BEGIN( FindMembers ) ;
8432 yyextra->current_root = ce;
8433 yyextra->fileName = ce->fileName;
8434 //setContext();
8435 yyextra->yyLineNr = ce->bodyLine;
8436 yyextra->yyColNr = ce->bodyColumn;
8437 yyextra->insideObjC = ce->lang==SrcLangExt::ObjC;
8438 //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
8439 yyextra->current = std::make_shared<Entry>();
8440 yyextra->isStatic = FALSE;
8441 initEntry(yyscanner);
8442
8443 // deep copy group list from parent (see bug 727732)
8444 bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
8445 if (autoGroupNested && !rt->groups.empty() && !ce->section.isEnum() && !ce->spec.isEnum())
8446 {
8447 ce->groups = rt->groups;
8448 }
8449
8450 int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2;
8451 // set default protection based on the compound type
8452 if ( ce->section.isClass() ) // class
8453 {
8454 if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
8455 {
8456 yyextra->current->protection = yyextra->protection = Protection::Public ;
8457 }
8458 else if (yyextra->insideJava)
8459 {
8460 yyextra->current->protection = yyextra->protection = (ce->spec.isInterface() || ce->spec.isEnum()) ? Protection::Public : Protection::Package;
8461 }
8462 else if (ce->spec.isInterface() || ce->spec.isRef() || ce->spec.isValue() || ce->spec.isStruct() || ce->spec.isUnion())
8463 {
8464 if (ce->lang==SrcLangExt::ObjC)
8465 {
8466 yyextra->current->protection = yyextra->protection = Protection::Protected ;
8467 }
8468 else
8469 {
8470 yyextra->current->protection = yyextra->protection = Protection::Public ;
8471 }
8472 }
8473 else
8474 {
8475 yyextra->current->protection = yyextra->protection = Protection::Private ;
8476 }
8477 }
8478 else if (ce->section.isEnum() ) // enum
8479 {
8480 yyextra->current->protection = yyextra->protection = ce->protection;
8481 }
8482 else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
8483 {
8484 if (ce->section.isNamespace() ) // unnamed namespace
8485 {
8486 yyextra->current->isStatic = yyextra->isStatic = TRUE;
8487 }
8488 yyextra->current->protection = yyextra->protection = ce->protection;
8489 yyextra->current->exported = yyextra->exported = false;
8490 }
8491 else if (ce->section.isNamespace() )
8492 {
8493 yyextra->current->protection = yyextra->protection = Protection::Public ;
8494 yyextra->current->exported = yyextra->exported = ce->exported;
8495 }
8496 else // named struct, union, protocol, category
8497 {
8498 yyextra->current->protection = yyextra->protection = Protection::Public ;
8499 yyextra->current->exported = yyextra->exported = false;
8500 }
8501 yyextra->mtype = MethodTypes::Method;
8502 yyextra->virt = Specifier::Normal;
8503 //printf("name=%s yyextra->current->isStatic=%d yyextra->isStatic=%d\n",qPrint(ce->name),yyextra->current->isStatic,yyextra->isStatic);
8504
8505 //memberGroupId = DOX_NOGROUP;
8506 //memberGroupRelates.clear();
8507 //memberGroupInside.clear();
8508 QCString name = ce->name;
8509 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
8510
8511 scannerYYlex(yyscanner);
8512 //forceEndGroup();
8513
8514 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
8515
8516 yyextra->programStr.clear();
8517 ce->program.str(std::string());
8518
8519
8520 //if (depthIf>0)
8521 //{
8522 // warn(yyextra->fileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
8523 //}
8524 }
8525 parseCompounds(yyscanner,ce);
8526 }
static void parseCompounds(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8413
8527}

References FALSE, and Trace::trunc().

◆ parseConcepts()

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

Definition at line 8529 of file scanner.l.

8530{
8531 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8532 for (const auto &ce : rt->children())
8533 {
8534 if (ce->section.isConcept())
8535 {
8536 //printf("*** found concept '%s' value=[[\n%s\n]] line=%d,col=%d\n",
8537 // qPrint(ce->name),qPrint(ce->initializer.str()),ce->startLine,ce->startColumn);
8538 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8539 // init scanner state
8540 yyextra->padCount =0;
8541 yyextra->column =0;
8542 yyextra->programStr = ce->initializer.str();
8543 yyextra->inputString = yyextra->programStr.data();
8544 yyextra->inputPosition = 0;
8545 yyextra->current_root = ce;
8546 yyextra->fileName = ce->fileName;
8547 yyextra->yyLineNr = ce->bodyLine;
8548 yyextra->yyColNr = ce->bodyColumn;
8549 yyextra->insideObjC = false;
8550 yyextra->current = std::make_shared<Entry>();
8551
8552 // hack to reconstruct what was in the code before the concept expression
8553 QCString indent;
8554 indent.fill(' ',std::max(0,ce->startColumn-1));
8555 QCString templArgs;
8556 if (!ce->args.isEmpty())
8557 {
8558 templArgs=indent+"template"+ce->args+"\n";
8559 }
8560 yyextra->current->initializer.str(QCString(templArgs+indent+"concept "+ce->name+ " =").str());
QCString fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:193
const std::string & str() const
Definition qcstring.h:552
8561
8562 yyextra->isStatic = FALSE;
8563 initEntry(yyscanner);
8564 yyextra->current->section = EntryType::makeConceptCodePart();
8565 yyextra->current->startLine = yyextra->yyLineNr;
8566 BEGIN( FindConceptParts );
8567 scannerYYlex(yyscanner);
8568 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8569
8570 }
8571 parseConcepts(yyscanner,ce);
8572 }
static void parseConcepts(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8529
8573}

References FALSE, QCString::fill(), initEntry(), parseConcepts(), and QCString::str().

Referenced by parseConcepts(), and parseMain().

◆ parseMain()

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

Definition at line 8577 of file scanner.l.

8582{
8583 AUTO_TRACE("fileName={}",fileName);
8584 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8585 initParser(yyscanner);
static void initParser(yyscan_t yyscanner)
Definition scanner.l:7842
8586
8587 yyextra->inputString = fileBuf;
8588 yyextra->inputPosition = 0;
8589 yyextra->column = 0;
8590 scannerYYrestart(nullptr,yyscanner);
8591
8592 //depthIf = 0;
8593 yyextra->protection = Protection::Public;
8594 yyextra->mtype = MethodTypes::Method;
8595 yyextra->isStatic = FALSE;
8596 yyextra->exported = false;
8597 yyextra->virt = Specifier::Normal;
8598 yyextra->current_root = rt;
8599 yyextra->yyLineNr = 1 ;
8600 yyextra->yyBegLineNr = 1;
8601 yyextra->yyBegColNr = 0;
8602 yyextra->anonCount = 0;
8603 yyextra->anonNSCount = 0;
8604 yyextra->fileName = fileName;
8605 yyextra->clangParser = clangParser;
8606 setContext(yyscanner);
8607 rt->lang = yyextra->language;
8608 msg("Parsing file {}...\n",yyextra->fileName);
#define msg(fmt,...)
Definition message.h:94
static void setContext(yyscan_t yyscanner)
Definition scanner.l:8047
8609
8610 yyextra->current_root = rt;
8611 initParser(yyscanner);
8612 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
8613 yyextra->current = std::make_shared<Entry>();
8614 //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
8615 EntryType sec=guessSection(yyextra->fileName);
8616 if (!sec.isEmpty())
8617 {
8618 yyextra->current->name = yyextra->fileName;
8619 yyextra->current->section = sec;
8620 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8621 }
8622 yyextra->current->reset();
8623 initEntry(yyscanner);
8624 if ( yyextra->insidePHP )
8625 {
8626 BEGIN( FindMembersPHP );
8627 }
8628 else if ( yyextra->insideJava ) // add default java.lang package scope
8629 {
8630 yyextra->current->name="java::lang"; // '::' is used in doxygen's internal representation as a scope separator
8631 yyextra->current->fileName = yyextra->fileName;
8632 yyextra->current->section = EntryType::makeUsingDir();
8633 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8634 initEntry(yyscanner);
8635 BEGIN( FindMembers );
8636 }
8637 else
8638 {
8639 BEGIN( FindMembers );
8640 }
Wrapper class for the Entry type.
Definition types.h:815
EntryType guessSection(const QCString &name)
Definition util.cpp:339
8641
8642 scannerYYlex(yyscanner);
8643
8644 if (YY_START==Comment)
8645 {
8646 warn(yyextra->fileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?");
8647 }
#define warn(file, line, fmt,...)
Definition message.h:97
8648
8649 //forceEndGroup();
8650 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
8651
8652 yyextra->programStr.clear();
8653 rt->program.str(std::string());
8654
8655 parseCompounds(yyscanner,rt);
8656 parseConcepts(yyscanner,rt);
8657
8658 yyextra->anonNSCount++;
8659
8660 // add additional entries that were created during processing
8661 for (auto &[parent,child]: yyextra->outerScopeEntries)
8662 {
8663 //printf(">>> adding '%s' to scope '%s'\n",qPrint(child->name),qPrint(parent->name));
8664 parent->moveToSubEntryAndKeep(child);
8665 }
8666 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
8667
8668}

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

◆ parsePrototype()

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

Definition at line 8672 of file scanner.l.

8673{
8674 AUTO_TRACE("text='{}'",Trace::trunc(text));
8675 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8676 if (text.isEmpty())
8677 {
8678 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8679 return;
8680 }
8681 if (!yyextra->current) // nothing to store (see bug683516)
8682 {
8683 return;
8684 }
8685
8686 const char *orgInputString;
8687 int orgInputPosition;
8688 YY_BUFFER_STATE orgState;
8689
8690 // save scanner state
8691 orgState = YY_CURRENT_BUFFER;
8692 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8693 orgInputString = yyextra->inputString;
8694 orgInputPosition = yyextra->inputPosition;
#define YY_BUF_SIZE
Definition commentcnv.l:19
8695
8696 // set new string
8697 yyextra->inputString = text.data();
8698 yyextra->inputPosition = 0;
8699 yyextra->column = 0;
8700 scannerYYrestart(nullptr, yyscanner);
8701 BEGIN(Prototype);
8702 scannerYYlex(yyscanner);
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:172
8703
8704 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8705 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.isEmpty())
8706 {
8707 yyextra->current->section = EntryType::makeVariableDoc();
8708 }
8709
8710 // restore original scanner state
8711 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8712 yy_switch_to_buffer(orgState, yyscanner);
8713 yyextra->inputString = orgInputString;
8714 yyextra->inputPosition = orgInputPosition;
8715
8716
8717 //printf("**** parsePrototype end\n");
8718}

References Trace::trunc().

◆ prependScope()

void prependScope ( yyscan_t yyscanner)
static

Definition at line 8069 of file scanner.l.

8070{
8071 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8072 if (yyextra->current_root->section.isScope())
8073 {
8074 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
8075 yyextra->current->name.prepend(yyextra->current_root->name+"::");
8076 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
8077 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
8078 {
8079 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
8080 }
8081 }
This class represents an function or template argument list.
Definition arguments.h:65
8082}

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 8047 of file scanner.l.

8048{
8049 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8050 yyextra->language = getLanguageFromFileName(yyextra->fileName);
8051 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
8052 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
8053 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
8054 yyextra->insideD = yyextra->language==SrcLangExt::D;
8055 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
8056 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
8057 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
8058 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
8059 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
8060 yyextra->language==SrcLangExt::Lex);
8061 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
8062 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
8063 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
8064 // );
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5164
8065}

Referenced by parseMain().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 8101 of file scanner.l.

8102{
8103 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8104 if (yyextra->insideJava)
8105 {
8106 QCString text=yytext;
8107 yyextra->current->protection = Protection::Public;
8108 if (text.find("protected")!=-1)
8109 yyextra->current->protection = Protection::Protected;
8110 else if (text.find("private")!=-1)
8111 yyextra->current->protection = Protection::Private;
8112 else if (text.find("package")!=-1)
8113 yyextra->current->protection = Protection::Package;
8114 }
8115}

References QCString::find().

◆ splitKnRArg()

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

Definition at line 8118 of file scanner.l.

8119{
8120 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8121 int si = static_cast<int>(yyextra->current->args.length());
8122 if (yyextra->oldStyleArgType.isEmpty()) // new argument
8123 {
8124 std::string args = yyextra->current->args.str();
8125 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
8126 int bi1=-1;
8127 int bi2=-1;
8129 if (reg::search(args,match,re))
8130 {
8131 bi1=(int)match.position();
8132 size_t secondMatchStart = match.position()+match.length(); // search again after first match
8133 if (reg::search(args,match,re,secondMatchStart))
8134 {
8135 bi2=(int)match.position();
8136 }
8137 }
8138 char c;
8139 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
8140 {
8141 int s=bi2+1; // keep opening (
8142 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8143 int i=s;
8144 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8145 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8146 s=i;
8147 while (i<si && isId(yyextra->current->args.at(i))) i++;
8148 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8149 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
8150 }
8151 else if (bi1!=-1) // redundant braces like in "int (*var)"
8152 {
8153 int s=bi1; // strip opening (
8154 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8155 s++;
8156 int i=s+1;
8157 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8158 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8159 s=i;
8160 while (i<si && isId(yyextra->current->args.at(i))) i++;
8161 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8162 }
8163 else // normal "int *var"
8164 {
8165 int l=si,i=l-1,j;
8166 // look for start of name in "type *name"
8167 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
8168 j=i+1;
8169 // look for start of *'s
8170 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
8171 i++;
8172 if (i!=l)
8173 {
8174 yyextra->oldStyleArgType=yyextra->current->args.left(i);
8175 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
8176 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8177 }
8178 else
8179 {
8180 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8181 }
8182 }
8183 }
8184 else // continuation like *arg2 in "int *args,*arg2"
8185 {
8186 int l=si,j=0;
8187 char c;
8188 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
8189 if (j>0)
8190 {
8191 oldStyleArgPtr=yyextra->current->args.left(j);
8192 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8193 }
8194 else
8195 {
8196 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8197 }
8198 }
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
8199}

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

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8250 of file scanner.l.

8251{
8252 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8253 if (brief)
8254 {
8255 yyextra->current->briefFile = yyextra->fileName;
8256 yyextra->current->briefLine = yyextra->yyLineNr;
8257 }
8258 else
8259 {
8260 yyextra->current->docFile = yyextra->fileName;
8261 yyextra->current->docLine = yyextra->yyLineNr;
8262 }
8263}

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 8028 of file scanner.l.

8029{
8030 QCString r = req.stripWhiteSpace();
8031 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:524
8032}

◆ startVerbatimBlock()

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

Definition at line 7995 of file scanner.l.

7996{
7997 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7998 if (Config_getBool(MARKDOWN_SUPPORT))
7999 {
8000 yyextra->docBlock << "\\iskip";
8001 }
8002 yyextra->docBlockName=blockName;
8003 yyextra->fencedSize=fencedSize;
8004 yyextra->isCodeBlock=codeBlock;
8005 yyextra->nestedComment=0;
8006}

◆ stateToString()

const char * stateToString ( int state)
static

◆ storeClangId()

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

Definition at line 7887 of file scanner.l.

7888{
7889 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7890 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
7891 {
7892 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
7893 }
7894}

◆ stripFuncPtr()

QCString stripFuncPtr ( const QCString & type)
static

Definition at line 7982 of file scanner.l.

7983{
7984 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
7985 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
7986 size_t i=type.length();
7987 bool funcPtr = i>0 && type[i-1]==')';
7988 if (funcPtr) i--;
7989 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
7990 if (funcPtr && i>0 && type[i-1]=='(') i--;
7991 return type.left(i);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
7992}

◆ stripQuotes()

QCString stripQuotes ( const char * s)
static

Definition at line 7970 of file scanner.l.

7971{
7972 QCString name;
7973 if (s==nullptr || *s==0) return name;
7974 name=s;
7975 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
7976 {
7977 name=name.mid(1,name.length()-2);
7978 }
7979 return name;
7980}

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

◆ yylex()

int yylex ( yyscan_t yyscanner)

Slice states.

Prototype scanner states comment parsing states C++20 concepts Object-C Deprecated C++20 modules

Definition at line 508 of file scanner.l.

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

◆ yyread()

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

Definition at line 7828 of file scanner.l.

7829{
7830 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7831 int c=0;
7832 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7833 {
7834 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7835 //printf("%d (%c)\n",*buf,*buf);
7836 c++; buf++;
7837 }
7838 return c;
7839}