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 318 of file declinfo.l.

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

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, DString::prepend(), removeRedundantWhiteSpace(), DString::rfind(), and DString::startsWith().

Referenced by findMember().