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

Go to the source code of this file.

Classes

struct  scannerYY_state
struct  COutlineParser::Private

Macros

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

Typedefs

typedef yyguts_t * yyscan_t

Functions

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

Macro Definition Documentation

◆ YY_INPUT

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

Definition at line 254 of file scanner.l.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 61 of file scanner.l.

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 62 of file scanner.l.

◆ YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 22 of file scanner.l.

Typedef Documentation

◆ yyscan_t

typedef yyguts_t* yyscan_t

Definition at line 24 of file scanner.l.

Function Documentation

◆ addKnRArgInfo()

void addKnRArgInfo ( yyscan_t yyscanner,
const QCString & type,
const QCString & name,
const QCString & brief,
const QCString & docs )
static

Update the argument name with additional type info. For K&R style function the type is found after the argument list, so this routine in needed to fix up.

Definition at line 7980 of file scanner.l.

7982{
7983 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7984 for (Argument &a : yyextra->current->argList)
7985 {
7986 if (a.type==name)
7987 {
7988 a.type=type.stripWhiteSpace();
7989 a.type.stripPrefix("register ");
7990 a.name=name.stripWhiteSpace();
7991 if (!brief.isEmpty() && !docs.isEmpty())
7992 {
7993 a.docs=brief+"\n\n"+docs;
7994 }
7995 else if (!brief.isEmpty())
7996 {
7997 a.docs=brief;
7998 }
7999 else
8000 {
8001 a.docs=docs;
8002 }
8003 }
8004 }
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
8005}

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

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 7722 of file scanner.l.

7723{
7724 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7725 size_t tl=yyextra->current->type.length();
7726 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7727 {
7728 yyextra->current->type += ' ' ;
7729 }
7730 yyextra->current->type += yyextra->current->name;
7731 yyextra->current->name.clear() ;
7732 tl=yyextra->current->type.length();
7733 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7734 {
7735 yyextra->current->type += ' ' ;
7736 }
7737 yyextra->current->type += yyextra->current->args ;
7738 yyextra->current->args.clear() ;
7739 yyextra->current->argList.clear();
7740}

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

7861{
7862 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7863 if (!yyextra->fileName.lower().endsWith(".c")) return FALSE; // must be a C file
7864 if (yyextra->current->argList.empty()) return FALSE; // must have arguments
7865 for (const Argument &a : yyextra->current->argList)
7866 {
7867 // in K&R style argument do not have a type, but doxygen expects a type
7868 // so it will think the argument has no name
7869 if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE;
7870 }
7871 return TRUE;
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
7872}

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

◆ computeIndent()

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

Definition at line 7695 of file scanner.l.

7696{
7697 int col=startIndent;
7698 int tabSize=Config_getInt(TAB_SIZE);
7699 const char *p=s;
7700 char c;
7701 while ((c=*p++))
7702 {
7703 if (c=='\t') col+=tabSize-(col%tabSize);
7704 else if (c=='\n') col=0;
7705 else col++;
7706 }
7707 return col;
#define Config_getInt(name)
Definition config.h:34
7708}

References Config_getInt.

◆ endVerbatimBlock()

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

Definition at line 7782 of file scanner.l.

7783{
7784 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7785 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
7786 {
7787 if (Config_getBool(MARKDOWN_SUPPORT))
7788 {
7789 yyextra->docBlock << "\\endiskip";
7790 }
7791 yyextra->docBlockName="";
7792 return true;
7793 }
7794 return false;
#define Config_getBool(name)
Definition config.h:33
7795}

References Config_getBool.

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 8009 of file scanner.l.

8010{
8011 for (Argument &a : al)
8012 {
8013 if (!a.type.isEmpty() && a.name.isEmpty())
8014 { // a->type is actually the (typeless) parameter name, so move it
8015 a.name=a.type;
8016 a.type.clear();
8017 }
8018 }
8019}

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

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 257 of file scanner.l.

257{return __FILE__;}

◆ handleCommentBlock()

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

Definition at line 8060 of file scanner.l.

8061{
8062 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8063 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
8064 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
8065 if (yyextra->docBlockInBody && hideInBodyDocs) return;
8066 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
8067
8068 // fill in inbodyFile && inbodyLine the first time, see bug 633891
8069 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
8070 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
8071 {
8072 docEntry->inbodyFile = yyextra->fileName;
8073 docEntry->inbodyLine = lineNr;
8074 }
8075
8076 int position=0;
8077 bool needsEntry=FALSE;
8078 GuardedSectionStack guards;
8079 Markdown markdown(yyextra->fileName,lineNr);
8080 QCString strippedDoc = stripIndentation(doc);
8081 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8082 while (yyextra->commentScanner.parseCommentBlock(
8083 yyextra->thisParser,
8084 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8085 processedDoc, // text
8086 yyextra->fileName, // file
8087 lineNr, // line of block start
8088 yyextra->docBlockInBody ? FALSE : brief, // isBrief
8089 yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
8090 yyextra->docBlockInBody, // isInBody
8091 yyextra->protection,
8092 position,
8093 needsEntry,
8094 Config_getBool(MARKDOWN_SUPPORT),
8095 &guards
8096 )
8097 )
8098 {
8099 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8100 if (needsEntry)
8101 {
8102 QCString docFile = yyextra->current->docFile;
8103 newEntry(yyscanner);
8104 yyextra->current->docFile = docFile;
8105 yyextra->current->docLine = lineNr;
8106 }
8107 }
8108 if (needsEntry)
8109 {
8110 newEntry(yyscanner);
8111 }
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:8040
QCString stripIndentation(const QCString &s, bool skipFirstLine)
Definition util.cpp:5888
8112
8113 if (yyextra->docBlockTerm)
8114 {
8115 unput(yyextra->docBlockTerm);
8116 yyextra->docBlockTerm=0;
8117 }
8118}

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

◆ handleParametersCommentBlocks()

void handleParametersCommentBlocks ( yyscan_t yyscanner,
ArgumentList & al )
static

Definition at line 8120 of file scanner.l.

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

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

◆ initEntry()

void initEntry ( yyscan_t yyscanner)
static

Definition at line 7642 of file scanner.l.

7643{
7644 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7645 if (yyextra->insideJava)
7646 {
7647 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
7648 }
7649 yyextra->current->protection = yyextra->protection;
7650 yyextra->current->exported = yyextra->exported ;
7651 yyextra->current->mtype = yyextra->mtype;
7652 yyextra->current->virt = yyextra->virt;
7653 yyextra->current->isStatic = yyextra->isStatic;
7654 yyextra->current->lang = yyextra->language;
7655 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
7656 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
7657 yyextra->isTypedef=FALSE;
7658}

References FALSE.

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 7710 of file scanner.l.

7711{
7712 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7713 yyextra->current->protection = yyextra->protection = prot;
7714 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
7715 yyextra->current->type.clear();
7716 yyextra->current->name.clear();
7717 yyextra->current->args.clear();
7718 yyextra->current->argList.clear();
7719 lineCount(yyscanner) ;
#define lineCount(s, len)
7720}

References lineCount, and Entry::protection.

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 7618 of file scanner.l.

7619{
7620 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7621 yyextra->outerScopeEntries.clear();
7622 yyextra->baseName.clear();
7623 yyextra->protection = Protection::Public;
7624 yyextra->baseProt = Protection::Public;
7625 yyextra->sharpCount = 0;
7626 yyextra->roundCount = 0;
7627 yyextra->curlyCount = 0;
7628 yyextra->mtype = MethodTypes::Method;
7629 yyextra->isStatic = FALSE;
7630 yyextra->virt = Specifier::Normal;
7631 yyextra->baseVirt = Specifier::Normal;
7632 yyextra->isTypedef = FALSE;
7633 yyextra->insideTryBlock = FALSE;
7634 yyextra->insideFormula = FALSE;
7635 yyextra->insideCode=FALSE;
7636 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
7637 yyextra->previous = 0;
7638 yyextra->firstTypedefEntry.reset();
7639 yyextra->memspecEntry.reset();
7640}

References Config_getBool, and FALSE.

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 7672 of file scanner.l.

7673{
7674 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7675 int tabSize = Config_getInt(TAB_SIZE);
7676 const char *p;
7677 for (p = yytext ; *p ; ++p )
7678 {
7679 if (*p=='\n')
7680 {
7681 yyextra->yyLineNr++,yyextra->column=0,yyextra->yyColNr=1;
7682 }
7683 else if (*p=='\t')
7684 {
7685 yyextra->column+=tabSize - (yyextra->column%tabSize);
7686 }
7687 else
7688 {
7689 yyextra->column++,yyextra->yyColNr++;
7690 }
7691 }
7692 //printf("lineCount()=%d\n",yyextra->column);
7693}

References Config_getInt.

◆ nameIsOperator()

bool nameIsOperator ( QCString & name)
static

Definition at line 7809 of file scanner.l.

7810{
7811 int i=name.find("operator");
7812 if (i==-1) return FALSE;
7813 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
7814 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
7815 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:208
7816}

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

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8040 of file scanner.l.

8041{
8042 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8043 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
8044 // and yyextra->current is actually replaced by yyextra->previous which was
8045 // already added to yyextra->current_root, so we should not add it again
8046 // (see bug723314)
8047 {
8048 yyextra->previous = yyextra->current;
8049 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8050 }
8051 else
8052 {
8053 yyextra->previous = yyextra->current;
8054 yyextra->current = yyextra->tempEntry;
8055 yyextra->tempEntry.reset();
8056 }
8057 initEntry(yyscanner);
static void initEntry(yyscan_t yyscanner)
Definition scanner.l:7642
8058}

References initEntry().

◆ parseCompounds()

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

Definition at line 8186 of file scanner.l.

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

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

◆ parseMain()

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

Definition at line 8306 of file scanner.l.

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

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

◆ parsePrototype()

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

Definition at line 8401 of file scanner.l.

8402{
8403 AUTO_TRACE("text='{}'",Trace::trunc(text));
8404 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8405 if (text.isEmpty())
8406 {
8407 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8408 return;
8409 }
8410 if (!yyextra->current) // nothing to store (see bug683516)
8411 {
8412 return;
8413 }
8414
8415 const char *orgInputString;
8416 int orgInputPosition;
8417 YY_BUFFER_STATE orgState;
8418
8419 // save scanner state
8420 orgState = YY_CURRENT_BUFFER;
8421 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8422 orgInputString = yyextra->inputString;
8423 orgInputPosition = yyextra->inputPosition;
#define YY_BUF_SIZE
Definition commentcnv.l:19
8424
8425 // set new string
8426 yyextra->inputString = text.data();
8427 yyextra->inputPosition = 0;
8428 yyextra->column = 0;
8429 scannerYYrestart(nullptr, yyscanner);
8430 BEGIN(Prototype);
8431 scannerYYlex(yyscanner);
8432 yyextra->lexInit=TRUE;
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:172
8433
8434 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8435 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.isEmpty())
8436 {
8437 yyextra->current->section = EntryType::makeVariableDoc();
8438 }
8439
8440 // restore original scanner state
8441 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8442 yy_switch_to_buffer(orgState, yyscanner);
8443 yyextra->inputString = orgInputString;
8444 yyextra->inputPosition = orgInputPosition;
8445
8446
8447 //printf("**** parsePrototype end\n");
8448}

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

◆ prependScope()

void prependScope ( yyscan_t yyscanner)
static

Definition at line 7842 of file scanner.l.

7843{
7844 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7845 if (yyextra->current_root->section.isScope())
7846 {
7847 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
7848 yyextra->current->name.prepend(yyextra->current_root->name+"::");
7849 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
7850 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
7851 {
7852 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
7853 }
7854 }
This class represents an function or template argument list.
Definition arguments.h:65
7855}

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 7820 of file scanner.l.

7821{
7822 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7823 yyextra->language = getLanguageFromFileName(yyextra->fileName);
7824 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
7825 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
7826 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
7827 yyextra->insideD = yyextra->language==SrcLangExt::D;
7828 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
7829 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
7830 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
7831 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
7832 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
7833 yyextra->language==SrcLangExt::Lex);
7834 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
7835 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
7836 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
7837 // );
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5134
7838}

References getLanguageFromFileName().

Referenced by parseMain().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 7874 of file scanner.l.

7875{
7876 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7877 if (yyextra->insideJava)
7878 {
7879 QCString text=yytext;
7880 yyextra->current->protection = Protection::Public;
7881 if (text.find("protected")!=-1)
7882 yyextra->current->protection = Protection::Protected;
7883 else if (text.find("private")!=-1)
7884 yyextra->current->protection = Protection::Private;
7885 else if (text.find("package")!=-1)
7886 yyextra->current->protection = Protection::Package;
7887 }
7888}

References QCString::find().

◆ splitKnRArg()

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

Definition at line 7891 of file scanner.l.

7892{
7893 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7894 int si = static_cast<int>(yyextra->current->args.length());
7895 if (yyextra->oldStyleArgType.isEmpty()) // new argument
7896 {
7897 std::string args = yyextra->current->args.str();
7898 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
7899 int bi1=-1;
7900 int bi2=-1;
7902 if (reg::search(args,match,re))
7903 {
7904 bi1=(int)match.position();
7905 size_t secondMatchStart = match.position()+match.length(); // search again after first match
7906 if (reg::search(args,match,re,secondMatchStart))
7907 {
7908 bi2=(int)match.position();
7909 }
7910 }
7911 char c;
7912 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
7913 {
7914 int s=bi2+1; // keep opening (
7915 yyextra->oldStyleArgType = yyextra->current->args.left(s);
7916 int i=s;
7917 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
7918 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
7919 s=i;
7920 while (i<si && isId(yyextra->current->args.at(i))) i++;
7921 oldStyleArgName = yyextra->current->args.mid(s,i-s);
7922 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
7923 }
7924 else if (bi1!=-1) // redundant braces like in "int (*var)"
7925 {
7926 int s=bi1; // strip opening (
7927 yyextra->oldStyleArgType = yyextra->current->args.left(s);
7928 s++;
7929 int i=s+1;
7930 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
7931 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
7932 s=i;
7933 while (i<si && isId(yyextra->current->args.at(i))) i++;
7934 oldStyleArgName = yyextra->current->args.mid(s,i-s);
7935 }
7936 else // normal "int *var"
7937 {
7938 int l=si,i=l-1,j;
7939 // look for start of name in "type *name"
7940 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
7941 j=i+1;
7942 // look for start of *'s
7943 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
7944 i++;
7945 if (i!=l)
7946 {
7947 yyextra->oldStyleArgType=yyextra->current->args.left(i);
7948 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
7949 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
7950 }
7951 else
7952 {
7953 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
7954 }
7955 }
7956 }
7957 else // continuation like *arg2 in "int *args,*arg2"
7958 {
7959 int l=si,j=0;
7960 char c;
7961 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
7962 if (j>0)
7963 {
7964 oldStyleArgPtr=yyextra->current->args.left(j);
7965 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
7966 }
7967 else
7968 {
7969 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
7970 }
7971 }
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:842
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:853
7972}

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

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8023 of file scanner.l.

8024{
8025 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8026 if (brief)
8027 {
8028 yyextra->current->briefFile = yyextra->fileName;
8029 yyextra->current->briefLine = yyextra->yyLineNr;
8030 }
8031 else
8032 {
8033 yyextra->current->docFile = yyextra->fileName;
8034 yyextra->current->docLine = yyextra->yyLineNr;
8035 }
8036}

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 7801 of file scanner.l.

7802{
7803 QCString r = req.stripWhiteSpace();
7804 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:524
7805}

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

◆ startVerbatimBlock()

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

Definition at line 7768 of file scanner.l.

7769{
7770 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7771 if (Config_getBool(MARKDOWN_SUPPORT))
7772 {
7773 yyextra->docBlock << "\\iskip";
7774 }
7775 yyextra->docBlockName=blockName;
7776 yyextra->fencedSize=fencedSize;
7777 yyextra->isCodeBlock=codeBlock;
7778 yyextra->nestedComment=0;
7779}

References Config_getBool.

◆ stateToString()

const char * stateToString ( int state)
static

◆ storeClangId()

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

Definition at line 7663 of file scanner.l.

7664{
7665 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7666 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
7667 {
7668 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
7669 }
7670}

◆ stripFuncPtr()

QCString stripFuncPtr ( const QCString & type)
static

Definition at line 7755 of file scanner.l.

7756{
7757 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
7758 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
7759 size_t i=type.length();
7760 bool funcPtr = i>0 && type[i-1]==')';
7761 if (funcPtr) i--;
7762 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
7763 if (funcPtr && i>0 && type[i-1]=='(') i--;
7764 return type.left(i);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
7765}

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

◆ stripQuotes()

QCString stripQuotes ( const char * s)
static

Definition at line 7743 of file scanner.l.

7744{
7745 QCString name;
7746 if (s==nullptr || *s==0) return name;
7747 name=s;
7748 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
7749 {
7750 name=name.mid(1,name.length()-2);
7751 }
7752 return name;
7753}

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

◆ yylex()

int yylex ( yyscan_t yyscanner)

Slice states.

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

Definition at line 500 of file scanner.l.

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

◆ yyread()

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

Definition at line 7604 of file scanner.l.

7605{
7606 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7607 int c=0;
7608 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7609 {
7610 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7611 //printf("%d (%c)\n",*buf,*buf);
7612 c++; buf++;
7613 }
7614 return c;
7615}