15%option never-interactive
16%option prefix="declinfoYY"
20%option extra-type="struct declinfoYY_state *"
24#define YY_TYPEDEF_YY_SCANNER_T
25#define yyguts_t declinfoYYguts_t
42#define YY_NO_UNISTD_H 1
43#define YY_NEVER_INTERACTIVE 1
79#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner);
83#define LEX_NO_INPUT_FILENAME
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
static int yyread(char *buf, int max_size, yyscan_t yyscanner)
static void addTypeName(yyscan_t yyscanner)
static const char * stateToString(int state)
static const char * getLexerFILE()
static void addType(yyscan_t yyscanner)
This file contains a number of basic enums and types.
A bunch of utility functions.
89ID ([$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+)
100<Start>"operator"/({B}*"["{B}*"]")* {
101 yyextra->name += yytext;
104<Start>{ID}({B}*"*")?{B}*"("{B}*"^"{B}*")"{B}*"(" {
105 if (!yyextra->insideObjC)
112 yyextra->type += yytext;
115<Start>{ID}{B}*"("{B}*{ID}{B}*")" {
116 if (!yyextra->insideObjC)
122 yyextra->name += yytext;
125<Start>([~!]{B}*)?{ID}{B}*"["{B}*"]" {
126 if (!yyextra->insidePHP)
DString removeRedundantWhiteSpace(const DString &s)
133<Start>"anonymous_namespace{"[^}]+"}" {
134 if (!yyextra->scope.empty())
136 yyextra->scope+=
DString(
"::")+yytext;
140 yyextra->scope = yytext;
143<Start>([~!]{B}*)?{ID}/({B}*"["{B}*"]")* {
152 if (!yyextra->scope.empty() && !yyextra->scope.endsWith(
"::"))
154 if (!yyextra->name.empty()) yyextra->scope+=
"::"+yyextra->name;
158 yyextra->scope = yyextra->name;
160 yyextra->name.clear();
163 yyextra->name+=yytext;
167 yyextra->type+=yytext;
172<Start>{B}*"("({ID}"::")*{B}*[&*]({B}*("const"|"volatile"){B}+)? {
173 if (yyextra->insidePHP) REJECT;
174 if (yyextra->insidePython) REJECT;
177 yyextra->type+=text.stripWhiteSpace();
182<Start>{B}*"const"/{B}+ |
183<Start>{B}*"consteval"/{B}+ |
184<Start>{B}*"constinit"/{B}+ |
185<Start>{B}*"constexpr"/{B}+ {
186 if (!yyextra->type.empty()) yyextra->type+=
" ";
187 yyextra->type+=yytext;
189<Start>{B}*"decltype"/{B}*"(" {
190 yyextra->roundCount=0;
191 if (!yyextra->type.empty()) yyextra->type+=
" ";
192 yyextra->type+=
"decltype";
196 ++yyextra->roundCount;
201 if (--yyextra->roundCount == 0) {
206 yyextra->type+=yytext;
218 yyextra->sharpCount=0;
219 yyextra->roundCount=0;
222<Template>"<<" { yyextra->name+=
"<<"; }
223<Template>">>" { yyextra->name+=
">>"; }
224<Template>"(" { yyextra->name+=
"(";
225 yyextra->roundCount++;
227<Template>")" { yyextra->name+=
")";
228 if (yyextra->roundCount>0)
230 yyextra->roundCount--;
235 if (yyextra->roundCount==0)
237 yyextra->sharpCount++;
242 if (yyextra->roundCount==0)
244 if (yyextra->sharpCount)
245 --yyextra->sharpCount;
253 yyextra->name+=*yytext;
255<Operator>{B}*"("{B}*")"{B}*"<>"{Bopt}/"(" {
256 yyextra->name+=
"() <>";
259<Operator>{B}*"("{B}*")"{Bopt}/"(" {
263<Operator>[^(]*{B}*("<>"{B}*)?/"(" {
264 yyextra->name+=yytext;
267<ReadArgs>"throw"{B}*"(" {
268 yyextra->exceptionString=
"throw(";
269 BEGIN(ReadExceptions);
272 yyextra->args+=*yytext;
275 yyextra->exceptionString+=*yytext;
287 if (yyextra->name.empty() && yyextra->scope.empty())
291 if (!yyextra->type.empty()) yyextra->type+=
" ";
292 if (!yyextra->scope.empty()) yyextra->type+=yyextra->scope+
"::";
293 yyextra->type+=yyextra->name;
294 yyextra->scope.clear();
295 yyextra->name.clear();
303 if (yyextra->name.empty() ||
304 yyextra->name.at(yyextra->name.length()-1)==
':')
308 if (!yyextra->type.empty()) yyextra->type+=
' ';
309 yyextra->type+=yyextra->name;
310 yyextra->name.clear();
317 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
319 *buf = yyextra->inputString[yyextra->inputPosition++] ;
345 yyextra->inputString = decl.
data();
347 yyextra->inputPosition = 0;
348 yyextra->classTempListFound =
false;
349 yyextra->funcTempListFound =
false;
350 yyextra->insideObjC = lang==SrcLangExt::ObjC;
351 yyextra->insidePHP = lang==SrcLangExt::PHP;
352 yyextra->insidePython = lang==SrcLangExt::Python;
353 yyextra->scope.clear();
354 yyextra->className.clear();
355 yyextra->classTempList.clear();
356 yyextra->funcTempList.clear();
357 yyextra->name.clear();
358 yyextra->type.clear();
359 yyextra->args.clear();
360 yyextra->exceptionString.clear();
369 if (
size_t nb = yyextra->name.rfind(
'[') ; nb!=
DString::npos && yyextra->args.empty())
371 yyextra->args.prepend(yyextra->name.mid(nb));
372 yyextra->name=yyextra->name.left(nb);
393 if (!t.
empty() && t.
at(len-1)==
')')
396 size_t pos = t.
find(
"decltype(");
400 for (
size_t i = pos + 9; i < len; i++)
402 if (t.
at(i) ==
'(') cnt++;
403 else if (t.
at(i) ==
')')
431void dumpDecl(
const char *s)
439 msg(
"-----------------------------------------\n");
440 parseFuncDecl(s,yyextra->className,classTNames,yyextra->type,yyextra->name,yyextra->args,funcTNames);
441 msg(
"yyextra->type='{}' class='{}' classTempl='{}' yyextra->name='{}' "
442 "funcTemplateNames='{}' yyextra->args='{}'\n",
443 yyextra->type,yyextra->className,classTNames,
444 yyextra->name,funcTNames,yyextra->args
451 dumpDecl(
"A < T > :: Value * A < T > :: getValue < S > ( const A < T > & a )");
452 dumpDecl(
"const A<T>::Value* A<T>::getValue<S>(const A<T>&a)");
454 dumpDecl(
"friend void bla<>()");
455 dumpDecl(
"yyextra->name< T > :: operator () (int bla)");
456 dumpDecl(
"yyextra->name< T > :: operator << (int bla)");
457 dumpDecl(
"yyextra->name< T > :: operator << <> (int bla)");
458 dumpDecl(
"yyextra->className::func()");
459 dumpDecl(
"void ( * yyextra->Name < T > :: bla ) ( int, char * )");
463#include "declinfo.l.h"
size_t rfind(char c, size_t pos=npos) const
DString mid(size_t index, size_t len=npos) const
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
char & at(size_t i)
Returns a reference to the character at index i.
DString & prepend(const char *s)
size_t find(char c, size_t pos=0) const
DString left(size_t len) const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
size_t length() const
Returns the length of the string, not counting the 0-terminator.
static bool isFlagSet(const DebugMask mask)
void parseFuncDecl(const DString &decl, const SrcLangExt lang, DString &clName, DString &type, DString &name, DString &args, DString &funcTempList, DString &exceptions)
static yyscan_t g_yyscanner
static struct declinfoYY_state g_declinfo_extra
int main(int argc, char **argv)