Doxygen
Loading...
Searching...
No Matches
scanner.l File Reference
#include <stdint.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cctype>
#include "scanner.h"
#include "entry.h"
#include "message.h"
#include "config.h"
#include "doxygen.h"
#include "util.h"
#include "defargs.h"
#include "language.h"
#include "commentscan.h"
#include "arguments.h"
#include "moduledef.h"
#include "stringutil.h"
#include "filename.h"
#include "md5hash.h"
#include "clangparser.h"
#include "markdown.h"
#include "regex.h"
#include "trace.h"
#include "debug.h"
#include "filedef.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 size_t computeIndent (const char *s, size_t startIndent)
static void initMethodProtection (yyscan_t yyscanner, Protection prot)
static DString stripQuotes (const char *s)
static DString stripFuncPtr (const DString &type)
static bool nameIsOperator (DString &name)
void fixArgumentListForJavaScript (ArgumentList &al)
static bool startOfRequiresExpression (const DString &req)
static void initParser (yyscan_t yyscanner)
static void initEntry (yyscan_t yyscanner)
static void lineCount (yyscan_t yyscanner)
static void addType (yyscan_t yyscanner)
static void setContext (yyscan_t yyscanner)
static void prependScope (yyscan_t yyscanner)
static void startCommentBlock (yyscan_t yyscanner, bool)
static void handleCommentBlock (yyscan_t yyscanner, const DString &doc, bool brief)
static void handleParametersCommentBlocks (yyscan_t yyscanner, ArgumentList &al)
static bool checkForKnRstyleC (yyscan_t yyscanner)
static void splitKnRArg (yyscan_t yyscanner, DString &oldStyleArgPtr, DString &oldStyleArgName)
static void addKnRArgInfo (yyscan_t yyscanner, const DString &type, const DString &name, const DString &brief, const DString &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 DString &blockName, size_t fencedSize=0, bool codeBlock=false)
static bool endVerbatimBlock (yyscan_t yyscanner, const DString &blockName, size_t fencedSize=0)
static DString generateAnonymousAnchor (const DString &fileName, int count)
static const char * getLexerFILE ()
int yylex (yyscan_t yyscanner)
 Slice states.
static void newEntry (yyscan_t yyscanner)
static void parseCompounds (yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
static void parseConcepts (yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
static void parseMain (yyscan_t yyscanner, const DString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &rt, ClangTUParser *clangParser)
static void parsePrototype (yyscan_t yyscanner, const DString &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 xml.l:230

Definition at line 264 of file scanner.l.

◆ YY_NO_INPUT

#define YY_NO_INPUT   1

Definition at line 63 of file scanner.l.

◆ YY_NO_UNISTD_H

#define YY_NO_UNISTD_H   1

Definition at line 64 of file scanner.l.

◆ YY_TYPEDEF_YY_SCANNER_T

#define YY_TYPEDEF_YY_SCANNER_T

Definition at line 22 of file scanner.l.

Typedef Documentation

◆ yyscan_t

typedef yyguts_t* yyscan_t

Definition at line 24 of file scanner.l.

Function Documentation

◆ addKnRArgInfo()

void addKnRArgInfo ( yyscan_t yyscanner,
const DString & type,
const DString & name,
const DString & brief,
const DString & 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 8456 of file scanner.l.

8458{
8459 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8460 for (Argument &a : yyextra->current->argList)
8461 {
8462 if (a.type==name)
8463 {
8464 a.type=type.stripWhiteSpace();
8465 a.type.stripPrefix("register ");
8466 a.name=name.stripWhiteSpace();
8467 if (!brief.empty() && !docs.empty())
8468 {
8469 a.docs=brief+"\n\n"+docs;
8470 }
8471 else if (!brief.empty())
8472 {
8473 a.docs=brief;
8474 }
8475 else
8476 {
8477 a.docs=docs;
8478 }
8479 }
8480 }
This class contains the information about the argument of a function or template.
Definition arguments.h:27
DString docs
Definition arguments.h:48
DString name
Definition arguments.h:45
DString type
Definition arguments.h:43
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:152
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:341
bool stripPrefix(const DString &prefix)
Definition dstring.h:294
8481}

References addKnRArgInfo(), Argument::docs, DString::empty(), Argument::name, DString::stripPrefix(), DString::stripWhiteSpace(), and Argument::type.

Referenced by addKnRArgInfo(), and stateToString().

◆ addType()

void addType ( yyscan_t yyscanner)
static

Definition at line 8198 of file scanner.l.

8199{
8200 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8201 size_t tl=yyextra->current->type.length();
8202 if( tl>0 && !yyextra->current->name.empty() && yyextra->current->type.at(tl-1)!='.')
8203 {
8204 yyextra->current->type += ' ' ;
8205 }
8206 yyextra->current->type += yyextra->current->name;
8207 yyextra->current->name.clear() ;
8208 tl=yyextra->current->type.length();
8209 if( tl>0 && !yyextra->current->args.empty() && yyextra->current->type.at(tl-1)!='.')
8210 {
8211 yyextra->current->type += ' ' ;
8212 }
8213 yyextra->current->type += yyextra->current->args ;
8214 yyextra->current->args.clear() ;
8215 yyextra->current->argList.clear();
8216}

References addType().

Referenced by addType(), and stateToString().

◆ checkForKnRstyleC()

bool checkForKnRstyleC ( yyscan_t yyscanner)
static

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

Definition at line 8336 of file scanner.l.

8337{
8338 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8339 if (!yyextra->fileName.lower().endsWith(".c")) return false; // must be a C file
8340 if (yyextra->current->argList.empty()) return false; // must have arguments
8341 for (const Argument &a : yyextra->current->argList)
8342 {
8343 // in K&R style argument do not have a type, but doxygen expects a type
8344 // so it will think the argument has no name
8345 if (a.type.empty() || !a.name.empty()) return false;
8346 }
8347 return true;
8348}

References checkForKnRstyleC(), DString::empty(), Argument::name, and Argument::type.

Referenced by checkForKnRstyleC(), and stateToString().

◆ computeIndent()

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

Definition at line 8171 of file scanner.l.

8172{
8173 size_t col=startIndent;
8174 int tabSize=Config_getInt(TAB_SIZE);
8175 const char *p=s;
8176 char c;
8177 while ((c=*p++))
8178 {
8179 if (c=='\t') col+=tabSize-(col%tabSize);
8180 else if (c=='\n') col=0;
8181 else col++;
8182 }
8183 return col;
#define Config_getInt(name)
Definition config.h:34
8184}

References computeIndent(), and Config_getInt.

Referenced by computeIndent(), and stateToString().

◆ endVerbatimBlock()

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

Definition at line 8258 of file scanner.l.

8259{
8260 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8261 if (yyextra->docBlockName==blockName && (fencedSize==0 || fencedSize==yyextra->fencedSize))
8262 {
8263 if (Config_getBool(MARKDOWN_SUPPORT))
8264 {
8265 yyextra->docBlock << "\\endiskip";
8266 }
8267 yyextra->docBlockName="";
8268 return true;
8269 }
8270 return false;
#define Config_getBool(name)
Definition config.h:33
8271}

References Config_getBool, and endVerbatimBlock().

Referenced by endVerbatimBlock(), and stateToString().

◆ fixArgumentListForJavaScript()

void fixArgumentListForJavaScript ( ArgumentList & al)

Definition at line 8485 of file scanner.l.

8486{
8487 for (Argument &a : al)
8488 {
8489 if (!a.type.empty() && a.name.empty())
8490 { // a->type is actually the (typeless) parameter name, so move it
8491 a.name=a.type;
8492 a.type.clear();
8493 }
8494 }
8495}

References DString::clear(), DString::empty(), fixArgumentListForJavaScript(), Argument::name, and Argument::type.

Referenced by fixArgumentListForJavaScript(), and stateToString().

◆ generateAnonymousAnchor()

DString generateAnonymousAnchor ( const DString & fileName,
int count )
static

Definition at line 8116 of file scanner.l.

8117{
8118 DString fn = stripFromPath(fileName)+":"+DString().setNum(count);
8119 auto md5_sig = md5hash(fn.view());
8120 char result[md5_sig.size()*3+2];
8121 char *p = result;
8122 *p++='@';
8123 for (size_t i=0;i<md5_sig.size();i++)
8124 {
8125 static const char oct[]="01234567";
8126 uint8_t byte = md5_sig[i];
8127 *p++=oct[(byte>>6)&7];
8128 *p++=oct[(byte>>3)&7];
8129 *p++=oct[(byte>>0)&7];
8130 }
8131 *p='\0';
8132 return result;
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:88
DString & setNum(short n)
Definition dstring.h:556
DString()=default
std::string_view view() const
Definition dstring.h:166
std::array< uint8_t, 16 > md5hash(const std::string_view &str)
Definition md5hash.h:26
DString stripFromPath(const DString &path)
Definition util.cpp:221
8133}

References DString::DString(), generateAnonymousAnchor(), md5hash(), DString::setNum(), stripFromPath(), and DString::view().

Referenced by generateAnonymousAnchor(), and stateToString().

◆ getLexerFILE()

const char * getLexerFILE ( )
inlinestatic

Definition at line 267 of file scanner.l.

267{return __FILE__;}

References getLexerFILE().

◆ handleCommentBlock()

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

Definition at line 8536 of file scanner.l.

8537{
8538 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8539 AUTO_TRACE("doc='{}' is_brief={}",Trace::trunc(doc),brief);
8540 bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS);
8541 if (yyextra->docBlockInBody && hideInBodyDocs) return;
8542 int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine; // line of block start
#define AUTO_TRACE(...)
Definition docnode.cpp:51
DString trunc(const DString &s, size_t numChars=15)
Definition trace.h:56
8543
8544 // fill in inbodyFile && inbodyLine the first time, see bug 633891
8545 std::shared_ptr<Entry> docEntry = yyextra->docBlockInBody && yyextra->previous ? yyextra->previous : yyextra->current;
8546 if (yyextra->docBlockInBody && docEntry && docEntry->inbodyLine==-1)
8547 {
8548 docEntry->inbodyFile = yyextra->fileName;
8549 docEntry->inbodyLine = lineNr;
8550 }
8551
8552 int position=0;
8553 bool needsEntry=false;
8554 GuardedSectionStack guards;
8555 Markdown markdown(yyextra->fileName,lineNr);
8556 DString strippedDoc = stripIndentation(doc);
8557 DString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8558 while (yyextra->commentScanner.parseCommentBlock(
8559 yyextra->thisParser,
8560 yyextra->docBlockInBody && yyextra->previous ? yyextra->previous.get() : yyextra->current.get(),
8561 processedDoc, // text
8562 yyextra->fileName, // file
8563 lineNr, // line of block start
8564 yyextra->docBlockInBody ? false : brief, // isBrief
8565 yyextra->docBlockInBody ? false : yyextra->docBlockAutoBrief, // isJavaDocStyle
8566 yyextra->docBlockInBody, // isInBody
8567 yyextra->protection,
8568 position,
8569 needsEntry,
8570 Config_getBool(MARKDOWN_SUPPORT),
8571 &guards
8572 )
8573 )
8574 {
8575 //printf("parseCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8576 if (needsEntry)
8577 {
8578 DString docFile = yyextra->current->docFile;
8579 newEntry(yyscanner);
8580 yyextra->current->docFile = docFile;
8581 yyextra->current->docLine = lineNr;
8582 }
8583 }
8584 if (needsEntry)
8585 {
8586 newEntry(yyscanner);
8587 }
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 pyscanner.l:1869
DString stripIndentation(const DString &s, bool skipFirstLine)
Definition util.cpp:4685
8588
8589 if (yyextra->docBlockTerm)
8590 {
8591 unput(yyextra->docBlockTerm);
8592 yyextra->docBlockTerm=0;
8593 }
8594}

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

Referenced by handleCommentBlock(), and stateToString().

◆ handleParametersCommentBlocks()

void handleParametersCommentBlocks ( yyscan_t yyscanner,
ArgumentList & al )
static

Definition at line 8596 of file scanner.l.

8597{
8598 AUTO_TRACE();
8599 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8600 for (Argument &a : al)
8601 {
8602 AUTO_TRACE_ADD("Param '{}' docs='{}'",a.name,Trace::trunc(a.docs));
8603 if (!a.docs.empty())
8604 {
8605 if (a.name.empty() && a.type == "...") a.name= "...";
8606 int position=0;
8607 bool needsEntry;
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:52
8608
8609 // save context
8610 DString orgDoc = yyextra->current->doc;
8611 DString orgBrief = yyextra->current->brief;
8612 int orgDocLine = yyextra->current->docLine;
8613 int orgBriefLine = yyextra->current->briefLine;
8614
8615 yyextra->current->doc.clear();
8616 yyextra->current->brief.clear();
8617
8618 //printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
8619 int lineNr = orgDocLine;
8620 GuardedSectionStack guards;
8621 Markdown markdown(yyextra->fileName,lineNr);
8622 DString strippedDoc = stripIndentation(a.docs);
8623 DString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
8624 while (yyextra->commentScanner.parseCommentBlock(
8625 yyextra->thisParser,
8626 yyextra->current.get(),
8627 processedDoc, // text
8628 yyextra->fileName, // file
8629 lineNr,
8630 false,
8631 false,
8632 false,
8633 yyextra->protection,
8634 position,
8635 needsEntry,
8636 Config_getBool(MARKDOWN_SUPPORT),
8637 &guards
8638 )
8639 )
8640 {
8641 //printf("handleParametersCommentBlock position=%d [%s]\n",position,qPrint(doc)+position);
8642 if (needsEntry) newEntry(yyscanner);
8643 }
8644 if (needsEntry)
8645 {
8646 newEntry(yyscanner);
8647 }
8648 a.docs = yyextra->current->doc;
8649
8650 // restore context
8651 yyextra->current->doc = orgDoc;
8652 yyextra->current->brief = orgBrief;
8653 yyextra->current->docLine = orgDocLine;
8654 yyextra->current->briefLine = orgBriefLine;
8655 }
8656 }
8657}

References AUTO_TRACE, AUTO_TRACE_ADD, DString::clear(), Config_getBool, Argument::docs, DString::empty(), handleParametersCommentBlocks(), Argument::name, newEntry(), Markdown::process(), stripIndentation(), Trace::trunc(), and Argument::type.

Referenced by handleParametersCommentBlocks(), and stateToString().

◆ initEntry()

void initEntry ( yyscan_t yyscanner)
static

Definition at line 8095 of file scanner.l.

8096{
8097 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8098 if (yyextra->insideJava)
8099 {
8100 yyextra->protection = (yyextra->current_root->spec.isInterface() || yyextra->current_root->spec.isEnum()) ? Protection::Public : Protection::Package;
8101 }
8102 yyextra->current->protection = yyextra->protection;
8103 yyextra->current->exported = yyextra->exported ;
8104 yyextra->current->mtype = yyextra->mtype;
8105 yyextra->current->virt = yyextra->virt;
8106 yyextra->current->isStatic = yyextra->isStatic;
8107 yyextra->current->lang = yyextra->language;
8108 //printf("*** initEntry(yyscanner) yyextra->language=%d\n",yyextra->language);
8109 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
8110 yyextra->isTypedef=false;
8111}

References initEntry().

Referenced by initEntry(), newEntry(), parseCompounds(), parseConcepts(), parseMain(), and stateToString().

◆ initMethodProtection()

void initMethodProtection ( yyscan_t yyscanner,
Protection prot )
inlinestatic

Definition at line 8186 of file scanner.l.

8187{
8188 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8189 yyextra->current->protection = yyextra->protection = prot;
8190 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
8191 yyextra->current->type.clear();
8192 yyextra->current->name.clear();
8193 yyextra->current->args.clear();
8194 yyextra->current->argList.clear();
8195 lineCount(yyscanner) ;
#define lineCount(s, len)
8196}

References initMethodProtection(), and lineCount.

Referenced by initMethodProtection(), and stateToString().

◆ initParser()

void initParser ( yyscan_t yyscanner)
static

Definition at line 8071 of file scanner.l.

8072{
8073 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8074 yyextra->outerScopeEntries.clear();
8075 yyextra->baseName.clear();
8076 yyextra->protection = Protection::Public;
8077 yyextra->baseProt = Protection::Public;
8078 yyextra->sharpCount = 0;
8079 yyextra->roundCount = 0;
8080 yyextra->curlyCount = 0;
8081 yyextra->mtype = MethodTypes::Method;
8082 yyextra->isStatic = false;
8083 yyextra->virt = Specifier::Normal;
8084 yyextra->baseVirt = Specifier::Normal;
8085 yyextra->isTypedef = false;
8086 yyextra->insideTryBlock = false;
8087 yyextra->insideFormula = false;
8088 yyextra->insideCode=false;
8089 yyextra->insideCli=Config_getBool(CPP_CLI_SUPPORT);
8090 yyextra->previous = 0;
8091 yyextra->firstTypedefEntry.reset();
8092 yyextra->memspecEntry.reset();
8093}

References Config_getBool, and initParser().

Referenced by initParser(), parseMain(), and stateToString().

◆ lineCount()

void lineCount ( yyscan_t yyscanner)
static

Definition at line 8144 of file scanner.l.

8145{
8146 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8147 int tabSize = Config_getInt(TAB_SIZE);
8148 const char *p;
8149 for (p = yytext ; *p ; ++p )
8150 {
8151 if (*p=='\n')
8152 {
8153 yyextra->yyLineNr++;
8154 yyextra->column=0;
8155 yyextra->yyColNr=1;
8156 }
8157 else if (*p=='\t')
8158 {
8159 yyextra->column+=tabSize - (yyextra->column%tabSize);
8160 yyextra->yyColNr=1+yyextra->column;
8161 }
8162 else
8163 {
8164 yyextra->column++;
8165 yyextra->yyColNr++;
8166 }
8167 }
8168 //printf("lineCount()=%d\n",yyextra->column);
8169}

References Config_getInt, and lineCount.

◆ nameIsOperator()

bool nameIsOperator ( DString & name)
static

Definition at line 8285 of file scanner.l.

8286{
8287 size_t i=name.find("operator");
8288 if (i==DString::npos) return false;
8289 if (i==0 && !isId(name.at(8))) return true; // case operator ::X
8290 if (i>0 && !isId(name.at(i-1)) && !isId(name.at(i+8))) return true; // case X::operator
8291 return false; // case TEXToperatorTEXT
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:182
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:690
size_t find(char c, size_t pos=0) const
Definition dstring.h:243
bool isId(int c)
Returns true if c is a valid character for an identifier.
Definition dstring.h:899
8292}

References DString::at(), DString::find(), isId(), nameIsOperator(), and DString::npos.

Referenced by nameIsOperator(), and stateToString().

◆ newEntry()

void newEntry ( yyscan_t yyscanner)
static

Definition at line 8516 of file scanner.l.

8517{
8518 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8519 if (yyextra->tempEntry==0) // if temp entry is not 0, it holds yyextra->current,
8520 // and yyextra->current is actually replaced by yyextra->previous which was
8521 // already added to yyextra->current_root, so we should not add it again
8522 // (see bug723314)
8523 {
8524 yyextra->previous = yyextra->current;
8525 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8526 }
8527 else
8528 {
8529 yyextra->previous = yyextra->current;
8530 yyextra->current = yyextra->tempEntry;
8531 yyextra->tempEntry.reset();
8532 }
8533 initEntry(yyscanner);
static void initEntry(yyscan_t yyscanner)
Definition pyscanner.l:1853
8534}

References initEntry(), and newEntry().

Referenced by handleCommentBlock(), handleParametersCommentBlocks(), and newEntry().

◆ parseCompounds()

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

Definition at line 8662 of file scanner.l.

8663{
8664 AUTO_TRACE("name={}",rt->name);
8665 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8666 for (const auto &ce : rt->children())
8667 {
8668 if (!ce->program.empty())
8669 {
8670 AUTO_TRACE_ADD("compound name='{}' program='{}'",Trace::trunc(ce->name),Trace::trunc(ce->program.str()));
8671 // init scanner state
8672 yyextra->padCount=0;
8673 yyextra->column=0;
8674 yyextra->programStr = ce->program.str();
8675 yyextra->inputString = yyextra->programStr.data();
8676 yyextra->inputPosition = 0;
8677 if (ce->section.isEnum() || ce->spec.isEnum())
8678 BEGIN( FindFields ) ;
8679 else
8680 BEGIN( FindMembers ) ;
8681 yyextra->current_root = ce;
8682 yyextra->fileName = ce->fileName;
8683 //setContext();
8684 yyextra->yyLineNr = ce->bodyLine;
8685 yyextra->yyColNr = ce->bodyColumn;
8686 yyextra->insideObjC = ce->lang==SrcLangExt::ObjC;
8687 //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC);
8688 yyextra->current = std::make_shared<Entry>();
8689 yyextra->isStatic = false;
8690 initEntry(yyscanner);
8691
8692 // deep copy group list from parent (see bug 727732)
8693 bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
8694 if (autoGroupNested && !rt->groups.empty() && !ce->section.isEnum() && !ce->spec.isEnum())
8695 {
8696 ce->groups = rt->groups;
8697 }
8698
8699 size_t ni=ce->name.rfind("::");
8700 if (ni==DString::npos) ni=0; else ni+=2;
8701 // set default protection based on the compound type
8702 if ( ce->section.isClass() ) // class
8703 {
8704 if (yyextra->insidePHP || yyextra->insideD || yyextra->insideJS || yyextra->insideIDL || yyextra->insideSlice)
8705 {
8706 yyextra->current->protection = yyextra->protection = Protection::Public ;
8707 }
8708 else if (yyextra->insideJava)
8709 {
8710 yyextra->current->protection = yyextra->protection = (ce->spec.isInterface() || ce->spec.isEnum()) ? Protection::Public : Protection::Package;
8711 }
8712 else if (ce->spec.isInterface() || ce->spec.isRef() || ce->spec.isValue() || ce->spec.isStruct() || ce->spec.isUnion())
8713 {
8714 if (ce->lang==SrcLangExt::ObjC)
8715 {
8716 yyextra->current->protection = yyextra->protection = Protection::Protected ;
8717 }
8718 else
8719 {
8720 yyextra->current->protection = yyextra->protection = Protection::Public ;
8721 }
8722 }
8723 else
8724 {
8725 yyextra->current->protection = yyextra->protection = Protection::Private ;
8726 }
8727 }
8728 else if (ce->section.isEnum() ) // enum
8729 {
8730 yyextra->current->protection = yyextra->protection = ce->protection;
8731 }
8732 else if (!ce->name.empty() && ce->name.at(ni)=='@') // unnamed union or namespace
8733 {
8734 if (ce->section.isNamespace() ) // unnamed namespace
8735 {
8736 yyextra->current->isStatic = yyextra->isStatic = true;
8737 }
8738 yyextra->current->protection = yyextra->protection = ce->protection;
8739 yyextra->current->exported = yyextra->exported = false;
8740 }
8741 else if (ce->section.isNamespace() )
8742 {
8743 yyextra->current->protection = yyextra->protection = Protection::Public ;
8744 yyextra->current->exported = yyextra->exported = ce->exported;
8745 }
8746 else // named struct, union, protocol, category
8747 {
8748 yyextra->current->protection = yyextra->protection = Protection::Public ;
8749 yyextra->current->exported = yyextra->exported = false;
8750 }
8751 yyextra->mtype = MethodTypes::Method;
8752 yyextra->virt = Specifier::Normal;
8753 //printf("name=%s yyextra->current->isStatic=%d yyextra->isStatic=%d\n",qPrint(ce->name),yyextra->current->isStatic,yyextra->isStatic);
8754
8755 //memberGroupId = DOX_NOGROUP;
8756 //memberGroupRelates.clear();
8757 //memberGroupInside.clear();
8758 DString name = ce->name;
8759 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
8760
8761 scannerYYlex(yyscanner);
8762 //forceEndGroup();
8763
8764 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
8765
8766 yyextra->programStr.clear();
8767 ce->program.str(std::string());
8768
8769
8770 //if (depthIf>0)
8771 //{
8772 // warn(yyextra->fileName,yyextra->yyLineNr,"Documentation block ended in the middle of a conditional section!");
8773 //}
8774 }
8775 parseCompounds(yyscanner,ce);
8776 }
static void parseCompounds(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8662
8777}

References AUTO_TRACE, AUTO_TRACE_ADD, Config_getBool, initEntry(), DString::npos, parseCompounds(), and Trace::trunc().

Referenced by parseCompounds(), and parseMain().

◆ parseConcepts()

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

Definition at line 8779 of file scanner.l.

8780{
8781 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8782 for (const auto &ce : rt->children())
8783 {
8784 if (ce->section.isConcept())
8785 {
8786 //printf("*** found concept '%s' value=[[\n%s\n]] line=%d,col=%d\n",
8787 // qPrint(ce->name),qPrint(ce->initializer.str()),ce->startLine,ce->startColumn);
8788 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8789 // init scanner state
8790 yyextra->padCount =0;
8791 yyextra->column =0;
8792 yyextra->programStr = ce->initializer.str();
8793 yyextra->inputString = yyextra->programStr.data();
8794 yyextra->inputPosition = 0;
8795 yyextra->current_root = ce;
8796 yyextra->fileName = ce->fileName;
8797 yyextra->yyLineNr = ce->bodyLine;
8798 yyextra->yyColNr = ce->bodyColumn;
8799 yyextra->insideObjC = false;
8800 yyextra->current = std::make_shared<Entry>();
8801
8802 // hack to reconstruct what was in the code before the concept expression
8803 DString indent;
8804 indent.fill(' ',ce->startColumn?ce->startColumn-1:0);
8805 DString templArgs;
8806 if (!ce->args.empty())
8807 {
8808 templArgs=indent+"template"+ce->args+"\n";
8809 }
8810 yyextra->current->initializer.str(DString(templArgs+indent+"concept "+ce->name+ " =").str());
DString fill(char c, size_t len)
Fills a string with a predefined character.
Definition dstring.h:282
const std::string & str() const
Definition dstring.h:649
8811
8812 yyextra->isStatic = false;
8813 initEntry(yyscanner);
8814 yyextra->current->section = EntryType::makeConceptCodePart();
8815 yyextra->current->startLine = yyextra->yyLineNr;
8816 BEGIN( FindConceptParts );
8817 scannerYYlex(yyscanner);
8818 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,ce->name);
8819
8820 }
8821 parseConcepts(yyscanner,ce);
8822 }
static void parseConcepts(yyscan_t yyscanner, const std::shared_ptr< Entry > &rt)
Definition scanner.l:8779
8823}

References DString::DString(), DString::fill(), initEntry(), parseConcepts(), and DString::str().

Referenced by parseConcepts(), and parseMain().

◆ parseMain()

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

Definition at line 8827 of file scanner.l.

8832{
8833 AUTO_TRACE("fileName={}",fileName);
8834 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8835 initParser(yyscanner);
static void initParser(yyscan_t yyscanner)
Definition scanner.l:8071
8836
8837 yyextra->inputString = fileBuf;
8838 yyextra->inputPosition = 0;
8839 yyextra->column = 0;
8840 scannerYYrestart(nullptr,yyscanner);
8841
8842 //depthIf = 0;
8843 yyextra->protection = Protection::Public;
8844 yyextra->mtype = MethodTypes::Method;
8845 yyextra->isStatic = false;
8846 yyextra->exported = false;
8847 yyextra->virt = Specifier::Normal;
8848 yyextra->current_root = rt;
8849 yyextra->yyLineNr = 1 ;
8850 yyextra->yyBegLineNr = 1;
8851 yyextra->yyBegColNr = 0;
8852 yyextra->anonCount = 0;
8853 yyextra->anonNSCount = 0;
8854 yyextra->fileName = fileName;
8855 yyextra->clangParser = clangParser;
8856 setContext(yyscanner);
8857 rt->lang = yyextra->language;
8858 msg("Parsing file {}...\n",yyextra->fileName);
#define msg(fmt,...)
Definition message.h:94
static void setContext(yyscan_t yyscanner)
Definition scanner.l:8296
8859
8860 yyextra->current_root = rt;
8861 initParser(yyscanner);
8862 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
8863 yyextra->current = std::make_shared<Entry>();
8864 //printf("yyextra->current=%p yyextra->current_root=%p\n",yyextra->current,yyextra->current_root);
8865 EntryType sec=EntryType::guessSection(yyextra->fileName);
8866 if (!sec.isEmpty())
8867 {
8868 yyextra->current->name = yyextra->fileName;
8869 yyextra->current->section = sec;
8870 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8871 }
8872 yyextra->current->reset();
8873 initEntry(yyscanner);
8874 if ( yyextra->insidePHP )
8875 {
8876 BEGIN( FindMembersPHP );
8877 }
8878 else if ( yyextra->insideJava ) // add default java.lang package scope
8879 {
8880 yyextra->current->name="java::lang"; // '::' is used in doxygen's internal representation as a scope separator
8881 yyextra->current->fileName = yyextra->fileName;
8882 yyextra->current->section = EntryType::makeUsingDir();
8883 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
8884 initEntry(yyscanner);
8885 BEGIN( FindMembers );
8886 }
8887 else
8888 {
8889 BEGIN( FindMembers );
8890 }
Wrapper class for the Entry type.
Definition types.h:856
static EntryType guessSection(const DString &name)
Definition types.cpp:19
8891
8892 scannerYYlex(yyscanner);
8893
8894 if (YY_START==Comment)
8895 {
8896 warn(yyextra->fileName,yyextra->yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?");
8897 }
#define warn(file, line, fmt,...)
Definition message.h:97
8898
8899 //forceEndGroup();
8900 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
8901
8902 yyextra->programStr.clear();
8903 rt->program.str(std::string());
8904
8905 parseCompounds(yyscanner,rt);
8906 parseConcepts(yyscanner,rt);
8907
8908 yyextra->anonNSCount++;
8909
8910 // add additional entries that were created during processing
8911 for (auto &[parent,child]: yyextra->outerScopeEntries)
8912 {
8913 //printf(">>> adding '%s' to scope '%s'\n",qPrint(child->name),qPrint(parent->name));
8914 parent->moveToSubEntryAndKeep(child);
8915 }
8916 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:1335
8917
8918}

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

Referenced by COutlineParser::parseInput(), and parseMain().

◆ parsePrototype()

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

Definition at line 8922 of file scanner.l.

8923{
8924 AUTO_TRACE("text='{}'",Trace::trunc(text));
8925 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8926 if (text.empty())
8927 {
8928 warn(yyextra->fileName,yyextra->yyLineNr,"Empty prototype found!");
8929 return;
8930 }
8931 if (!yyextra->current) // nothing to store (see bug683516)
8932 {
8933 return;
8934 }
8935
8936 const char *orgInputString;
8937 int orgInputPosition;
8938 YY_BUFFER_STATE orgState;
8939
8940 // save scanner state
8941 orgState = YY_CURRENT_BUFFER;
8942 yy_switch_to_buffer(yy_create_buffer(nullptr, YY_BUF_SIZE, yyscanner), yyscanner);
8943 orgInputString = yyextra->inputString;
8944 orgInputPosition = yyextra->inputPosition;
#define YY_BUF_SIZE
Definition commentcnv.l:19
8945
8946 // set new string
8947 yyextra->inputString = text.data();
8948 yyextra->inputPosition = 0;
8949 yyextra->column = 0;
8950 scannerYYrestart(nullptr, yyscanner);
8951 BEGIN(Prototype);
8952 scannerYYlex(yyscanner);
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:161
8953
8954 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
8955 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.empty())
8956 {
8957 yyextra->current->section = EntryType::makeVariableDoc();
8958 }
8959
8960 // restore original scanner state
8961 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8962 yy_switch_to_buffer(orgState, yyscanner);
8963 yyextra->inputString = orgInputString;
8964 yyextra->inputPosition = orgInputPosition;
8965
8966
8967 //printf("**** parsePrototype end\n");
8968}

References AUTO_TRACE, DString::data(), DString::empty(), parsePrototype(), Trace::trunc(), warn, and YY_BUF_SIZE.

Referenced by parsePrototype().

◆ prependScope()

void prependScope ( yyscan_t yyscanner)
static

Definition at line 8318 of file scanner.l.

8319{
8320 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8321 if (yyextra->current_root->section.isScope())
8322 {
8323 //printf("--- prependScope %s to %s\n",qPrint(yyextra->current_root->name),qPrint(yyextra->current->name));
8324 yyextra->current->name.prepend(yyextra->current_root->name+"::");
8325 //printf("prependScope #=%d #yyextra->current=%d\n",yyextra->current_root->tArgLists->count(),yyextra->current->tArgLists->count());
8326 for (const ArgumentList &srcAl : yyextra->current_root->tArgLists)
8327 {
8328 yyextra->current->tArgLists.insert(yyextra->current->tArgLists.begin(),srcAl);
8329 }
8330 }
This class represents an function or template argument list.
Definition arguments.h:66
8331}

References prependScope().

Referenced by prependScope(), and stateToString().

◆ setContext()

void setContext ( yyscan_t yyscanner)
static

Definition at line 8296 of file scanner.l.

8297{
8298 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8299 yyextra->language = getLanguageFromFileName(yyextra->fileName);
8300 yyextra->insideIDL = yyextra->language==SrcLangExt::IDL;
8301 yyextra->insideJava = yyextra->language==SrcLangExt::Java;
8302 yyextra->insideCS = yyextra->language==SrcLangExt::CSharp;
8303 yyextra->insideD = yyextra->language==SrcLangExt::D;
8304 yyextra->insidePHP = yyextra->language==SrcLangExt::PHP;
8305 yyextra->insideObjC = yyextra->language==SrcLangExt::ObjC;
8306 yyextra->insideJS = yyextra->language==SrcLangExt::JS;
8307 yyextra->insideSlice = yyextra->language==SrcLangExt::Slice;
8308 yyextra->insideCpp = (yyextra->language==SrcLangExt::Cpp ||
8309 yyextra->language==SrcLangExt::Lex);
8310 //printf("setContext(%s) yyextra->insideIDL=%d yyextra->insideJava=%d yyextra->insideCS=%d "
8311 // "yyextra->insideD=%d yyextra->insidePHP=%d yyextra->insideObjC=%d\n",
8312 // qPrint(yyextra->fileName),yyextra->insideIDL,yyextra->insideJava,yyextra->insideCS,yyextra->insideD,yyextra->insidePHP,yyextra->insideObjC
8313 // );
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4170
8314}

References getLanguageFromFileName(), and setContext().

Referenced by parseMain(), setContext(), and stateToString().

◆ setJavaProtection()

void setJavaProtection ( yyscan_t yyscanner)
static

Definition at line 8350 of file scanner.l.

8351{
8352 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8353 if (yyextra->insideJava)
8354 {
8355 DString text=yytext;
8356 yyextra->current->protection = Protection::Public;
8357 if (text.find("protected")!=DString::npos)
8358 yyextra->current->protection = Protection::Protected;
8359 else if (text.find("private")!=DString::npos)
8360 yyextra->current->protection = Protection::Private;
8361 else if (text.find("package")!=DString::npos)
8362 yyextra->current->protection = Protection::Package;
8363 }
8364}

References DString::find(), DString::npos, and setJavaProtection().

Referenced by setJavaProtection(), and stateToString().

◆ splitKnRArg()

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

Definition at line 8367 of file scanner.l.

8368{
8369 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8370 int si = static_cast<int>(yyextra->current->args.length());
8371 if (yyextra->oldStyleArgType.empty()) // new argument
8372 {
8373 std::string args = yyextra->current->args.str();
8374 static const reg::Ex re(R"(\‍([^)]*\).*)"); // find first (...)
8375 int bi1=-1;
8376 int bi2=-1;
8378 if (reg::search(args,match,re))
8379 {
8380 bi1=(int)match.position();
8381 size_t secondMatchStart = match.position()+match.length(); // search again after first match
8382 if (reg::search(args,match,re,secondMatchStart))
8383 {
8384 bi2=(int)match.position();
8385 }
8386 }
8387 char c;
8388 if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)"
8389 {
8390 int s=bi2+1; // keep opening (
8391 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8392 int i=s;
8393 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8394 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8395 s=i;
8396 while (i<si && isId(yyextra->current->args.at(i))) i++;
8397 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8398 yyextra->oldStyleArgType+=yyextra->current->args.mid(i);
8399 }
8400 else if (bi1!=-1) // redundant braces like in "int (*var)"
8401 {
8402 int s=bi1; // strip opening (
8403 yyextra->oldStyleArgType = yyextra->current->args.left(s);
8404 s++;
8405 int i=s+1;
8406 while (i<si && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i++;
8407 yyextra->oldStyleArgType += yyextra->current->args.mid(s,i-s);
8408 s=i;
8409 while (i<si && isId(yyextra->current->args.at(i))) i++;
8410 oldStyleArgName = yyextra->current->args.mid(s,i-s);
8411 }
8412 else // normal "int *var"
8413 {
8414 int l=si,i=l-1,j;
8415 // look for start of name in "type *name"
8416 while (i>=0 && isId(yyextra->current->args.at(i))) i--;
8417 j=i+1;
8418 // look for start of *'s
8419 while (i>=0 && ((c=yyextra->current->args.at(i))=='*' || isspace((uint8_t)c))) i--;
8420 i++;
8421 if (i!=l)
8422 {
8423 yyextra->oldStyleArgType=yyextra->current->args.left(i);
8424 oldStyleArgPtr=yyextra->current->args.mid(i,j-i);
8425 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8426 }
8427 else
8428 {
8429 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8430 }
8431 }
8432 }
8433 else // continuation like *arg2 in "int *args,*arg2"
8434 {
8435 int l=si,j=0;
8436 char c;
8437 while (j<l && ((c=yyextra->current->args.at(j))=='*' || isspace((uint8_t)c))) j++;
8438 if (j>0)
8439 {
8440 oldStyleArgPtr=yyextra->current->args.left(j);
8441 oldStyleArgName=yyextra->current->args.mid(j).stripWhiteSpace();
8442 }
8443 else
8444 {
8445 oldStyleArgName=yyextra->current->args.stripWhiteSpace();
8446 }
8447 }
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:322
DString left(size_t len) const
Definition dstring.h:310
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:154
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:847
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:858
8448}

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

Referenced by splitKnRArg(), and stateToString().

◆ startCommentBlock()

void startCommentBlock ( yyscan_t yyscanner,
bool brief )
static

Definition at line 8499 of file scanner.l.

8500{
8501 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8502 if (brief)
8503 {
8504 yyextra->current->briefFile = yyextra->fileName;
8505 yyextra->current->briefLine = yyextra->yyLineNr;
8506 }
8507 else
8508 {
8509 yyextra->current->docFile = yyextra->fileName;
8510 yyextra->current->docLine = yyextra->yyLineNr;
8511 }
8512}

References startCommentBlock().

Referenced by startCommentBlock(), and stateToString().

◆ startOfRequiresExpression()

bool startOfRequiresExpression ( const DString & req)
static

Definition at line 8277 of file scanner.l.

8278{
8279 DString r = req.stripWhiteSpace();
8280 return r.empty() || r.endsWith("&&") || r.endsWith("||") || r.endsWith("and") || r.endsWith("or");
bool endsWith(const char *s) const
Definition dstring.h:621
8281}

References DString::empty(), DString::endsWith(), startOfRequiresExpression(), and DString::stripWhiteSpace().

Referenced by startOfRequiresExpression(), and stateToString().

◆ startVerbatimBlock()

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

Definition at line 8244 of file scanner.l.

8245{
8246 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8247 if (Config_getBool(MARKDOWN_SUPPORT))
8248 {
8249 yyextra->docBlock << "\\iskip";
8250 }
8251 yyextra->docBlockName=blockName;
8252 yyextra->fencedSize=fencedSize;
8253 yyextra->isCodeBlock=codeBlock;
8254 yyextra->nestedComment=0;
8255}

References Config_getBool, and startVerbatimBlock().

Referenced by startVerbatimBlock(), and stateToString().

◆ stateToString()

◆ storeClangId()

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

Definition at line 8135 of file scanner.l.

8136{
8137 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8138 if (yyextra->clangParser && (yyextra->insideCpp || yyextra->insideObjC))
8139 {
8140 yyextra->current->id = yyextra->clangParser->lookup(yyextra->yyLineNr,id);
8141 }
8142}

References storeClangId().

Referenced by stateToString(), and storeClangId().

◆ stripFuncPtr()

DString stripFuncPtr ( const DString & type)
static

Definition at line 8231 of file scanner.l.

8232{
8233 // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases)
8234 // also needed to reset the type for 'arr' to 'int' in 'typedef int (&fp)(), arr[2]'
8235 size_t i=type.length();
8236 bool funcPtr = i>0 && type[i-1]==')';
8237 if (funcPtr) i--;
8238 while (i>0 && (type[i-1]=='*' || type[i-1]=='&' || type[i-1]==' ')) i--;
8239 if (funcPtr && i>0 && type[i-1]=='(') i--;
8240 return type.left(i);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:155
8241}

References DString::left(), DString::length(), and stripFuncPtr().

Referenced by stateToString(), and stripFuncPtr().

◆ stripQuotes()

DString stripQuotes ( const char * s)
static

Definition at line 8219 of file scanner.l.

8220{
8221 DString name;
8222 if (s==nullptr || *s==0) return name;
8223 name=s;
8224 if (name.at(0)=='"' && name.at(name.length()-1)=='"')
8225 {
8226 name=name.mid(1,name.length()-2);
8227 }
8228 return name;
8229}

References DString::at(), DString::length(), DString::mid(), and stripQuotes().

Referenced by stateToString(), and stripQuotes().

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

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

◆ yyread()

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

Definition at line 8057 of file scanner.l.

8058{
8059 struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
8060 int c=0;
8061 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
8062 {
8063 *buf = yyextra->inputString[yyextra->inputPosition++] ;
8064 //printf("%d (%c)\n",*buf,*buf);
8065 c++; buf++;
8066 }
8067 return c;
8068}

References yyread().