22%option never-interactive
23%option prefix="pyscannerYY"
25%option extra-type="struct pyscannerYY_state *"
29#define YY_TYPEDEF_YY_SCANNER_T
60#define DBG_CTX(x) do { } while(0)
63#define YY_NO_UNISTD_H 1
65#define unput_string(yytext,yyleng) do { for (int i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); } while(0)
162#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Abstract interface for outline parsers.
Text streaming class that buffers data.
std::unordered_map< std::string, std::string > StringUnorderedMap
#define lineCount(s, len)
static void newEntry(yyscan_t yyscanner)
static void incLineNr(yyscan_t yyscanner)
static void docVariable(yyscan_t yyscanner, const char *s)
static void initSpecialBlock(yyscan_t yyscanner)
static void handleParamComment(yyscan_t yyscanner, const DString &doc)
static void initTriSingleQuoteBlock(yyscan_t yyscanner)
static int computeIndent(const char *s)
static void searchFoundTypeAlias(yyscan_t yyscanner)
static void addFrom(yyscan_t yyscanner, bool all)
static void setProtection(yyscan_t yyscanner)
static void initParser(yyscan_t yyscanner)
static void endOfDef(yyscan_t yyscanner, int correction=0)
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
static void searchFoundClass(yyscan_t yyscanner)
static const char * stateToString(int state)
static DString findPackageScope(yyscan_t yyscanner, const DString &fileName)
static void newVariable(yyscan_t yyscanner)
static void newTypeAlias(yyscan_t yyscanner)
static void initTriDoubleQuoteBlock(yyscan_t yyscanner)
static void searchFoundDef(yyscan_t yyscanner)
static void addEntry(yyscan_t yyscanner)
static const char * getLexerFILE()
static void startCommentBlock(yyscan_t yyscanner, bool brief)
static void newFunction(yyscan_t yyscanner)
static DString findPackageScopeFromPath(yyscan_t yyscanner, const DString &path)
static void addVariable(yyscan_t yyscanner)
static void handleCommentBlock(yyscan_t yyscanner, const DString &doc, bool brief)
static void addToString(yyscan_t yyscanner, const char *s)
static void initEntry(yyscan_t yyscanner)
Some helper functions for std::string.
std::vector< DString > decorators
std::shared_ptr< Entry > previous
std::shared_ptr< Entry > current
StringUnorderedMap packageNameCache
std::shared_ptr< Entry > bodyEntry
TextStream decoratorCommentStr
std::shared_ptr< Entry > current_root
bool packageCommentAllowed
OutlineParserInterface * thisParser
CommentScanner commentScanner
A bunch of utility functions.
179HEXNUMBER "0"[xX][0-9a-fA-F]+[lL]?
180OCTNUMBER "0"[0-7]+[lL]?
181NUMBER {DIGIT}+[lLjJ]?
182INTNUMBER {HEXNUMBER}|{OCTNUMBER}|{NUMBER}
183FLOATNUMBER {DIGIT}+"."{DIGIT}+([eE][+\-]?{DIGIT}+)?[jJ]?
185LETTER [A-Za-z\x80-\xFF]
186NONEMPTY [A-Za-z0-9_\x80-\xFF]
187EXPCHAR [#(){}\[\],:.%/\\=`*~|&<>!;+-]
188PARAMNONEMPTY [^ \t\n():]
189IDENTIFIER ({LETTER}|"_")({LETTER}|{DIGIT}|"_")*
190SCOPE {IDENTIFIER}("."{IDENTIFIER})*
192TRISINGLEQUOTE {STRINGPREFIX}?"'''"(!)?
193TRIDOUBLEQUOTE {STRINGPREFIX}?"\"\"\""(!)?
194ENDTRISINGLEQUOTE "'''"
195ENDTRIDOUBLEQUOTE "\"\"\""
196LONGSTRINGCHAR [^\\"']
198LONGSTRINGITEM ({LONGSTRINGCHAR}|{ESCAPESEQ})
199SMALLQUOTE ("\"\""|"\""|"'"|"''")
200LONGSTRINGBLOCK ({LONGSTRINGITEM}|{SMALLQUOTE})
202STRINGPREFIX ("r"|"u"|"ur"|"R"|"U"|"UR"|"Ur"|"uR")
203POUNDCOMMENT "#"[^#\n][^\n]*
208LINENR {B}*[1-9][0-9]*
209FILEICHAR [a-z_A-Z0-9\x80-\xFF\\:\\\/\-\+=&#@~]
210FILEECHAR [a-z_A-Z0-9\x80-\xFF\-\+=&#@~]
211FILECHARS {FILEICHAR}*{FILEECHAR}+
212HFILEMASK {FILEICHAR}*("."{FILEICHAR}+)+{FILECHARS}*
213VFILEMASK {FILECHARS}("."{FILECHARS})*
214FILEMASK {VFILEMASK}|{HFILEMASK}
217ID [a-z_A-Z%]+{IDSYM}*
240%x FunctionTypeAnnotation
241%x FunctionParamDefVal
260%x SingleQuoteStringIgnore
261%x DoubleQuoteStringIgnore
286 DBG_CTX((stderr,
"Found def at %d\n",yyextra->yyLineNr));
289 BEGIN( FunctionDec );
static int computeIndent(const char *s)
291 ^{B}"async"{BB}"def"{BB} {
292 DBG_CTX((stderr,
"Found async def at %d\n",yyextra->yyLineNr));
295 BEGIN( FunctionDec );
299 BEGIN( FunctionDec );
301 "async"{BB}"def"{BB} {
303 BEGIN( FunctionDec );
307 DBG_CTX((stderr,
"Found class at %d\n",yyextra->yyLineNr));
327 yyextra->packageCommentAllowed =
false;
333 yyextra->packageCommentAllowed =
false;
336 ^{B}{IDENTIFIER}/{B}"="{B}"property" {
337 yyextra->current->section = EntryType::makeVariable();
338 yyextra->current->mtype = MethodTypes::Property;
340 yyextra->current->fileName = yyextra->fileName;
341 yyextra->current->startLine = yyextra->yyLineNr;
342 yyextra->current->bodyLine = yyextra->yyLineNr;
343 yyextra->packageCommentAllowed =
false;
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
346 ^{B}{IDENTIFIER}/{B}"="[^=] {
347 if (yyextra->searchCount>0) REJECT;
349 yyextra->current->section = EntryType::makeVariable();
351 yyextra->current->fileName = yyextra->fileName;
352 yyextra->current->startLine = yyextra->yyLineNr;
353 yyextra->current->bodyLine = yyextra->yyLineNr;
354 yyextra->packageCommentAllowed =
false;
357 ^{B}{IDENTIFIER}/{B}":" {
358 if (yyextra->searchCount>0) REJECT;
360 if (
id ==
"try" ||
id ==
"else" ||
id ==
"except" ||
id ==
"finally") REJECT;
362 yyextra->current->section = EntryType::makeVariable();
363 yyextra->current->name = id;
364 yyextra->current->fileName = yyextra->fileName;
365 yyextra->current->startLine = yyextra->yyLineNr;
366 yyextra->current->bodyLine = yyextra->yyLineNr;
367 yyextra->packageCommentAllowed =
false;
370 {B}{IDENTIFIER}/({B},{B}{IDENTIFIER})*{B}")"*{B}"="[^=] {
374 if (yyextra->searchCount>1) REJECT;
376 yyextra->current->section = EntryType::makeVariable();
378 yyextra->current->fileName = yyextra->fileName;
379 yyextra->current->startLine = yyextra->yyLineNr;
380 yyextra->current->bodyLine = yyextra->yyLineNr;
381 yyextra->packageCommentAllowed =
false;
385 yyextra->stringContext=YY_START;
386 yyextra->copyString=
nullptr;
387 yyextra->packageCommentAllowed =
false;
388 BEGIN( SingleQuoteString );
391 yyextra->stringContext=YY_START;
392 yyextra->copyString=
nullptr;
393 yyextra->packageCommentAllowed =
false;
394 BEGIN( DoubleQuoteString );
397 yyextra->isStatic=
true;
401 yyextra->decoratorRound = 1;
402 yyextra->copyString=
nullptr;
409 if (yyextra->yyLineNr != 1) REJECT;
416 yyextra->packageCommentAllowed =
false;
428 BEGIN(TripleComment);
433 BEGIN(TripleComment);
436 {B}{STARTDOCSYMS}/[^#] {
438 yyextra->packageCommentAllowed =
false;
440 BEGIN(SpecialComment);
443 yyextra->searchCount++;
446 if (yyextra->searchCount>0)
448 yyextra->searchCount--;
452 yyextra->current->doc.clear();
453 yyextra->current->brief.clear();
467 {IDENTIFIER}({B}"."{B}{IDENTIFIER})* {
468 yyextra->packageName=yytext;
490 {IDENTIFIER}/{B}","{B} {
493 {IDENTIFIER}/{B}")" {
498 if (!yyextra->importTuple)
505 if (!yyextra->importTuple)
513 yyextra->importTuple=
true;
516 yyextra->importTuple=
false;
531 {IDENTIFIER}({B}"."{B}{IDENTIFIER})* {
533 yyextra->current->fileName = yyextra->fileName;
535 yyextra->current->section=EntryType::makeUsingDecl();
536 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
DString substitute(const DString &s, const DString &src, const DString &dst)
substitute all occurrences of src in s by dst
static void initEntry(yyscan_t yyscanner)
DString removeRedundantWhiteSpace(const DString &s)
553 ("cls"|"self")"."{IDENTIFIER}/{B}[,)] {
554 const char *s = strchr(yytext,
'.'); s++;
555 DBG_CTX((stderr,
"Found instance method variable %s in %s at %d\n",s,
qPrint(yyextra->current_root->name.data(),yyextra->yyLineNr)));
const char * qPrint(const char *s)
559 ("cls"|"self")"."{IDENTIFIER}/{B}"=" {
560 const char *s = strchr(yytext,
'.'); s++;
561 DBG_CTX((stderr,
"Found instance method variable %s in %s at %d\n",s,
qPrint(yyextra->current_root->name.data(),yyextra->yyLineNr)));
563 BEGIN( SearchSkipValue );
565 ("cls"|"self")"."{IDENTIFIER}/{B}":" {
566 const char *s = strchr(yytext,
'.'); s++;
567 DBG_CTX((stderr,
"Found instance method variable %s in %s at %d\n",s,
qPrint(yyextra->current_root->name.data(),yyextra->yyLineNr)));
573 BEGIN(TripleComment);
578 BEGIN(TripleComment);
581 {STARTDOCSYMS}/[^#] {
583 BEGIN(SpecialComment);
588 yyextra->stringContext=YY_START;
589 yyextra->copyString=
nullptr;
590 BEGIN( SingleQuoteString );
593 yyextra->stringContext=YY_START;
594 yyextra->copyString=
nullptr;
595 BEGIN( DoubleQuoteString );
599 yyextra->current->doc.clear();
600 yyextra->current->brief.clear();
602 BEGIN( SearchSkipValue );
611 yyextra->braceCount=0;
614 yyextra->current->type+=*yytext;
615 yyextra->braceCount++;
618 yyextra->current->type+=*yytext;
619 yyextra->braceCount--;
622 yyextra->stringContext=YY_START;
623 yyextra->copyString=
nullptr;
624 BEGIN( SingleQuoteString );
627 yyextra->stringContext=YY_START;
628 yyextra->copyString=
nullptr;
629 BEGIN( DoubleQuoteString );
632 if (yyextra->braceCount==0)
634 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
636 BEGIN(SearchSkipValue);
640 yyextra->current->type+=*yytext;
644 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
647 BEGIN(SearchMemVars);
650 yyextra->current->type+=
' ';
654 yyextra->current->type+=*yytext;
658<SearchSkipValue,VariableDec,TypeValue>{
661 yyextra->startInit =
true;
662 if (YY_START!=TypeValue)
664 yyextra->current->initializer.str(yytext);
665 yyextra->current->initializer <<
" ";
669 yyextra->current->initializer << yytext;
673 if (yyextra->current->type.empty()) yyextra->current->type =
"int";
674 yyextra->current->initializer << yytext;
677 if (yyextra->current->type.empty()) yyextra->current->type =
"float";
678 yyextra->current->initializer << yytext;
681 if (yyextra->current->type.empty()) yyextra->current->type =
"bool";
682 yyextra->current->initializer << yytext;
685 if (yyextra->current->type.empty()) yyextra->current->type =
"str";
686 yyextra->current->initializer << yytext;
687 yyextra->copyString=&yyextra->current->initializer;
688 yyextra->stringContext=YY_START;
689 BEGIN( SingleQuoteString );
691 {STRINGPREFIX}?"\"" {
692 if (yyextra->current->type.empty()) yyextra->current->type =
"str";
693 yyextra->current->initializer << yytext;
694 yyextra->copyString=&yyextra->current->initializer;
695 yyextra->stringContext=YY_START;
696 BEGIN( DoubleQuoteString );
699 if (yyextra->current->type.empty()) yyextra->current->type =
"str";
700 yyextra->current->initializer << yytext;
701 yyextra->doubleQuote=
true;
702 yyextra->copyString=&yyextra->current->initializer;
703 yyextra->stringContext=YY_START;
708 if (yyextra->current->type.empty()) yyextra->current->type =
"str";
709 yyextra->current->initializer << yytext;
710 yyextra->doubleQuote=
false;
711 yyextra->copyString=&yyextra->current->initializer;
712 yyextra->stringContext=YY_START;
716 if (yyextra->current->mtype!=MethodTypes::Property && yyextra->startInit)
718 yyextra->current->type =
"tuple";
720 yyextra->current->initializer << *yytext;
721 yyextra->atomStart=
'(';
722 yyextra->atomEnd=
')';
723 yyextra->atomCount=1;
724 yyextra->atomContext=YY_START;
725 BEGIN( VariableAtom );
728 if (yyextra->startInit) yyextra->current->type =
"list";
729 yyextra->current->initializer << *yytext;
730 yyextra->atomStart=
'[';
731 yyextra->atomEnd=
']';
732 yyextra->atomCount=1;
733 yyextra->atomContext=YY_START;
734 BEGIN( VariableAtom );
737 if (yyextra->startInit) yyextra->current->type =
"dict";
738 yyextra->current->initializer << *yytext;
739 yyextra->atomStart=
'{';
740 yyextra->atomEnd=
'}';
741 yyextra->atomCount=1;
742 yyextra->atomContext=YY_START;
743 BEGIN( VariableAtom );
746 yyextra->current->initializer << yytext;
751 if (yyextra->current->type.empty())
753 for (
const auto &child : yyextra->current_root->children())
755 if (child->name == yytext)
757 yyextra->current->type = child->type;
762 yyextra->startInit =
false;
763 yyextra->current->initializer << yytext;
766 yyextra->startInit =
false;
767 yyextra->current->initializer << *yytext;
771 {STARTDOCSYMS}/[^#] {
773 BEGIN(SpecialComment);
779 BEGIN(SearchMemVars);
783 BEGIN(SearchMemVars);
788 \n{B}/{IDENTIFIER}[^{LETTER}{DIGIT}_] {
800 yyextra->current->program << yytext;
814 yyextra->current->program << yytext;
822 yyextra->current->program << yytext;
826 if (yyextra->curIndent<=yyextra->indent)
834 yyextra->current->program << yytext;
838 yyextra->current->program << yytext;
839 yyextra->stringContext=YY_START;
840 yyextra->specialBlock =
false;
841 yyextra->copyString=&yyextra->current->program;
842 BEGIN( SingleQuoteString );
845 yyextra->current->program << yytext;
846 yyextra->stringContext=YY_START;
847 yyextra->specialBlock =
false;
848 yyextra->copyString=&yyextra->current->program;
849 BEGIN( DoubleQuoteString );
852 yyextra->current->program << yytext;
853 yyextra->specialBlock =
false;
856 yyextra->current->program << yytext;
859 yyextra->current->program << yytext;
863 yyextra->current->program << yytext;
866 yyextra->current->program << *yytext;
867 yyextra->specialBlock =
false;
871 yyextra->current->program << yytext;
873 BEGIN(TripleComment);
877 yyextra->current->program << yytext;
879 BEGIN(TripleComment);
887 yyextra->current->name = yytext;
888 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
892 yyextra->specialBlock =
true;
893 yyextra->bodyEntry = yyextra->current;
894 yyextra->current->bodyLine = yyextra->yyLineNr;
898 yyextra->genericsContext = YY_START;
899 yyextra->bracketDepth = 1;
900 yyextra->genericsValue =
"[";
904 yyextra->defVal.str(std::string());
905 yyextra->braceCount = 0;
906 BEGIN(FunctionTypeAnnotation);
909 yyextra->funcParamsEnd =
false;
910 yyextra->current->bodyLine = yyextra->yyLineNr;
911 BEGIN(FunctionParams);
914 if (yyextra->current->argList.empty())
916 yyextra->current->argList.setNoParameters(
true);
919 yyextra->funcParamsEnd =
true;
DString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
925 yyextra->genericsValue+=yytext;
928 yyextra->genericsValue+=yytext;
929 yyextra->bracketDepth++;
932 yyextra->genericsValue+=yytext;
933 yyextra->bracketDepth--;
934 if (yyextra->bracketDepth==0)
936 BEGIN(yyextra->genericsContext);
940 yyextra->genericsValue+=yytext;
949 if (!yyextra->argType.empty())
953 a.
type = yyextra->argType;
955 yyextra->argType =
"";
This class contains the information about the argument of a function or template.
960 yyextra->argType = yytext;
966 a.
type = yyextra->argType;
968 yyextra->argType =
"";
973 yyextra->defVal.str(std::string());
974 yyextra->braceCount = 0;
975 BEGIN(FunctionParamDefVal);
978 if (!yyextra->argType.empty())
982 a.
type = yyextra->argType;
984 yyextra->argType =
"";
990 yyextra->defVal.str(std::string());
991 yyextra->braceCount = 0;
992 BEGIN(FunctionAnnotation);
994 {STARTDOCSYMS}"<"/.* {
996 BEGIN(SpecialComment);
1005<FunctionTypeAnnotation>{
1009 ++yyextra->braceCount;
1010 yyextra->defVal << *yytext;
1015 --yyextra->braceCount;
1016 yyextra->defVal << *yytext;
1019 if (yyextra->braceCount == 0)
1021 yyextra->current->type = yyextra->defVal.str();
1026 yyextra->defVal << *yytext;
1029 yyextra->defVal << *yytext;
1030 yyextra->copyString=&yyextra->defVal;
1031 yyextra->stringContext=FunctionTypeAnnotation;
1032 BEGIN(SingleQuoteString);
1035 yyextra->defVal << *yytext;
1036 yyextra->copyString=&yyextra->defVal;
1037 yyextra->stringContext=FunctionTypeAnnotation;
1038 BEGIN(DoubleQuoteString);
1041 yyextra->defVal << *yytext;
1045 yyextra->defVal << *yytext;
1049<FunctionAnnotation>{
1053 ++yyextra->braceCount;
1054 yyextra->defVal << *yytext;
1058 --yyextra->braceCount;
1059 yyextra->defVal << *yytext;
1064 if (yyextra->braceCount == 0)
1066 if (!yyextra->current->argList.empty())
1067 yyextra->current->argList.back().type += yyextra->defVal.str();
1070 BEGIN(FunctionParams);
1075 --yyextra->braceCount;
1076 yyextra->defVal << *yytext;
1080 yyextra->defVal << *yytext;
1081 yyextra->copyString=&yyextra->defVal;
1082 yyextra->stringContext=FunctionAnnotation;
1083 BEGIN(SingleQuoteString);
1086 yyextra->defVal << *yytext;
1087 yyextra->copyString=&yyextra->defVal;
1088 yyextra->stringContext=FunctionAnnotation;
1089 BEGIN(DoubleQuoteString);
1092 yyextra->defVal << *yytext;
1095 {STARTDOCSYMS}"<"/.* {
1097 BEGIN(SpecialComment);
1102 yyextra->defVal << *yytext;
1106<FunctionParamDefVal>{
1110 ++yyextra->braceCount;
1111 yyextra->defVal << *yytext;
1115 --yyextra->braceCount;
1116 yyextra->defVal << *yytext;
1120 if (yyextra->braceCount == 0)
1122 if (!yyextra->current->argList.empty())
1126 BEGIN(FunctionParams);
1131 --yyextra->braceCount;
1132 yyextra->defVal << *yytext;
1137 yyextra->defVal << *yytext;
1138 yyextra->copyString=&yyextra->defVal;
1139 yyextra->stringContext=FunctionParamDefVal;
1140 BEGIN( SingleQuoteString );
1143 yyextra->defVal << *yytext;
1144 yyextra->copyString=&yyextra->defVal;
1145 yyextra->stringContext=FunctionParamDefVal;
1146 BEGIN( DoubleQuoteString );
1148 {STARTDOCSYMS}"<"/.* {
1150 BEGIN(SpecialComment);
1155 yyextra->defVal << *yytext;
1159 yyextra->defVal << *yytext;
1165 \n/{IDENTIFIER}{BB} {
1169 for (i=(
int)yyleng-1;i>=0;i--)
1180 yyextra->current->program << yytext;
1187 for (i=(
int)yyleng-1;i>=0;i--)
1198 yyextra->current->program << yytext;
1202 yyextra->current->program << yytext;
1210 DBG_CTX((stderr,
"yyextra->curIndent=%d yyextra->indent=%d\n",yyextra->curIndent,yyextra->indent));
1211 if (yyextra->curIndent<=yyextra->indent)
1215 yyextra->indent=yyextra->curIndent;
1223 yyextra->current->program << yytext;
1227 yyextra->current->program << *yytext;
1228 yyextra->stringContext=YY_START;
1229 yyextra->specialBlock =
false;
1230 yyextra->copyString=&yyextra->current->program;
1231 BEGIN( SingleQuoteString );
1234 yyextra->current->program << *yytext;
1235 yyextra->stringContext=YY_START;
1236 yyextra->specialBlock =
false;
1237 yyextra->copyString=&yyextra->current->program;
1238 BEGIN( DoubleQuoteString );
1241 yyextra->current->program << yytext;
1242 yyextra->specialBlock =
false;
1246 yyextra->current->program << *yytext;
1250 yyextra->current->program << yytext;
1253 yyextra->specialBlock =
false;
1254 yyextra->current->program << *yytext;
1258 yyextra->current->program << yytext;
1260 BEGIN(TripleComment);
1265 yyextra->current->program << yytext;
1267 BEGIN(TripleComment);
1273 yyextra->current->name = yytext;
1276 yyextra->bracketDepth=1;
1277 yyextra->genericsContext = YY_START;
1278 yyextra->genericsValue =
"[";
1282 yyextra->current->args = yyextra->genericsValue;
std::string_view stripWhiteSpace(std::string_view s)
Given a string view s, returns a new, narrower view on that string, skipping over any leading or trai...
1304<ClassDec>{IDENTIFIER} {
1305 if (yyextra->current->type.empty())
1307 yyextra->current->type =
"class";
1310 yyextra->current->section = EntryType::makeClass();
1311 yyextra->current->name = yytext;
1316 if (yyextra->current_root->section.isScope())
1319 yyextra->current->name.prepend(yyextra->current_root->name+
"::");
1322 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
1323 yyextra->current->fileName = yyextra->fileName;
1324 yyextra->docBlockContext = YY_START;
1325 yyextra->docBlockInBody =
false;
1326 yyextra->docBlockJavaStyle =
false;
1327 yyextra->docBlock.clear();
1328 yyextra->bracketDepth = 0;
1330 BEGIN(ClassInheritance);
1337 yyextra->bracketDepth=1;
1338 yyextra->genericsContext = YY_START;
1339 yyextra->genericsValue =
"[";
1343 yyextra->specialBlock =
true;
1344 yyextra->current->bodyLine = yyextra->yyLineNr;
1345 yyextra->current->program.str(std::string());
1346 BEGIN(ClassCaptureIndent);
1350 yyextra->current->extends.emplace_back(
1351 substitute(yytext,
".",
"::"),Protection::Public,Specifier::Normal
1355 yyextra->stringContext=YY_START;
1356 BEGIN( SingleQuoteStringIgnore );
1359 yyextra->stringContext=YY_START;
1360 BEGIN( DoubleQuoteStringIgnore );
1364<SingleQuoteStringIgnore>{
1366 BEGIN(yyextra->stringContext);
1370<DoubleQuoteStringIgnore>{
1372 BEGIN(yyextra->stringContext);
1377<ClassCaptureIndent>{
1381 yyextra->current->program << yytext;
1386 yyextra->current->program << yytext;
1387 BEGIN(TripleComment);
1391 yyextra->current->program << yytext;
1392 BEGIN(TripleComment);
1394 {STARTDOCSYMS}[#]* {
1396 BEGIN(SpecialComment);
1401 yyextra->current->program << yytext;
1404 yyextra->bodyEntry = yyextra->current;
1405 DBG_CTX((stderr,
"setting indent %d\n",yyextra->curIndent));
1411 ""/({NONEMPTY}|{EXPCHAR}) {
1415 yyextra->current->program << yytext;
1424 ":"{B}{IDENTIFIER} {
1425 yyextra->startInit =
false;
1426 yyextra->current->type =
substitute(yytext,
":",
"");
1428 {STARTDOCSYMS}"<"/.* {
1430 yyextra->packageCommentAllowed =
false;
1432 yyextra->docBlockContext = VariableEnd;
1433 BEGIN(SpecialComment);
1436 BEGIN( VariableEnd );
1440 BEGIN( VariableEnd );
1446 yyextra->current->initializer << *yytext;
1447 if (yyextra->atomStart==*yytext)
1449 yyextra->atomCount++;
1453 yyextra->current->initializer << *yytext;
1454 if (yyextra->atomEnd==*yytext)
1456 yyextra->atomCount--;
1458 if (yyextra->atomCount==0)
1460 yyextra->startInit =
false;
1461 BEGIN(yyextra->atomContext);
1465 yyextra->specialBlock =
false;
1466 yyextra->current->program << yytext;
1468 BEGIN(TripleComment);
1472 yyextra->specialBlock =
false;
1473 yyextra->current->program << yytext;
1475 BEGIN(TripleComment);
1478 yyextra->stringContext=YY_START;
1479 yyextra->current->initializer <<
"'";
1480 yyextra->copyString=&yyextra->current->initializer;
1481 BEGIN( SingleQuoteString );
1484 yyextra->stringContext=YY_START;
1485 yyextra->current->initializer <<
"\"";
1486 yyextra->copyString=&yyextra->current->initializer;
1487 BEGIN( DoubleQuoteString );
1490 yyextra->current->initializer << yytext;
1493 yyextra->current->initializer << yytext;
1496 yyextra->current->initializer << *yytext;
1499 yyextra->current->initializer << *yytext;
1524 {ENDTRIDOUBLEQUOTE} |
1525 {ENDTRISINGLEQUOTE} {
1527 if (yyextra->doubleQuote==(yytext[0]==
'"'))
1529 if (yyextra->specialBlock)
1531 DString actualDoc=yyextra->docBlock;
1532 if (!yyextra->docBlockSpecial)
1534 if (!actualDoc.
empty())
1537 actualDoc.
prepend(
"@iverbatim\n");
1538 actualDoc.
append(
"@endiverbatim ");
1544 else if (yyextra->packageCommentAllowed)
1546 DString actualDoc=yyextra->docBlock;
1547 if (!yyextra->docBlockSpecial)
1549 if (!actualDoc.
empty())
1552 actualDoc.
prepend(
"@iverbatim\n");
1553 actualDoc.
append(
"@endiverbatim ");
1556 if (yyextra->moduleScope.startsWith(
"__") && yyextra->moduleScope.endsWith(
"__"))
1558 actualDoc.
prepend(
"\\namespace \\"+yyextra->moduleScope+
" ");
1562 actualDoc.
prepend(
"\\namespace "+yyextra->moduleScope+
" ");
1566 if ((yyextra->docBlockContext==ClassBody ) ||
1567 yyextra->docBlockContext==FunctionBody)
1569 yyextra->current->program << yyextra->docBlock;
1570 yyextra->current->program << yytext;
1577 BEGIN(yyextra->docBlockContext);
1581 yyextra->docBlock += yytext;
1583 yyextra->packageCommentAllowed =
false;
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
DString & prepend(const char *s)
static void handleCommentBlock(yyscan_t yyscanner, const DString &doc, bool brief)
void stripIndentationVerbatim(DString &doc, size_t indentationLevel, bool skipFirstLine)
1588 if (yyextra->firstPass && yyextra->docBlockSpecial && yyleng >= yyextra->curIndent)
1589 yyextra->docBlock += yytext + yyextra->curIndent;
1591 yyextra->docBlock += yytext;
1594 yyextra->docBlock += yytext;
1598 yyextra->docBlock += yytext;
1600 {CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
1601 yyextra->fileName = &yytext[6];
1602 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1603 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
1604 yyextra->docBlock+=yytext;
1606 {CMD}"ifile"{B}+{FILEMASK} {
1607 yyextra->fileName = &yytext[6];
1608 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1609 yyextra->docBlock+=yytext;
1611 {CMD}"iline"{LINENR}/[\n\.] |
1612 {CMD}"iline"{LINENR}{B} {
1617 warn(yyextra->fileName,yyextra->yyLineNr,
"Invalid line number '{}' for iline command",yytext);
1621 yyextra->yyLineNr = nr;
1623 yyextra->docBlock+=yytext;
int toInt(bool *ok=nullptr, int base=10) const
#define warn(file, line, fmt,...)
1625 ({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
1626 yyextra->docBlock+=yytext;
1629 yyextra->docBlock += yytext;
1632 yyextra->docBlock += yytext;
1640 yyextra->docBlock+=
'\n';
1641 yyextra->docBrief =
false;
1644 {CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
1645 yyextra->fileName = &yytext[6];
1646 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1647 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
1648 yyextra->docBlock+=yytext;
1650 {CMD}"ifile"{B}+{FILEMASK} {
1651 yyextra->fileName = &yytext[6];
1652 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1653 yyextra->docBlock+=yytext;
1655 {CMD}"iline"{LINENR}/[\n\.] |
1656 {CMD}"iline"{LINENR}{B} {
1661 warn(yyextra->fileName,yyextra->yyLineNr,
"Invalid line number '{}' for iline command",yytext);
1665 yyextra->yyLineNr = nr;
1667 yyextra->docBlock+=yytext;
1669 ({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
1670 yyextra->docBlock+=yytext;
1674 int extraSpaces = std::max(0,
static_cast<int>(yyleng-9-yyextra->curIndent-2));
1675 indent.
fill(
' ',extraSpaces);
1677 yyextra->docBlock +=
"\\ilinebr ";
1678 yyextra->docBlock += indent;
DString fill(char c, size_t len)
Fills a string with a predefined character.
1681 yyextra->docBlock+=yytext;
1685 if (yyextra->docBlockContext == VariableEnd)
1693 BEGIN(yyextra->docBlockContext);
1696 yyextra->docBlock+=*yytext;
1713 BEGIN(yyextra->stringContext);
1736 BEGIN(yyextra->stringContext);
1747 {ENDTRIDOUBLEQUOTE} |
1748 {ENDTRISINGLEQUOTE} {
1749 *yyextra->copyString << yytext;
1750 if (yyextra->doubleQuote==(yytext[0]==
'"'))
1752 BEGIN(yyextra->stringContext);
1757 ({LONGSTRINGBLOCK}) {
1759 *yyextra->copyString << yytext;
1763 *yyextra->copyString << yytext;
1766 *yyextra->copyString << *yytext;
1772 yyextra->doubleQuote=
true;
1773 yyextra->decoratorCommentStr.str(std::string());
1774 yyextra->copyString=&yyextra->decoratorCommentStr;
1775 yyextra->stringContext=YY_START;
1776 BEGIN(TripleString);
1780 yyextra->doubleQuote=
false;
1781 yyextra->decoratorCommentStr.str(std::string());
1782 yyextra->copyString=&yyextra->decoratorCommentStr;
1783 yyextra->stringContext=YY_START;
1784 BEGIN(TripleString);
1787 yyextra->stringContext=YY_START;
1788 yyextra->decoratorCommentStr.str(std::string());
1789 yyextra->copyString=&yyextra->decoratorCommentStr;
1790 BEGIN( SingleQuoteString );
1793 yyextra->stringContext=YY_START;
1794 yyextra->decoratorCommentStr.str(std::string());
1795 yyextra->copyString=&yyextra->decoratorCommentStr;
1796 BEGIN( DoubleQuoteString );
1799 yyextra->decoratorRound++;
1802 yyextra->decoratorRound--;
1803 if (!yyextra->decoratorRound) BEGIN( Search );
1846 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1848 const char *p = yyextra->inputString + yyextra->inputPosition;
1849 while ( c < max_size && *p ) { *buf++ = *p++; c++; }
1850 yyextra->inputPosition+=c;
1856 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1857 yyextra->protection = Protection::Public;
1858 yyextra->mtype = MethodTypes::Method;
1859 yyextra->isStatic =
false;
1860 yyextra->virt = Specifier::Normal;
1861 yyextra->previous = 0;
1862 yyextra->packageCommentAllowed =
true;
1867 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1869 yyextra->current->protection = yyextra->protection ;
1870 yyextra->current->mtype = yyextra->mtype;
1871 yyextra->current->virt = yyextra->virt;
1872 yyextra->current->isStatic = yyextra->isStatic;
1873 yyextra->current->lang = SrcLangExt::Python;
1874 yyextra->current->type.clear();
1875 yyextra->current->name.clear();
1876 yyextra->current->initializer.clear();
1877 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
1878 yyextra->isStatic =
false;
1883 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1884 if (yyextra->current->name.empty())
1890 if (yyextra->checkDupEntry)
1892 for (
auto &v : yyextra->current_root->children())
1895 if (v->name==yyextra->current->name && v->section==yyextra->current->section)
1897 if (v->doc.empty() && !yyextra->current->doc.empty())
1899 v->doc = yyextra->current->doc;
1900 v->docLine = yyextra->current->docLine;
1901 v->docFile = yyextra->current->docFile;
1903 if (v->brief.empty() && !yyextra->current->brief.empty())
1905 v->brief = yyextra->current->brief;
1906 v->briefLine = yyextra->current->briefLine;
1907 v->briefFile = yyextra->current->briefFile;
1909 if (v->type.empty() && !yyextra->current->type.empty())
1912 v->type = yyextra->current->type;
1921 yyextra->previous = yyextra->current;
1922 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
1929 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1931 auto doc = yyextra->current->doc;
1932 auto docLine = yyextra->current->docLine;
1933 auto docFile = yyextra->current->docFile;
1934 auto brief = yyextra->current->brief;
1935 auto briefLine = yyextra->current->briefLine;
1936 auto briefFile = yyextra->current->briefFile;
1938 yyextra->previous = yyextra->current;
1939 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
1942 yyextra->current->doc = doc;
1943 yyextra->current->docLine = docLine;
1944 yyextra->current->docFile = docFile;
1945 yyextra->current->brief = brief;
1946 yyextra->current->briefLine = briefLine;
1947 yyextra->current->briefFile = briefFile;
1952 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1953 if (!yyextra->current->name.empty() && yyextra->current->name.at(0)==
'_')
1955 if (yyextra->current->name.at(1)==
'_')
1957 yyextra->current->protection=Protection::Private;
1961 yyextra->current->protection=Protection::Protected;
1968 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1969 yyextra->current->name = name;
1970 yyextra->current->section=EntryType::makeVariable();
1971 yyextra->current->fileName = yyextra->fileName;
1972 yyextra->current->startLine = yyextra->yyLineNr;
1973 yyextra->current->bodyLine = yyextra->yyLineNr;
1974 yyextra->current->type.clear();
1976 yyextra->checkDupEntry =
true;
1981 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1983 if (yyextra->current_root->section.isCompound())
1985 yyextra->current->isStatic =
true;
1999 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2001 if (yyextra->current_root->section.isCompound())
2003 yyextra->current->isStatic =
true;
2010 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2011 if (yyextra->current->name.startsWith(
"__") && yyextra->current->name.endsWith(
"__"))
2015 yyextra->current->protection=Protection::Public;
2032 else if (c==
'\t') col+=tabSize-(col%tabSize);
2040 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2041 auto it = yyextra->packageNameCache.
find(path.
str());
2042 if (it!=yyextra->packageNameCache.end())
2049 size_t i=path.
rfind(
'/');
2057 scope+=path.
mid(i+1);
2058 yyextra->packageNameCache.emplace(path.
str(),scope.
str());
2067 if (fileName.
empty())
return fileName;
2074 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2075 DString item=all ? yyextra->packageName : yyextra->packageName+
"."+yytext;
2077 yyextra->current->fileName = yyextra->fileName;
2079 yyextra->current->section=all ? EntryType::makeUsingDir() : EntryType::makeUsingDecl();
2080 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2087 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2088 DBG_CTX((stderr,
"yyextra->yyLineNr=%d\n",yyextra->yyLineNr));
2089 for (
const char *p = yytext; *p; ++p)
2091 yyextra->yyLineNr += (*p ==
'\n') ;
2097 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2098 DBG_CTX((stderr,
"yyextra->yyLineNr=%d\n",yyextra->yyLineNr));
2099 yyextra->yyLineNr++;
2105 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2108 yyextra->current->briefFile = yyextra->fileName;
2109 yyextra->current->briefLine = yyextra->yyLineNr;
2113 yyextra->current->docFile = yyextra->fileName;
2114 yyextra->current->docLine = yyextra->yyLineNr;
2120 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2125 yyextra->docBlockInBody=
false;
2127 if (!yyextra->current->doc.empty())
2129 yyextra->current->doc=yyextra->current->doc.stripWhiteSpace()+
"\n\n";
2131 if (yyextra->docBlockInBody && yyextra->previous && !yyextra->previous->doc.empty())
2133 yyextra->previous->doc=yyextra->previous->doc.stripWhiteSpace()+
"\n\n";
2137 bool needsEntry =
false;
2138 int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine;
2139 Markdown markdown(yyextra->fileName,lineNr);
2144 while (yyextra->commentScanner.parseCommentBlock(
2145 yyextra->thisParser,
2146 (yyextra->docBlockInBody && yyextra->previous) ? yyextra->previous.get() : yyextra->current.get(),
2150 yyextra->docBlockInBody ?
false : brief,
2151 yyextra->docBlockJavaStyle,
2152 yyextra->docBlockInBody,
2153 yyextra->protection,
2175 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2177 if (yyextra->bodyEntry)
2179 yyextra->bodyEntry->endBodyLine = yyextra->yyLineNr-correction;
2180 yyextra->bodyEntry = 0;
2188 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2189 if (yyextra->copyString) (*yyextra->copyString) << s;
2194 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2195 yyextra->docBlockContext = YY_START;
2196 yyextra->docBlockInBody =
false;
2197 yyextra->docBlockJavaStyle =
true;
2198 yyextra->docBlockSpecial = yytext[strlen(yytext) - 1]==
'!' || !
Config_getBool(PYTHON_DOCSTRING);
2199 yyextra->docBlock.clear();
2200 yyextra->commentIndent = yyextra->curIndent;
2201 yyextra->doubleQuote =
true;
2207 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2208 yyextra->docBlockContext = YY_START;
2209 yyextra->docBlockInBody =
false;
2210 yyextra->docBlockJavaStyle =
true;
2211 yyextra->docBlockSpecial = yytext[strlen(yytext) - 1]==
'!' || !
Config_getBool(PYTHON_DOCSTRING);
2212 yyextra->docBlock.clear();
2213 yyextra->commentIndent = yyextra->curIndent;
2214 yyextra->doubleQuote =
false;
2220 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2221 yyextra->docBlockContext = YY_START;
2222 yyextra->docBlockInBody =
false;
2223 yyextra->docBlockJavaStyle =
true;
2224 yyextra->docBrief =
true;
2225 yyextra->docBlock.clear();
2226 yyextra->commentIndent = yyextra->curIndent;
2232 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2233 yyextra->current->fileName = yyextra->fileName;
2234 yyextra->current->startLine = yyextra->yyLineNr;
2235 yyextra->current->bodyLine = yyextra->yyLineNr;
2236 yyextra->current->section = EntryType::makeFunction();
2237 yyextra->current->lang = SrcLangExt::Python;
2238 yyextra->current->virt = Specifier::Normal;
2239 yyextra->current->isStatic = yyextra->isStatic;
2240 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
2241 yyextra->current->type.clear();
2242 yyextra->current->name.clear();
2243 yyextra->current->args.clear();
2244 yyextra->current->argList.clear();
2245 yyextra->packageCommentAllowed =
false;
2246 yyextra->isStatic=
false;
2252 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2253 yyextra->current->section = EntryType::makeClass();
2254 yyextra->current->argList.clear();
2255 yyextra->current->type +=
"class" ;
2256 yyextra->current->fileName = yyextra->fileName;
2257 yyextra->current->startLine = yyextra->yyLineNr;
2258 yyextra->current->bodyLine = yyextra->yyLineNr;
2259 yyextra->packageCommentAllowed =
false;
2264 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2265 yyextra->current->section = EntryType::makeVariable();
2266 yyextra->current->argList.clear();
2267 yyextra->current->type =
"typedef " ;
2268 yyextra->current->spec.setAlias(
true);
2269 yyextra->current->fileName = yyextra->fileName;
2270 yyextra->current->startLine = yyextra->yyLineNr;
2271 yyextra->current->bodyLine = yyextra->yyLineNr;
2272 yyextra->packageCommentAllowed =
false;
2277 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2280 if (!yyextra->current->argList.empty())
2282 yyextra->docBlock +=
"@param ";
2283 yyextra->docBlock += yyextra->current->argList.back().name;
2284 yyextra->docBlock +=
" ";
2286 yyextra->docBlockContext = YY_START;
2293 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2295 for (
size_t i=0; i<rt->children().size(); ++i)
2297 std::shared_ptr<Entry> ce = rt->children()[i];
2298 if (!ce->program.empty())
2303 yyextra->programStr = ce->program.str();
2304 yyextra->inputString = yyextra->programStr.data();
2305 yyextra->inputPosition = 0;
2306 yyextra->firstPass =
false;
2307 pyscannerYYrestart(
nullptr, yyscanner );
2308 if (ce->section.isCompound())
2310 yyextra->specialBlock =
false;
2311 yyextra->current_root = ce;
2314 else if (ce->parent())
2316 yyextra->current_root = rt;
2319 BEGIN( SearchMemVars );
2321 yyextra->fileName = ce->fileName;
2322 yyextra->yyLineNr = ce->bodyLine ;
2323 yyextra->current = std::make_shared<Entry>();
2326 yyextra->checkDupEntry =
false;
2329 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
2331 pyscannerYYlex(yyscanner) ;
2332 yyextra->lexInit=
true;
2334 yyextra->programStr.clear();
2335 ce->program.str(std::string());
2337 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
2349 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2352 if (fileBuf==
nullptr || fileBuf[0]==
'\0')
return;
2354 yyextra->inputString = fileBuf;
2355 yyextra->inputPosition = 0;
2357 yyextra->protection = Protection::Public;
2358 yyextra->mtype = MethodTypes::Method;
2359 yyextra->isStatic =
false;
2360 yyextra->virt = Specifier::Normal;
2361 yyextra->current_root = rt;
2362 yyextra->specialBlock =
false;
2364 yyextra->yyLineNr = 1 ;
2365 yyextra->fileName = fileName;
2366 yyextra->checkDupEntry =
false;
2367 yyextra->firstPass =
true;
2369 msg(
"Parsing file {}...\n",yyextra->fileName);
2374 if (baseName!=
"__init__")
2376 if (!yyextra->moduleScope.empty())
2378 yyextra->moduleScope+=
"::";
2380 yyextra->moduleScope+=baseName;
2384 DString scope = yyextra->moduleScope;
2385 size_t startPos = 0;
2389 pos = scope.
find(
"::",startPos);
2392 startPos = pos = scope.
length();
2398 yyextra->current = std::make_shared<Entry>();
2400 yyextra->current->name = scope.
left(pos);
2401 yyextra->current->section = EntryType::makeNamespace();
2402 yyextra->current->type =
"namespace";
2403 yyextra->current->fileName = yyextra->fileName;
2404 yyextra->current->startLine = yyextra->yyLineNr;
2405 yyextra->current->bodyLine = yyextra->yyLineNr;
2406 yyextra->current_root = yyextra->current;
2407 rt->moveToSubEntryAndRefresh(yyextra->current);
2408 }
while (pos<scope.
length());
2412 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
2414 yyextra->current->reset();
2416 pyscannerYYrestart(
nullptr,yyscanner);
2418 pyscannerYYlex(yyscanner);
2419 yyextra->lexInit=
true;
2421 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
2423 yyextra->programStr.clear();
2424 yyextra->current_root->program.str(std::string());
2433 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2437 warn(yyextra->fileName,yyextra->yyLineNr,
"Empty prototype found!");
2441 yyextra->specialBlock =
false;
2442 yyextra->packageCommentAllowed =
false;
2445 YY_BUFFER_STATE orgState = YY_CURRENT_BUFFER;
2446 yy_switch_to_buffer(yy_create_buffer(
nullptr,
YY_BUF_SIZE, yyscanner), yyscanner);
2447 const char *orgInputString = yyextra->inputString;
2448 int orgInputPosition = yyextra->inputPosition;
2451 yyextra->inputString = text.
data();
2452 yyextra->inputPosition = 0;
2453 pyscannerYYrestart(
nullptr, yyscanner );
2455 BEGIN( FunctionDec );
2457 pyscannerYYlex(yyscanner);
2458 yyextra->lexInit=
true;
2460 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
2461 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.empty())
2463 yyextra->current->section = EntryType::makeVariableDoc();
2468 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
2469 yy_switch_to_buffer(orgState, yyscanner);
2471 yyextra->inputString = orgInputString;
2472 yyextra->inputPosition = orgInputPosition;
2487 pyscannerYYlex_init_extra(&
p->state,&
p->yyscanner);
2495 pyscannerYYlex_destroy(
p->yyscanner);
2500 const char *fileBuf,
2501 const std::shared_ptr<Entry> &root,
2504 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
2505 yyextra->thisParser =
this;
2525#include "pyscanner.l.h"
Clang parser object for a single translation unit, which consists of a source file and the directly o...
size_t rfind(char c, size_t pos=npos) const
DString mid(size_t index, size_t len=npos) const
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
size_t find(char c, size_t pos=0) const
DString left(size_t len) const
const std::string & str() 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)
Minimal replacement for QFileInfo.
std::string dirPath(bool absPath=true) const
std::string baseName() const
Helper class to process markdown formatted text.
DString process(const DString &input, int &startNewlines, bool fromParseInput=false)
void parseInput(const DString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &root, ClangTUParser *clangParser) override
Parses a single input file with the goal to build an Entry tree.
std::unique_ptr< Private > p
~PythonOutlineParser() override
void parsePrototype(const DString &text) override
Callback function called by the comment block scanner.
bool needsPreprocessing(const DString &extension) const override
Returns true if the language identified by extension needs the C preprocessor to be run before feed t...
#define Config_getInt(name)
#define Config_getBool(name)
static void startCommentBlock(yyscan_t yyscanner, bool)
static void parseMain(yyscan_t yyscanner, const DString &fileName, const char *fileBuf, const std::shared_ptr< Entry > &rt)
static void parsePrototype(yyscan_t yyscanner, const DString &text)
static void parseCompounds(yyscan_t yyscanner, std::shared_ptr< Entry > rt)
DString stripIndentation(const DString &s, bool skipFirstLine)
static int yyread(yyscan_t yyscanner, char *buf, int max_size)