15%option never-interactive
16%option prefix="declinfoYY"
20%option extra-type="struct declinfoYY_state *"
24#define YY_TYPEDEF_YY_SCANNER_T
41#define YY_NO_UNISTD_H 1
42#define YY_NEVER_INTERACTIVE 1
78#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner);
82#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.
88ID ([$a-z_A-Z\x80-\xFF][$a-z_A-Z0-9\x80-\xFF]*)|(@[0-9]+)
99<Start>"operator"/({B}*"["{B}*"]")* {
100 yyextra->name += yytext;
103<Start>{ID}({B}*"*")?{B}*"("{B}*"^"{B}*")"{B}*"(" {
104 if (!yyextra->insideObjC)
111 yyextra->type += yytext;
114<Start>{ID}{B}*"("{B}*{ID}{B}*")" {
115 if (!yyextra->insideObjC)
121 yyextra->name += yytext;
124<Start>([~!]{B}*)?{ID}{B}*"["{B}*"]" {
125 if (!yyextra->insidePHP)
DString removeRedundantWhiteSpace(const DString &s)
132<Start>"anonymous_namespace{"[^}]+"}" {
133 if (!yyextra->scope.empty())
135 yyextra->scope+=
DString(
"::")+yytext;
139 yyextra->scope = yytext;
142<Start>([~!]{B}*)?{ID}/({B}*"["{B}*"]")* {
151 if (!yyextra->scope.empty() && !yyextra->scope.endsWith(
"::"))
153 if (!yyextra->name.empty()) yyextra->scope+=
"::"+yyextra->name;
157 yyextra->scope = yyextra->name;
159 yyextra->name.clear();
162 yyextra->name+=yytext;
166 yyextra->type+=yytext;
171<Start>{B}*"("({ID}"::")*{B}*[&*]({B}*("const"|"volatile"){B}+)? {
172 if (yyextra->insidePHP) REJECT;
173 if (yyextra->insidePython) REJECT;
176 yyextra->type+=text.stripWhiteSpace();
181<Start>{B}*"const"/{B}+ |
182<Start>{B}*"consteval"/{B}+ |
183<Start>{B}*"constinit"/{B}+ |
184<Start>{B}*"constexpr"/{B}+ {
185 if (!yyextra->type.empty()) yyextra->type+=
" ";
186 yyextra->type+=yytext;
188<Start>{B}*"decltype"/{B}*"(" {
189 yyextra->roundCount=0;
190 if (!yyextra->type.empty()) yyextra->type+=
" ";
191 yyextra->type+=
"decltype";
195 ++yyextra->roundCount;
200 if (--yyextra->roundCount == 0) {
205 yyextra->type+=yytext;
217 yyextra->sharpCount=0;
218 yyextra->roundCount=0;
221<Template>"<<" { yyextra->name+=
"<<"; }
222<Template>">>" { yyextra->name+=
">>"; }
223<Template>"(" { yyextra->name+=
"(";
224 yyextra->roundCount++;
226<Template>")" { yyextra->name+=
")";
227 if (yyextra->roundCount>0)
229 yyextra->roundCount--;
234 if (yyextra->roundCount==0)
236 yyextra->sharpCount++;
241 if (yyextra->roundCount==0)
243 if (yyextra->sharpCount)
244 --yyextra->sharpCount;
252 yyextra->name+=*yytext;
254<Operator>{B}*"("{B}*")"{B}*"<>"{Bopt}/"(" {
255 yyextra->name+=
"() <>";
258<Operator>{B}*"("{B}*")"{Bopt}/"(" {
262<Operator>[^(]*{B}*("<>"{B}*)?/"(" {
263 yyextra->name+=yytext;
266<ReadArgs>"throw"{B}*"(" {
267 yyextra->exceptionString=
"throw(";
268 BEGIN(ReadExceptions);
271 yyextra->args+=*yytext;
274 yyextra->exceptionString+=*yytext;
283 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
286 if (yyextra->name.empty() && yyextra->scope.empty())
290 if (!yyextra->type.empty()) yyextra->type+=
" ";
291 if (!yyextra->scope.empty()) yyextra->type+=yyextra->scope+
"::";
292 yyextra->type+=yyextra->name;
293 yyextra->scope.clear();
294 yyextra->name.clear();
299 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
302 if (yyextra->name.empty() ||
303 yyextra->name.at(yyextra->name.length()-1)==
':')
307 if (!yyextra->type.empty()) yyextra->type+=
' ';
308 yyextra->type+=yyextra->name;
309 yyextra->name.clear();
314 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
316 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
318 *buf = yyextra->inputString[yyextra->inputPosition++] ;
337 struct yyguts_t *yyg = (
struct yyguts_t*)
g_yyscanner;
344 yyextra->inputString = decl.
data();
346 yyextra->inputPosition = 0;
347 yyextra->classTempListFound =
false;
348 yyextra->funcTempListFound =
false;
349 yyextra->insideObjC = lang==SrcLangExt::ObjC;
350 yyextra->insidePHP = lang==SrcLangExt::PHP;
351 yyextra->insidePython = lang==SrcLangExt::Python;
352 yyextra->scope.clear();
353 yyextra->className.clear();
354 yyextra->classTempList.clear();
355 yyextra->funcTempList.clear();
356 yyextra->name.clear();
357 yyextra->type.clear();
358 yyextra->args.clear();
359 yyextra->exceptionString.clear();
368 if (
size_t nb = yyextra->name.rfind(
'[') ; nb!=
DString::npos && yyextra->args.empty())
370 yyextra->args.prepend(yyextra->name.mid(nb));
371 yyextra->name=yyextra->name.left(nb);
392 if (!t.
empty() && t.
at(len-1)==
')')
395 size_t pos = t.
find(
"decltype(");
399 for (
size_t i = pos + 9; i < len; i++)
401 if (t.
at(i) ==
'(') cnt++;
402 else if (t.
at(i) ==
')')
430void dumpDecl(
const char *s)
438 msg(
"-----------------------------------------\n");
439 parseFuncDecl(s,yyextra->className,classTNames,yyextra->type,yyextra->name,yyextra->args,funcTNames);
440 msg(
"yyextra->type='{}' class='{}' classTempl='{}' yyextra->name='{}' "
441 "funcTemplateNames='{}' yyextra->args='{}'\n",
442 yyextra->type,yyextra->className,classTNames,
443 yyextra->name,funcTNames,yyextra->args
450 dumpDecl(
"A < T > :: Value * A < T > :: getValue < S > ( const A < T > & a )");
451 dumpDecl(
"const A<T>::Value* A<T>::getValue<S>(const A<T>&a)");
453 dumpDecl(
"friend void bla<>()");
454 dumpDecl(
"yyextra->name< T > :: operator () (int bla)");
455 dumpDecl(
"yyextra->name< T > :: operator << (int bla)");
456 dumpDecl(
"yyextra->name< T > :: operator << <> (int bla)");
457 dumpDecl(
"yyextra->className::func()");
458 dumpDecl(
"void ( * yyextra->Name < T > :: bla ) ( int, char * )");
462#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)