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}*"decltype"/{B}*"(" {
182 yyextra->roundCount=0;
183 yyextra->type=
"decltype";
187 ++yyextra->roundCount;
192 if (--yyextra->roundCount == 0) {
197 yyextra->type+=yytext;
209 yyextra->sharpCount=0;
210 yyextra->roundCount=0;
213<Template>"<<" { yyextra->name+=
"<<"; }
214<Template>">>" { yyextra->name+=
">>"; }
215<Template>"(" { yyextra->name+=
"(";
216 yyextra->roundCount++;
218<Template>")" { yyextra->name+=
")";
219 if (yyextra->roundCount>0)
221 yyextra->roundCount--;
226 if (yyextra->roundCount==0)
228 yyextra->sharpCount++;
233 if (yyextra->roundCount==0)
235 if (yyextra->sharpCount)
236 --yyextra->sharpCount;
244 yyextra->name+=*yytext;
246<Operator>{B}*"("{B}*")"{B}*"<>"{Bopt}/"(" {
247 yyextra->name+=
"() <>";
250<Operator>{B}*"("{B}*")"{Bopt}/"(" {
254<Operator>[^(]*{B}*("<>"{B}*)?/"(" {
255 yyextra->name+=yytext;
258<ReadArgs>"throw"{B}*"(" {
259 yyextra->exceptionString=
"throw(";
260 BEGIN(ReadExceptions);
263 yyextra->args+=*yytext;
266 yyextra->exceptionString+=*yytext;
275 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
278 if (yyextra->name.empty() && yyextra->scope.empty())
return;
279 if (!yyextra->type.empty()) yyextra->type+=
" ";
280 if (!yyextra->scope.empty()) yyextra->type+=yyextra->scope+
"::";
281 yyextra->type+=yyextra->name;
282 yyextra->scope.clear();
283 yyextra->name.clear();
288 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
291 if (yyextra->name.empty() ||
292 yyextra->name.at(yyextra->name.length()-1)==
':')
296 if (!yyextra->type.empty()) yyextra->type+=
' ';
297 yyextra->type+=yyextra->name;
298 yyextra->name.clear();
303 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
305 while( c < max_size && yyextra->inputString[yyextra->inputPosition] )
307 *buf = yyextra->inputString[yyextra->inputPosition++] ;
326 struct yyguts_t *yyg = (
struct yyguts_t*)
g_yyscanner;
333 yyextra->inputString = decl.
data();
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();
357 if (
size_t nb = yyextra->name.rfind(
'[') ; nb!=
DString::npos && yyextra->args.empty())
359 yyextra->args.prepend(yyextra->name.mid(nb));
360 yyextra->name=yyextra->name.left(nb);
393void dumpDecl(
const char *s)
401 msg(
"-----------------------------------------\n");
402 parseFuncDecl(s,yyextra->className,classTNames,yyextra->type,yyextra->name,yyextra->args,funcTNames);
403 msg(
"yyextra->type='{}' class='{}' classTempl='{}' yyextra->name='{}' "
404 "funcTemplateNames='{}' yyextra->args='{}'\n",
405 yyextra->type,yyextra->className,classTNames,
406 yyextra->name,funcTNames,yyextra->args
413 dumpDecl(
"A < T > :: Value * A < T > :: getValue < S > ( const A < T > & a )");
414 dumpDecl(
"const A<T>::Value* A<T>::getValue<S>(const A<T>&a)");
416 dumpDecl(
"friend void bla<>()");
417 dumpDecl(
"yyextra->name< T > :: operator () (int bla)");
418 dumpDecl(
"yyextra->name< T > :: operator << (int bla)");
419 dumpDecl(
"yyextra->name< T > :: operator << <> (int bla)");
420 dumpDecl(
"yyextra->className::func()");
421 dumpDecl(
"void ( * yyextra->Name < T > :: bla ) ( int, char * )");
425#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.
bool startsWith(const char *s) const
size_t length() const
Returns the length of the string, not counting the 0-terminator.
static bool isFlagSet(const DebugMask mask)
static int yyread(char *buf, int max_size, yyscan_t yyscanner)
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)