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 "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 QCString extractBeginRawStringDelimiter (const char *str)
 
static QCString extractEndRawStringDelimiter (const char *str)
 
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)
 
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 scanner.l:7507

Definition at line 254 of file scanner.l.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 60 of file scanner.l.

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 61 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()

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

7898{
7899 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7900 for (Argument &a : yyextra->current->argList)
7901 {
7902 if (a.type==name)
7903 {
7904 a.type=type.stripWhiteSpace();
7905 a.type.stripPrefix("register ");
7906 a.name=name.stripWhiteSpace();
7907 if (!brief.isEmpty() && !docs.isEmpty())
7908 {
7909 a.docs=brief+"\n\n"+docs;
7910 }
7911 else if (!brief.isEmpty())
7912 {
7913 a.docs=brief;
7914 }
7915 else
7916 {
7917 a.docs=docs;
7918 }
7919 }
7920 }
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:198
This class contains the information about the argument of a function or template.
Definition arguments.h:27
QCString type
Definition arguments.h:37
QCString name
Definition arguments.h:39
QCString docs
Definition arguments.h:42
7921}

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

◆ addType()

static void addType ( yyscan_t yyscanner)
static

Definition at line 7639 of file scanner.l.

7640{
7641 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7642 size_t tl=yyextra->current->type.length();
7643 if( tl>0 && !yyextra->current->name.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7644 {
7645 yyextra->current->type += ' ' ;
7646 }
7647 yyextra->current->type += yyextra->current->name;
7648 yyextra->current->name.clear() ;
7649 tl=yyextra->current->type.length();
7650 if( tl>0 && !yyextra->current->args.isEmpty() && yyextra->current->type.at(tl-1)!='.')
7651 {
7652 yyextra->current->type += ' ' ;
7653 }
7654 yyextra->current->type += yyextra->current->args ;
7655 yyextra->current->args.clear() ;
7656 yyextra->current->argList.clear();
7657}

◆ checkForKnRstyleC()

static bool checkForKnRstyleC ( yyscan_t yyscanner)
static

Returns TRUE iff the yyextra->current entry could be a K&R style C function

Definition at line 7776 of file scanner.l.

7777{
7778 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7779 if (!yyextra->fileName.lower().endsWith(".c")) return FALSE; // must be a C file
7780 if (yyextra->current->argList.empty()) return FALSE; // must have arguments
7781 for (const Argument &a : yyextra->current->argList)
7782 {
7783 // in K&R style argument do not have a type, but doxygen expects a type
7784 // so it will think the argument has no name
7785 if (a.type.isEmpty() || !a.name.isEmpty()) return FALSE;
7786 }
7787 return TRUE;
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
7788}

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

◆ computeIndent()

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

Definition at line 7598 of file scanner.l.

7599{
7600 int col=startIndent;
7601 int tabSize=Config_getInt(TAB_SIZE);
7602 const char *p=s;
7603 char c;
7604 while ((c=*p++))
7605 {
7606 if (c=='\t') col+=tabSize-(col%tabSize);
7607 else if (c=='\n') col=0;
7608 else col++;
7609 }
7610 return col;
#define Config_getInt(name)
Definition config.h:34
7611}

References Config_getInt.

◆ endVerbatimBlock()

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

Definition at line 7698 of file scanner.l.

7699{
7700 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7701 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
7702 {
7703 if (Config_getBool(MARKDOWN_SUPPORT))
7704 {
7705 yyextra->docBlock << "\\endiskip";
7706 }
7707 yyextra->docBlockName="";
7708 return true;
7709 }
7710 return false;
#define Config_getBool(name)
Definition config.h:33
7711}

References Config_getBool.

◆ extractBeginRawStringDelimiter()

static QCString extractBeginRawStringDelimiter ( const char * str)
static

Definition at line 7613 of file scanner.l.

7614{
7615 QCString text=rawStart;
7616 int i = text.find('"');
7617 assert(i!=-1);
7618 return text.mid(i+1,text.length()-i-2); // text=...R"xyz( -> delimiter=xyz
This is an alternative implementation of QCString.
Definition qcstring.h:101
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
7619}

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

◆ extractEndRawStringDelimiter()

static QCString extractEndRawStringDelimiter ( const char * str)
static

Definition at line 7621 of file scanner.l.

7622{
7623 QCString text=rawEnd;
7624 return text.mid(1,text.length()-2); // text=)xyz" -> delimiter=xyz
7625}

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

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 7925 of file scanner.l.

7926{
7927 for (Argument &a : al)
7928 {
7929 if (!a.type.isEmpty() && a.name.isEmpty())
7930 { // a->type is actually the (typeless) parameter name, so move it
7931 a.name=a.type;
7932 a.type.clear();
7933 }
7934 }
7935}

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

◆ getLexerFILE()

static const char * getLexerFILE ( )
inlinestatic

Definition at line 257 of file scanner.l.

257{return __FILE__;}

◆ handleCommentBlock()

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

Definition at line 7976 of file scanner.l.

7977{
7978 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7979 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
7980 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
7981 if (yyextra->docBlockInBody && hideInBodyDocs) return;
7982 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
7983
7984 // fill in inbodyFile && inbodyLine the first time, see bug 633891
7985 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
7986 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
7987 {
7988 docEntry->inbodyFile = yyextra->fileName;
7989 docEntry->inbodyLine = lineNr;
7990 }
7991
7992 int position=0;
7993 bool needsEntry=FALSE;
7994 GuardedSectionStack guards;
7995 Markdown markdown(yyextra->fileName,lineNr);
7996 QCString strippedDoc = stripIndentation(doc);
7997 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
7998 while (yyextra->commentScanner.parseCommentBlock(
7999 yyextra->thisParser,
8000 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8001 processedDoc, // text
8002 yyextra->fileName, // file
8003 lineNr, // line of block start
8004 yyextra->docBlockInBody ? FALSE : brief, // isBrief
8005 yyextra->docBlockInBody ? FALSE : yyextra->docBlockAutoBrief, // isJavaDocStyle
8006 yyextra->docBlockInBody, // isInBody
8007 yyextra->protection,
8008 position,
8009 needsEntry,
8010 Config_getBool(MARKDOWN_SUPPORT),
8011 &guards
8012 )
8013 )
8014 {
8015 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8016 if (needsEntry)
8017 {
8018 QCString docFile = yyextra->current->docFile;
8019 newEntry(yyscanner);
8020 yyextra->current->docFile = docFile;
8021 yyextra->current->docLine = lineNr;
8022 }
8023 }
8024 if (needsEntry)
8025 {
8026 newEntry(yyscanner);
8027 }
Helper class to process markdown formatted text.
Definition markdown.h:32
std::stack< GuardedSection > GuardedSectionStack
Definition commentscan.h:48
static void newEntry(yyscan_t yyscanner)
Definition scanner.l:7956
QCString stripIndentation(const QCString &s)
Definition util.cpp:6282
8028
8029 if (yyextra->docBlockTerm)
8030 {
8031 unput(yyextra->docBlockTerm);
8032 yyextra->docBlockTerm=0;
8033 }
8034}

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

◆ handleParametersCommentBlocks()

static void handleParametersCommentBlocks ( yyscan_t yyscanner,
ArgumentList & al )
static

Definition at line 8036 of file scanner.l.

8037{
8038 AUTO_TRACE();
8039 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8040 for (Argument &a : al)
8041 {
8042 AUTO_TRACE_ADD("Param '{}' docs='{}'",a.name,Trace::trunc(a.docs));
8043 if (!a.docs.isEmpty())
8044 {
8045 if (a.name.isEmpty() && a.type == "...") a.name= "...";
8046 int position=0;
8047 bool needsEntry;
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:47
8048
8049 // save context
8050 QCString orgDoc = yyextra->current->doc;
8051 QCString orgBrief = yyextra->current->brief;
8052 int orgDocLine = yyextra->current->docLine;
8053 int orgBriefLine = yyextra->current->briefLine;
8054
8055 yyextra->current->doc.clear();
8056 yyextra->current->brief.clear();
8057
8058 //printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
8059 int lineNr = orgDocLine;
8060 GuardedSectionStack guards;
8061 Markdown markdown(yyextra->fileName,lineNr);
8062 QCString strippedDoc = stripIndentation(a.docs);
8063 QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8064 while (yyextra->commentScanner.parseCommentBlock(
8065 yyextra->thisParser,
8066 yyextra->current.get(),
8067 processedDoc, // text
8068 yyextra->fileName, // file
8069 lineNr,
8070 FALSE,
8071 FALSE,
8072 FALSE,
8073 yyextra->protection,
8074 position,
8075 needsEntry,
8076 Config_getBool(MARKDOWN_SUPPORT),
8077 &guards
8078 )
8079 )
8080 {
8081 //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8082 if (needsEntry) newEntry(yyscanner);
8083 }
8084 if (needsEntry)
8085 {
8086 newEntry(yyscanner);
8087 }
8088 a.docs = yyextra->current->doc;
8089
8090 // restore context
8091 yyextra->current->doc = orgDoc;
8092 yyextra->current->brief = orgBrief;
8093 yyextra->current->docLine = orgDocLine;
8094 yyextra->current->briefLine = orgBriefLine;
8095 }
8096 }
8097}

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()

static void initEntry ( yyscan_t yyscanner)
static

Definition at line 7545 of file scanner.l.

7546{
7547 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7548 if (yyextra->insideJava)
7549 {
7550 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
7551 }
7552 yyextra->current->protection = yyextra->protection;
7553 yyextra->current->exported = yyextra->exported ;
7554 yyextra->current->mtype = yyextra->mtype;
7555 yyextra->current->virt = yyextra->virt;
7556 yyextra->current->isStatic = yyextra->isStatic;
7557 yyextra->current->lang = yyextra->language;
7558 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
7559 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
7560 yyextra->isTypedef=FALSE;
@ Package
Definition types.h:26
@ Public
Definition types.h:26
7561}

References FALSE, Package, and Public.

◆ initMethodProtection()

static void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 7627 of file scanner.l.

7628{
7629 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7630 yyextra->current->protection = yyextra->protection = prot;
7631 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
7632 yyextra->current->type.clear();
7633 yyextra->current->name.clear();
7634 yyextra->current->args.clear();
7635 yyextra->current->argList.clear();
7636 lineCount(yyscanner) ;
#define lineCount(s, len)
7637}

References lineCount, and Method.

◆ initParser()

static void initParser ( yyscan_t yyscanner)
static

Definition at line 7521 of file scanner.l.

7522{
7523 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7524 yyextra->outerScopeEntries.clear();
7525 yyextra->baseName.clear();
7526 yyextra->protection = Protection::Public;
7527 yyextra->baseProt = Protection::Public;
7528 yyextra->sharpCount = 0;
7529 yyextra->roundCount = 0;
7530 yyextra->curlyCount = 0;
7531 yyextra->mtype = MethodTypes::Method;
7532 yyextra->isStatic = FALSE;
7533 yyextra->virt = Specifier::Normal;
7534 yyextra->baseVirt = Specifier::Normal;
7535 yyextra->isTypedef = FALSE;
7536 yyextra->insideTryBlock = FALSE;
7537 yyextra->insideFormula = FALSE;
7538 yyextra->insideCode=FALSE;
7539 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
7540 yyextra->previous = 0;
7541 yyextra->firstTypedefEntry.reset();
7542 yyextra->memspecEntry.reset();
@ Normal
Definition types.h:29
7543}

References Config_getBool, FALSE, Method, Normal, and Public.

◆ lineCount()

static void lineCount ( yyscan_t yyscanner)
static

Definition at line 7575 of file scanner.l.

7576{
7577 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7578 int tabSize = Config_getInt(TAB_SIZE);
7579 const char *p;
7580 for (p = yytext ; *p ; ++p )
7581 {
7582 if (*p=='\n')
7583 {
7584 yyextra->yyLineNr++,yyextra->column=0,yyextra->yyColNr=1;
7585 }
7586 else if (*p=='\t')
7587 {
7588 yyextra->column+=tabSize - (yyextra->column%tabSize);
7589 }
7590 else
7591 {
7592 yyextra->column++,yyextra->yyColNr++;
7593 }
7594 }
7595 //printf("lineCount()=%d\n",yyextra->column);
7596}

References Config_getInt.

◆ nameIsOperator()

static bool nameIsOperator ( QCString & name)
static

Definition at line 7725 of file scanner.l.

7726{
7727 int i=name.find("operator");
7728 if (i==-1) return FALSE;
7729 if (i==0 && !isId(name.at(8))) return TRUE; // case operator ::X
7730 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return TRUE; // case X::operator
7731 return FALSE; // case TEXToperatorTEXT
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:578
bool isId(int c)
Definition util.h:202
7732}

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

◆ newEntry()

static void newEntry ( yyscan_t yyscanner)
static

Definition at line 7956 of file scanner.l.

7957{
7958 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7959 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
7960 // and yyextra->current is actually replaced by yyextra->previous which was
7961 // already added to yyextra->current_root, so we should not add it again
7962 // (see bug723314)
7963 {
7964 yyextra->previous = yyextra->current;
7965 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
7966 }
7967 else
7968 {
7969 yyextra->previous = yyextra->current;
7970 yyextra->current = yyextra->tempEntry;
7971 yyextra->tempEntry.reset();
7972 }
7973 initEntry(yyscanner);
static void initEntry(yyscan_t yyscanner)
Definition scanner.l:7545
7974}

References initEntry().

◆ parseCompounds()

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

Definition at line 8102 of file scanner.l.

8103{
8104 AUTO_TRACE("name={}",rt->name);
8105 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8106 for (const auto &ce : rt->children())
8107 {
8108 if (!ce->program.empty())
8109 {
8110 AUTO_TRACE_ADD("compound name='{}' program='{}'",Trace::trunc(ce->name),Trace::trunc(ce->program.str()));
8111 // init scanner state
8112 yyextra->padCount=0;
8113 //depthIf = 0;
8114 yyextra->column=0;
8115 yyextra->programStr = ce->program.str();
8116 yyextra->inputString = yyextra->programStr.data();
8117 yyextra->inputPosition = 0;
8118 if (ce->section.isEnum() || ce->spec.isEnum())
8119 BEGIN( FindFields ) ;
8120 else
8121 BEGIN( FindMembers ) ;
8122 yyextra->current_root = ce;
8123 yyextra->fileName = ce->fileName;
8124 //setContext();
8125 yyextra->yyLineNr = ce->bodyLine;
8126 yyextra->yyColNr = ce->bodyColumn;
8127 yyextra->insideObjC = ce->lang==SrcLangExt::ObjC;
8128 //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
8129 yyextra->current = std::make_shared<Entry>();
8130 yyextra->isStatic = FALSE;
8131 initEntry(yyscanner);
8132
8133 // deep copy group list from parent (see bug 727732)
8134 bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
8135 if (autoGroupNested && !rt->groups.empty() && !ce->section.isEnum() && !ce->spec.isEnum())
8136 {
8137 ce->groups = rt->groups;
8138 }
8139
8140 int ni=ce->name.findRev("::"); if (ni==-1) ni=0; else ni+=2;
8141 // set default protection based on the compound type
8142 if ( ce->section.isClass() ) // class
8143 {
8144 if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
8145 {
8146 yyextra->current->protection = yyextra->protection = Protection::Public ;
8147 }
8148 else if (yyextra->insideJava)
8149 {
8150 yyextra->current->protection = yyextra->protection = (ce->spec.isInterface() || ce->spec.isEnum()) ? Protection::Public : Protection::Package;
8151 }
8152 else if (ce->spec.isInterface() || ce->spec.isRef() || ce->spec.isValue() || ce->spec.isStruct() || ce->spec.isUnion())
8153 {
8154 if (ce->lang==SrcLangExt::ObjC)
8155 {
8156 yyextra->current->protection = yyextra->protection = Protection::Protected ;
8157 }
8158 else
8159 {
8160 yyextra->current->protection = yyextra->protection = Protection::Public ;
8161 }
8162 }
8163 else
8164 {
8165 yyextra->current->protection = yyextra->protection = Protection::Private ;
8166 }
8167 }
8168 else if (ce->section.isEnum() ) // enum
8169 {
8170 yyextra->current->protection = yyextra->protection = ce->protection;
8171 }
8172 else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace
8173 {
8174 if (ce->section.isNamespace() ) // unnamed namespace
8175 {
8176 yyextra->current->isStatic = yyextra->isStatic = TRUE;
8177 }
8178 yyextra->current->protection = yyextra->protection = ce->protection;
8179 yyextra->current->exported = yyextra->exported = false;
8180 }
8181 else if (ce->section.isNamespace() )
8182 {
8183 yyextra->current->protection = yyextra->protection = Protection::Public ;
8184 yyextra->current->exported = yyextra->exported = ce->exported;
8185 }
8186 else // named struct, union, protocol, category
8187 {
8188 yyextra->current->protection = yyextra->protection = Protection::Public ;
8189 yyextra->current->exported = yyextra->exported = false;
8190 }
8191 yyextra->mtype = MethodTypes::Method;
8192 yyextra->virt = Specifier::Normal;
8193 //printf("name=%s yyextra->current->isStatic=%d yyextra->isStatic=%d\n",qPrint(ce->name),yyextra->current->isStatic,yyextra->isStatic);
@ Private
Definition types.h:26
@ Protected
Definition types.h:26
8194
8195 //memberGroupId = DOX_NOGROUP;
8196 //memberGroupRelates.clear();
8197 //memberGroupInside.clear();
8198 QCString name = ce->name;
8199 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
8200
8201 scannerYYlex(yyscanner);
8202 yyextra->lexInit=TRUE;
8203 //forceEndGroup();
8204
8205 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
8206
8207 yyextra->programStr.clear();
8208 ce->program.str(std::string());
8209
8210
8211 //if (depthIf>0)
8212 //{
8213 // warn(yyextra->fileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
8214 //}
8215 }
8216 parseCompounds(yyscanner,ce);
8217 }
static void parseCompounds(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8102
8218}

References AUTO_TRACE, AUTO_TRACE_ADD, Config_getBool, FALSE, initEntry(), Method, Normal, ObjC, Package, parseCompounds(), Private, Protected, Public, TRUE, and Trace::trunc().

◆ parseMain()

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

Definition at line 8222 of file scanner.l.

8227{
8228 AUTO_TRACE("fileName={}",fileName);
8229 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8230 initParser(yyscanner);
static void initParser(yyscan_t yyscanner)
Definition scanner.l:7521
8231
8232 yyextra->inputString = fileBuf;
8233 yyextra->inputPosition = 0;
8234 yyextra->column = 0;
8235 scannerYYrestart(nullptr,yyscanner);
8236
8237 //depthIf = 0;
8238 yyextra->protection = Protection::Public;
8239 yyextra->mtype = MethodTypes::Method;
8240 yyextra->isStatic = FALSE;
8241 yyextra->exported = false;
8242 yyextra->virt = Specifier::Normal;
8243 yyextra->current_root = rt;
8244 yyextra->yyLineNr = 1 ;
8245 yyextra->yyBegLineNr = 1;
8246 yyextra->yyBegColNr = 0;
8247 yyextra->anonCount = 0;
8248 yyextra->anonNSCount = 0;
8249 yyextra->fileName = fileName;
8250 yyextra->clangParser = clangParser;
8251 setContext(yyscanner);
8252 rt->lang = yyextra->language;
8253 msg("Parsing file %s...\n",qPrint(yyextra->fileName));
void msg(const char *fmt,...)
Definition message.cpp:98
const char * qPrint(const char *s)
Definition qcstring.h:672
static void setContext(yyscan_t yyscanner)
Definition scanner.l:7736
8254
8255 yyextra->current_root = rt;
8256 initParser(yyscanner);
8257 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
8258 yyextra->current = std::make_shared<Entry>();
8259 //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
8260 EntryType sec=guessSection(yyextra->fileName);
8261 if (!sec.isEmpty())
8262 {
8263 yyextra->current->name = yyextra->fileName;
8264 yyextra->current->section = sec;
8265 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8266 }
8267 yyextra->current->reset();
8268 initEntry(yyscanner);
8269 if ( yyextra->insidePHP )
8270 {
8271 BEGIN( FindMembersPHP );
8272 }
8273 else if ( yyextra->insideJava ) // add default java.lang package scope
8274 {
8275 yyextra->current->name="java::lang"; // '::' is used in doxygen's internal representation as a scope separator
8276 yyextra->current->fileName = yyextra->fileName;
8277 yyextra->current->section = EntryType::makeUsingDir();
8278 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8279 initEntry(yyscanner);
8280 BEGIN( FindMembers );
8281 }
8282 else
8283 {
8284 BEGIN( FindMembers );
8285 }
Wrapper class for the Entry type.
Definition types.h:631
EntryType guessSection(const QCString &name)
Definition util.cpp:349
8286
8287 scannerYYlex(yyscanner);
8288 yyextra->lexInit=TRUE;
8289
8290 if (YY_START==Comment)
8291 {
8292 warn(yyextra->fileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?");
8293 }
#define warn(file, line, fmt,...)
Definition message.h:59
8294
8295 //forceEndGroup();
8296 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
8297
8298 yyextra->programStr.clear();
8299 rt->program.str(std::string());
8300
8301 parseCompounds(yyscanner,rt);
8302
8303 yyextra->anonNSCount++;
8304
8305 // add additional entries that were created during processing
8306 for (auto &[parent,child]: yyextra->outerScopeEntries)
8307 {
8308 //printf(">>> adding '%s' to scope '%s'\n",qPrint(child->name),qPrint(parent->name));
8309 parent->moveToSubEntryAndKeep(child);
8310 }
8311 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:1324
8312
8313}

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

◆ parsePrototype()

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

Definition at line 8317 of file scanner.l.

8318{
8319 AUTO_TRACE("text='{}'",Trace::trunc(text));
8320 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8321 if (text.isEmpty())
8322 {
8323 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8324 return;
8325 }
8326 if (!yyextra->current) // nothing to store (see bug683516)
8327 {
8328 return;
8329 }
8330
8331 const char *orgInputString;
8332 int orgInputPosition;
8333 YY_BUFFER_STATE orgState;
8334
8335 // save scanner state
8336 orgState = YY_CURRENT_BUFFER;
8337 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8338 orgInputString = yyextra->inputString;
8339 orgInputPosition = yyextra->inputPosition;
#define YY_BUF_SIZE
Definition commentcnv.l:19
8340
8341 // set new string
8342 yyextra->inputString = text.data();
8343 yyextra->inputPosition = 0;
8344 yyextra->column = 0;
8345 scannerYYrestart(nullptr, yyscanner);
8346 BEGIN(Prototype);
8347 scannerYYlex(yyscanner);
8348 yyextra->lexInit=TRUE;
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
8349
8350 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8351 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.isEmpty())
8352 {
8353 yyextra->current->section = EntryType::makeVariableDoc();
8354 }
8355
8356 // restore original scanner state
8357 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8358 yy_switch_to_buffer(orgState, yyscanner);
8359 yyextra->inputString = orgInputString;
8360 yyextra->inputPosition = orgInputPosition;
8361
8362
8363 //printf("**** parsePrototype end\n");
8364}

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

◆ prependScope()

static void prependScope ( yyscan_t yyscanner)
static

Definition at line 7758 of file scanner.l.

7759{
7760 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7761 if (yyextra->current_root->section.isScope())
7762 {
7763 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
7764 yyextra->current->name.prepend(yyextra->current_root->name+"::");
7765 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
7766 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
7767 {
7768 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
7769 }
7770 }
This class represents an function or template argument list.
Definition arguments.h:60
7771}

◆ setContext()

static void setContext ( yyscan_t yyscanner)
static

Definition at line 7736 of file scanner.l.

7737{
7738 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7739 yyextra->language = getLanguageFromFileName(yyextra->fileName);
7740 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
7741 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
7742 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
7743 yyextra->insideD = yyextra->language==SrcLangExt::D;
7744 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
7745 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
7746 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
7747 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
7748 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
7749 yyextra->language==SrcLangExt::Lex);
7750 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
7751 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
7752 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
7753 // );
@ CSharp
Definition types.h:46
@ Slice
Definition types.h:59
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition util.cpp:5549
7754}

References Cpp, CSharp, D, getLanguageFromFileName(), IDL, Java, JS, Lex, ObjC, PHP, and Slice.

Referenced by parseMain().

◆ setJavaProtection()

static void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 7790 of file scanner.l.

7791{
7792 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7793 if (yyextra->insideJava)
7794 {
7795 QCString text=yytext;
7796 yyextra->current->protection = Protection::Public;
7797 if (text.find("protected")!=-1)
7798 yyextra->current->protection = Protection::Protected;
7799 else if (text.find("private")!=-1)
7800 yyextra->current->protection = Protection::Private;
7801 else if (text.find("package")!=-1)
7802 yyextra->current->protection = Protection::Package;
7803 }
7804}

References QCString::find(), Package, Private, Protected, and Public.

◆ splitKnRArg()

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

Definition at line 7807 of file scanner.l.

7808{
7809 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7810 int si = static_cast<int>(yyextra->current->args.length());
7811 if (yyextra->oldStyleArgType.isEmpty()) // new argument
7812 {
7813 std::string args = yyextra->current->args.str();
7814 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
7815 int bi1=-1;
7816 int bi2=-1;
7818 if (reg::search(args,match,re))
7819 {
7820 bi1=(int)match.position();
7821 size_t secondMatchStart = match.position()+match.length(); // search again after first match
7822 if (reg::search(args,match,re,secondMatchStart))
7823 {
7824 bi2=(int)match.position();
7825 }
7826 }
7827 char c;
7828 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
7829 {
7830 int s=bi2+1; // keep opening (
7831 yyextra->oldStyleArgType = yyextra->current->args.left(s);
7832 int i=s;
7833 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
7834 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
7835 s=i;
7836 while (i<si && isId(yyextra->current->args.at(i))) i++;
7837 oldStyleArgName = yyextra->current->args.mid(s,i-s);
7838 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
7839 }
7840 else if (bi1!=-1) // redundant braces like in "int (*var)"
7841 {
7842 int s=bi1; // strip opening (
7843 yyextra->oldStyleArgType = yyextra->current->args.left(s);
7844 s++;
7845 int i=s+1;
7846 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
7847 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
7848 s=i;
7849 while (i<si && isId(yyextra->current->args.at(i))) i++;
7850 oldStyleArgName = yyextra->current->args.mid(s,i-s);
7851 }
7852 else // normal "int *var"
7853 {
7854 int l=si,i=l-1,j;
7855 // look for start of name in "type *name"
7856 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
7857 j=i+1;
7858 // look for start of *'s
7859 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
7860 i++;
7861 if (i!=l)
7862 {
7863 yyextra->oldStyleArgType=yyextra->current->args.left(i);
7864 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
7865 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
7866 }
7867 else
7868 {
7869 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
7870 }
7871 }
7872 }
7873 else // continuation like *arg2 in "int *args,*arg2"
7874 {
7875 int l=si,j=0;
7876 char c;
7877 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
7878 if (j>0)
7879 {
7880 oldStyleArgPtr=yyextra->current->args.left(j);
7881 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
7882 }
7883 else
7884 {
7885 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
7886 }
7887 }
QCString left(size_t len) const
Definition qcstring.h:214
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:153
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition regex.cpp:748
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:759
7888}

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

◆ startCommentBlock()

static void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 7939 of file scanner.l.

7940{
7941 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7942 if (brief)
7943 {
7944 yyextra->current->briefFile = yyextra->fileName;
7945 yyextra->current->briefLine = yyextra->yyLineNr;
7946 }
7947 else
7948 {
7949 yyextra->current->docFile = yyextra->fileName;
7950 yyextra->current->docLine = yyextra->yyLineNr;
7951 }
7952}

◆ startOfRequiresExpression()

static bool startOfRequiresExpression ( const QCString & req)
static

Definition at line 7717 of file scanner.l.

7718{
7719 QCString r = req.stripWhiteSpace();
7720 return r.isEmpty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition qcstring.h:509
7721}

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

◆ startVerbatimBlock()

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

Definition at line 7685 of file scanner.l.

7686{
7687 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7688 if (Config_getBool(MARKDOWN_SUPPORT))
7689 {
7690 yyextra->docBlock << "\\iskip";
7691 }
7692 yyextra->docBlockName=blockName;
7693 yyextra->fencedSize=fencedSize;
7694 yyextra->nestedComment=0;
7695}

References Config_getBool.

◆ stateToString()

static const char * stateToString ( int state)
static

◆ storeClangId()

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

Definition at line 7566 of file scanner.l.

7567{
7568 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7569 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
7570 {
7571 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
7572 }
7573}

◆ stripFuncPtr()

static QCString stripFuncPtr ( const QCString & type)
static

Definition at line 7672 of file scanner.l.

7673{
7674 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
7675 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
7676 size_t i=type.length();
7677 bool funcPtr = i>0 && type[i-1]==')';
7678 if (funcPtr) i--;
7679 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
7680 if (funcPtr && i>0 && type[i-1]=='(') i--;
7681 return type.left(i);
7682}

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

◆ stripQuotes()

static QCString stripQuotes ( const char * s)
static

Definition at line 7660 of file scanner.l.

7661{
7662 QCString name;
7663 if (s==nullptr || *s==0) return name;
7664 name=s;
7665 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
7666 {
7667 name=name.mid(1,name.length()-2);
7668 }
7669 return name;
7670}

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

◆ yyread()

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

Definition at line 7507 of file scanner.l.

7508{
7509 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7510 int c=0;
7511 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
7512 {
7513 *buf = yyextra->inputString[yyextra->inputPosition++] ;
7514 //printf("%d (%c)\n",*buf,*buf);
7515 c++; buf++;
7516 }
7517 return c;
7518}