Doxygen
Loading...
Searching...
No Matches
declinfo.h File Reference
#include <stdio.h>
#include "types.h"
Include dependency graph for declinfo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void parseFuncDecl (const DString &decl, const SrcLangExt lang, DString &clName, DString &type, DString &name, DString &args, DString &funcTempList, DString &exceptions)

Function Documentation

◆ parseFuncDecl()

void parseFuncDecl ( const DString & decl,
const SrcLangExt lang,
DString & clName,
DString & type,
DString & name,
DString & args,
DString & funcTempList,
DString & exceptions )
extern

Definition at line 325 of file declinfo.l.

327{
328 if (decl.empty())
329 {
330 return;
331 }
332 declinfoYYlex_init_extra(&g_declinfo_extra, &g_yyscanner);
333 struct yyguts_t *yyg = (struct yyguts_t*)g_yyscanner;
334
335#ifdef FLEX_DEBUG
336 declinfoYYset_debug(Debug::isFlagSet(Debug::Lex_declinfo)?1:0,g_yyscanner);
337#endif
338
339 DebugLex debugLex(Debug::Lex_declinfo,__FILE__, NULL);
340 yyextra->inputString = decl.data();
341 //printf("Input='%s'\n",yyextra->inputString);
342 yyextra->inputPosition = 0;
343 yyextra->classTempListFound = false;
344 yyextra->funcTempListFound = false;
345 yyextra->insideObjC = lang==SrcLangExt::ObjC;
346 yyextra->insidePHP = lang==SrcLangExt::PHP;
347 yyextra->insidePython = lang==SrcLangExt::Python;
348 yyextra->scope.clear();
349 yyextra->className.clear();
350 yyextra->classTempList.clear();
351 yyextra->funcTempList.clear();
352 yyextra->name.clear();
353 yyextra->type.clear();
354 yyextra->args.clear();
355 yyextra->exceptionString.clear();
356 // first we try to find the yyextra->type, yyextra->scope, yyextra->name and arguments
357 declinfoYYrestart( yyin, g_yyscanner );
358 BEGIN( Start );
359 declinfoYYlex(g_yyscanner);
360
361 //printf("yyextra->type='%s' class='%s' yyextra->name='%s' yyextra->args='%s'\n",
362 // qPrint(yyextra->type),qPrint(yyextra->scope),qPrint(yyextra->name),qPrint(yyextra->args));
363
364 if (size_t nb = yyextra->name.rfind('[') ; nb!=DString::npos && yyextra->args.empty()) // correct for [] in yyextra->name ambiguity (due to Java return yyextra->type allowing [])
365 {
366 yyextra->args.prepend(yyextra->name.mid(nb));
367 yyextra->name=yyextra->name.left(nb);
368 }
369
370 cl=yyextra->scope;
371 n=removeRedundantWhiteSpace(yyextra->name);
372 size_t il=n.find('<'), ir=n.rfind('>');
373 if (il!=DString::npos && ir!=DString::npos && n.at(il+1)!='=')
374 // prevent <=>
375 // TODO: handle cases like where n="operator<< <T>"
376 {
377 ftl=removeRedundantWhiteSpace(n.mid(il));
378 n=n.left(il);
379 }
380
381 //ctl=yyextra->classTempList.copy();
382 //ftl=yyextra->funcTempList.copy();
383 t=removeRedundantWhiteSpace(yyextra->type);
384 a=removeRedundantWhiteSpace(yyextra->args);
385 exc=removeRedundantWhiteSpace(yyextra->exceptionString);
386
387 if (!t.empty() && !t.startsWith("decltype") && t.at(t.length()-1)==')') // for function pointers
388 {
389 a.prepend(")");
390 t=t.left(t.length()-1);
391 }
392 //printf("yyextra->type='%s' class='%s' yyextra->name='%s' yyextra->args='%s'\n",
393 // qPrint(t),qPrint(cl),qPrint(n),qPrint(a));
394
395 declinfoYYlex_destroy(g_yyscanner);
396 return;
397}
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:152
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
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
@ Lex_declinfo
Definition debug.h:59
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:133
static yyscan_t g_yyscanner
Definition declinfo.l:322
static struct declinfoYY_state g_declinfo_extra
Definition declinfo.l:323
DString removeRedundantWhiteSpace(const DString &s)
Definition util.cpp:428

References DString::at(), DString::data(), DString::empty(), DString::find(), g_declinfo_extra, g_yyscanner, Debug::isFlagSet(), DString::left(), DString::length(), Debug::Lex_declinfo, DString::mid(), DString::npos, parseFuncDecl(), DString::prepend(), removeRedundantWhiteSpace(), DString::rfind(), and DString::startsWith().

Referenced by findMember(), and parseFuncDecl().