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)
161#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 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.
178HEXNUMBER "0"[xX][0-9a-fA-F]+[lL]?
179OCTNUMBER "0"[0-7]+[lL]?
180NUMBER {DIGIT}+[lLjJ]?
181INTNUMBER {HEXNUMBER}|{OCTNUMBER}|{NUMBER}
182FLOATNUMBER {DIGIT}+"."{DIGIT}+([eE][+\-]?{DIGIT}+)?[jJ]?
184LETTER [A-Za-z\x80-\xFF]
185NONEMPTY [A-Za-z0-9_\x80-\xFF]
186EXPCHAR [#(){}\[\],:.%/\\=`*~|&<>!;+-]
187PARAMNONEMPTY [^ \t\n():]
188IDENTIFIER ({LETTER}|"_")({LETTER}|{DIGIT}|"_")*
189SCOPE {IDENTIFIER}("."{IDENTIFIER})*
191TRISINGLEQUOTE {STRINGPREFIX}?"'''"(!)?
192TRIDOUBLEQUOTE {STRINGPREFIX}?"\"\"\""(!)?
193ENDTRISINGLEQUOTE "'''"
194ENDTRIDOUBLEQUOTE "\"\"\""
195LONGSTRINGCHAR [^\\"']
197LONGSTRINGITEM ({LONGSTRINGCHAR}|{ESCAPESEQ})
198SMALLQUOTE ("\"\""|"\""|"'"|"''")
199LONGSTRINGBLOCK ({LONGSTRINGITEM}|{SMALLQUOTE})
201STRINGPREFIX ("r"|"u"|"ur"|"R"|"U"|"UR"|"Ur"|"uR")
202POUNDCOMMENT "#"[^#\n][^\n]*
207LINENR {B}*[1-9][0-9]*
208FILEICHAR [a-z_A-Z0-9\x80-\xFF\\:\\\/\-\+=&#@~]
209FILEECHAR [a-z_A-Z0-9\x80-\xFF\-\+=&#@~]
210FILECHARS {FILEICHAR}*{FILEECHAR}+
211HFILEMASK {FILEICHAR}*("."{FILEICHAR}+)+{FILECHARS}*
212VFILEMASK {FILECHARS}("."{FILECHARS})*
213FILEMASK {VFILEMASK}|{HFILEMASK}
216ID [a-z_A-Z%]+{IDSYM}*
239%x FunctionTypeAnnotation
240%x FunctionParamDefVal
259%x SingleQuoteStringIgnore
260%x DoubleQuoteStringIgnore
285 DBG_CTX((stderr,
"Found def at %d\n",yyextra->yyLineNr));
288 BEGIN( FunctionDec );
290 ^{B}"async"{BB}"def"{BB} {
291 DBG_CTX((stderr,
"Found async def at %d\n",yyextra->yyLineNr));
294 BEGIN( FunctionDec );
298 BEGIN( FunctionDec );
300 "async"{BB}"def"{BB} {
302 BEGIN( FunctionDec );
306 DBG_CTX((stderr,
"Found class at %d\n",yyextra->yyLineNr));
326 yyextra->packageCommentAllowed =
false;
332 yyextra->packageCommentAllowed =
false;
335 ^{B}{IDENTIFIER}/{B}"="{B}"property" {
336 yyextra->current->section = EntryType::makeVariable();
337 yyextra->current->mtype = MethodTypes::Property;
339 yyextra->current->fileName = yyextra->fileName;
340 yyextra->current->startLine = yyextra->yyLineNr;
341 yyextra->current->bodyLine = yyextra->yyLineNr;
342 yyextra->packageCommentAllowed =
false;
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
345 ^{B}{IDENTIFIER}/{B}"="[^=] {
346 if (yyextra->searchCount>0) REJECT;
348 yyextra->current->section = EntryType::makeVariable();
350 yyextra->current->fileName = yyextra->fileName;
351 yyextra->current->startLine = yyextra->yyLineNr;
352 yyextra->current->bodyLine = yyextra->yyLineNr;
353 yyextra->packageCommentAllowed =
false;
356 ^{B}{IDENTIFIER}/{B}":" {
357 if (yyextra->searchCount>0) REJECT;
359 if (
id ==
"try" ||
id ==
"else" ||
id ==
"except" ||
id ==
"finally") REJECT;
361 yyextra->current->section = EntryType::makeVariable();
362 yyextra->current->name = id;
363 yyextra->current->fileName = yyextra->fileName;
364 yyextra->current->startLine = yyextra->yyLineNr;
365 yyextra->current->bodyLine = yyextra->yyLineNr;
366 yyextra->packageCommentAllowed =
false;
369 {B}{IDENTIFIER}/({B},{B}{IDENTIFIER})*{B}")"*{B}"="[^=] {
373 if (yyextra->searchCount>1) REJECT;
375 yyextra->current->section = EntryType::makeVariable();
377 yyextra->current->fileName = yyextra->fileName;
378 yyextra->current->startLine = yyextra->yyLineNr;
379 yyextra->current->bodyLine = yyextra->yyLineNr;
380 yyextra->packageCommentAllowed =
false;
384 yyextra->stringContext=YY_START;
385 yyextra->copyString=
nullptr;
386 yyextra->packageCommentAllowed =
false;
387 BEGIN( SingleQuoteString );
390 yyextra->stringContext=YY_START;
391 yyextra->copyString=
nullptr;
392 yyextra->packageCommentAllowed =
false;
393 BEGIN( DoubleQuoteString );
396 yyextra->isStatic=
true;
400 yyextra->decoratorRound = 1;
401 yyextra->copyString=
nullptr;
408 if (yyextra->yyLineNr != 1) REJECT;
415 yyextra->packageCommentAllowed =
false;
427 BEGIN(TripleComment);
432 BEGIN(TripleComment);
435 {B}{STARTDOCSYMS}/[^#] {
437 yyextra->packageCommentAllowed =
false;
439 BEGIN(SpecialComment);
442 yyextra->searchCount++;
445 if (yyextra->searchCount>0)
447 yyextra->searchCount--;
451 yyextra->current->doc.clear();
452 yyextra->current->brief.clear();
466 {IDENTIFIER}({B}"."{B}{IDENTIFIER})* {
467 yyextra->packageName=yytext;
489 {IDENTIFIER}/{B}","{B} {
492 {IDENTIFIER}/{B}")" {
497 if (!yyextra->importTuple)
504 if (!yyextra->importTuple)
512 yyextra->importTuple=
true;
515 yyextra->importTuple=
false;
530 {IDENTIFIER}({B}"."{B}{IDENTIFIER})* {
532 yyextra->current->fileName = yyextra->fileName;
534 yyextra->current->section=EntryType::makeUsingDecl();
535 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
DString removeRedundantWhiteSpace(const DString &s)
552 ("cls"|"self")"."{IDENTIFIER}/{B}[,)] {
553 const char *s = strchr(yytext,
'.'); s++;
554 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)
558 ("cls"|"self")"."{IDENTIFIER}/{B}"=" {
559 const char *s = strchr(yytext,
'.'); s++;
560 DBG_CTX((stderr,
"Found instance method variable %s in %s at %d\n",s,
qPrint(yyextra->current_root->name.data(),yyextra->yyLineNr)));
562 BEGIN( SearchSkipValue );
564 ("cls"|"self")"."{IDENTIFIER}/{B}":" {
565 const char *s = strchr(yytext,
'.'); s++;
566 DBG_CTX((stderr,
"Found instance method variable %s in %s at %d\n",s,
qPrint(yyextra->current_root->name.data(),yyextra->yyLineNr)));
572 BEGIN(TripleComment);
577 BEGIN(TripleComment);
580 {STARTDOCSYMS}/[^#] {
582 BEGIN(SpecialComment);
587 yyextra->stringContext=YY_START;
588 yyextra->copyString=
nullptr;
589 BEGIN( SingleQuoteString );
592 yyextra->stringContext=YY_START;
593 yyextra->copyString=
nullptr;
594 BEGIN( DoubleQuoteString );
598 yyextra->current->doc.clear();
599 yyextra->current->brief.clear();
601 BEGIN( SearchSkipValue );
610 yyextra->braceCount=0;
613 yyextra->current->type+=*yytext;
614 yyextra->braceCount++;
617 yyextra->current->type+=*yytext;
618 yyextra->braceCount--;
621 yyextra->stringContext=YY_START;
622 yyextra->copyString=
nullptr;
623 BEGIN( SingleQuoteString );
626 yyextra->stringContext=YY_START;
627 yyextra->copyString=
nullptr;
628 BEGIN( DoubleQuoteString );
631 if (yyextra->braceCount==0)
633 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
635 BEGIN(SearchSkipValue);
639 yyextra->current->type+=*yytext;
643 yyextra->current->type = yyextra->current->type.stripWhiteSpace();
646 BEGIN(SearchMemVars);
649 yyextra->current->type+=
' ';
653 yyextra->current->type+=*yytext;
657<SearchSkipValue,VariableDec,TypeValue>{
660 yyextra->startInit =
true;
661 if (YY_START!=TypeValue)
663 yyextra->current->initializer.str(yytext);
664 yyextra->current->initializer <<
" ";
668 yyextra->current->initializer << yytext;
672 if (yyextra->current->type.empty()) yyextra->current->type =
"int";
673 yyextra->current->initializer << yytext;
676 if (yyextra->current->type.empty()) yyextra->current->type =
"float";
677 yyextra->current->initializer << yytext;
680 if (yyextra->current->type.empty()) yyextra->current->type =
"bool";
681 yyextra->current->initializer << yytext;
684 if (yyextra->current->type.empty()) yyextra->current->type =
"str";
685 yyextra->current->initializer << yytext;
686 yyextra->copyString=&yyextra->current->initializer;
687 yyextra->stringContext=YY_START;
688 BEGIN( SingleQuoteString );
690 {STRINGPREFIX}?"\"" {
691 if (yyextra->current->type.empty()) yyextra->current->type =
"str";
692 yyextra->current->initializer << yytext;
693 yyextra->copyString=&yyextra->current->initializer;
694 yyextra->stringContext=YY_START;
695 BEGIN( DoubleQuoteString );
698 if (yyextra->current->type.empty()) yyextra->current->type =
"str";
699 yyextra->current->initializer << yytext;
700 yyextra->doubleQuote=
true;
701 yyextra->copyString=&yyextra->current->initializer;
702 yyextra->stringContext=YY_START;
707 if (yyextra->current->type.empty()) yyextra->current->type =
"str";
708 yyextra->current->initializer << yytext;
709 yyextra->doubleQuote=
false;
710 yyextra->copyString=&yyextra->current->initializer;
711 yyextra->stringContext=YY_START;
715 if (yyextra->current->mtype!=MethodTypes::Property && yyextra->startInit)
717 yyextra->current->type =
"tuple";
719 yyextra->current->initializer << *yytext;
720 yyextra->atomStart=
'(';
721 yyextra->atomEnd=
')';
722 yyextra->atomCount=1;
723 yyextra->atomContext=YY_START;
724 BEGIN( VariableAtom );
727 if (yyextra->startInit) yyextra->current->type =
"list";
728 yyextra->current->initializer << *yytext;
729 yyextra->atomStart=
'[';
730 yyextra->atomEnd=
']';
731 yyextra->atomCount=1;
732 yyextra->atomContext=YY_START;
733 BEGIN( VariableAtom );
736 if (yyextra->startInit) yyextra->current->type =
"dict";
737 yyextra->current->initializer << *yytext;
738 yyextra->atomStart=
'{';
739 yyextra->atomEnd=
'}';
740 yyextra->atomCount=1;
741 yyextra->atomContext=YY_START;
742 BEGIN( VariableAtom );
745 yyextra->current->initializer << yytext;
750 if (yyextra->current->type.empty())
752 for (
const auto &child : yyextra->current_root->children())
754 if (child->name == yytext)
756 yyextra->current->type = child->type;
761 yyextra->startInit =
false;
762 yyextra->current->initializer << yytext;
765 yyextra->startInit =
false;
766 yyextra->current->initializer << *yytext;
770 {STARTDOCSYMS}/[^#] {
772 BEGIN(SpecialComment);
778 BEGIN(SearchMemVars);
782 BEGIN(SearchMemVars);
787 \n{B}/{IDENTIFIER}[^{LETTER}{DIGIT}_] {
799 yyextra->current->program << yytext;
813 yyextra->current->program << yytext;
821 yyextra->current->program << yytext;
825 if (yyextra->curIndent<=yyextra->indent)
833 yyextra->current->program << yytext;
837 yyextra->current->program << yytext;
838 yyextra->stringContext=YY_START;
839 yyextra->specialBlock =
false;
840 yyextra->copyString=&yyextra->current->program;
841 BEGIN( SingleQuoteString );
844 yyextra->current->program << yytext;
845 yyextra->stringContext=YY_START;
846 yyextra->specialBlock =
false;
847 yyextra->copyString=&yyextra->current->program;
848 BEGIN( DoubleQuoteString );
851 yyextra->current->program << yytext;
852 yyextra->specialBlock =
false;
855 yyextra->current->program << yytext;
858 yyextra->current->program << yytext;
862 yyextra->current->program << yytext;
865 yyextra->current->program << *yytext;
866 yyextra->specialBlock =
false;
870 yyextra->current->program << yytext;
872 BEGIN(TripleComment);
876 yyextra->current->program << yytext;
878 BEGIN(TripleComment);
886 yyextra->current->name = yytext;
887 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
891 yyextra->specialBlock =
true;
892 yyextra->bodyEntry = yyextra->current;
893 yyextra->current->bodyLine = yyextra->yyLineNr;
897 yyextra->genericsContext = YY_START;
898 yyextra->bracketDepth = 1;
899 yyextra->genericsValue =
"[";
903 yyextra->defVal.str(std::string());
904 yyextra->braceCount = 0;
905 BEGIN(FunctionTypeAnnotation);
908 yyextra->funcParamsEnd =
false;
909 yyextra->current->bodyLine = yyextra->yyLineNr;
910 BEGIN(FunctionParams);
913 if (yyextra->current->argList.empty())
915 yyextra->current->argList.setNoParameters(
true);
918 yyextra->funcParamsEnd =
true;
DString argListToString(const ArgumentList &al, bool useCanonicalType, bool showDefVals)
924 yyextra->genericsValue+=yytext;
927 yyextra->genericsValue+=yytext;
928 yyextra->bracketDepth++;
931 yyextra->genericsValue+=yytext;
932 yyextra->bracketDepth--;
933 if (yyextra->bracketDepth==0)
935 BEGIN(yyextra->genericsContext);
939 yyextra->genericsValue+=yytext;
948 if (!yyextra->argType.empty())
952 a.
type = yyextra->argType;
954 yyextra->argType =
"";
This class contains the information about the argument of a function or template.
959 yyextra->argType = yytext;
965 a.
type = yyextra->argType;
967 yyextra->argType =
"";
972 yyextra->defVal.str(std::string());
973 yyextra->braceCount = 0;
974 BEGIN(FunctionParamDefVal);
977 if (!yyextra->argType.empty())
981 a.
type = yyextra->argType;
983 yyextra->argType =
"";
989 yyextra->defVal.str(std::string());
990 yyextra->braceCount = 0;
991 BEGIN(FunctionAnnotation);
1000<FunctionTypeAnnotation>{
1004 ++yyextra->braceCount;
1005 yyextra->defVal << *yytext;
1010 --yyextra->braceCount;
1011 yyextra->defVal << *yytext;
1014 if (yyextra->braceCount == 0)
1016 yyextra->current->type = yyextra->defVal.str();
1021 yyextra->defVal << *yytext;
1024 yyextra->defVal << *yytext;
1025 yyextra->copyString=&yyextra->defVal;
1026 yyextra->stringContext=FunctionTypeAnnotation;
1027 BEGIN(SingleQuoteString);
1030 yyextra->defVal << *yytext;
1031 yyextra->copyString=&yyextra->defVal;
1032 yyextra->stringContext=FunctionTypeAnnotation;
1033 BEGIN(DoubleQuoteString);
1036 yyextra->defVal << *yytext;
1040 yyextra->defVal << *yytext;
1044<FunctionAnnotation>{
1048 ++yyextra->braceCount;
1049 yyextra->defVal << *yytext;
1053 --yyextra->braceCount;
1054 yyextra->defVal << *yytext;
1059 if (yyextra->braceCount == 0)
1061 if (!yyextra->current->argList.empty())
1062 yyextra->current->argList.back().type += yyextra->defVal.str();
1065 BEGIN(FunctionParams);
1070 --yyextra->braceCount;
1071 yyextra->defVal << *yytext;
1075 yyextra->defVal << *yytext;
1076 yyextra->copyString=&yyextra->defVal;
1077 yyextra->stringContext=FunctionAnnotation;
1078 BEGIN(SingleQuoteString);
1081 yyextra->defVal << *yytext;
1082 yyextra->copyString=&yyextra->defVal;
1083 yyextra->stringContext=FunctionAnnotation;
1084 BEGIN(DoubleQuoteString);
1087 yyextra->defVal << *yytext;
1091 yyextra->defVal << *yytext;
1095<FunctionParamDefVal>{
1099 ++yyextra->braceCount;
1100 yyextra->defVal << *yytext;
1104 --yyextra->braceCount;
1105 yyextra->defVal << *yytext;
1109 if (yyextra->braceCount == 0)
1111 if (!yyextra->current->argList.empty())
1115 BEGIN(FunctionParams);
1120 --yyextra->braceCount;
1121 yyextra->defVal << *yytext;
1126 yyextra->defVal << *yytext;
1127 yyextra->copyString=&yyextra->defVal;
1128 yyextra->stringContext=FunctionParamDefVal;
1129 BEGIN( SingleQuoteString );
1132 yyextra->defVal << *yytext;
1133 yyextra->copyString=&yyextra->defVal;
1134 yyextra->stringContext=FunctionParamDefVal;
1135 BEGIN( DoubleQuoteString );
1138 yyextra->defVal << *yytext;
1142 yyextra->defVal << *yytext;
1148 \n/{IDENTIFIER}{BB} {
1152 for (i=(
int)yyleng-1;i>=0;i--)
1163 yyextra->current->program << yytext;
1170 for (i=(
int)yyleng-1;i>=0;i--)
1181 yyextra->current->program << yytext;
1185 yyextra->current->program << yytext;
1193 DBG_CTX((stderr,
"yyextra->curIndent=%d yyextra->indent=%d\n",yyextra->curIndent,yyextra->indent));
1194 if (yyextra->curIndent<=yyextra->indent)
1198 yyextra->indent=yyextra->curIndent;
1206 yyextra->current->program << yytext;
1210 yyextra->current->program << *yytext;
1211 yyextra->stringContext=YY_START;
1212 yyextra->specialBlock =
false;
1213 yyextra->copyString=&yyextra->current->program;
1214 BEGIN( SingleQuoteString );
1217 yyextra->current->program << *yytext;
1218 yyextra->stringContext=YY_START;
1219 yyextra->specialBlock =
false;
1220 yyextra->copyString=&yyextra->current->program;
1221 BEGIN( DoubleQuoteString );
1224 yyextra->current->program << yytext;
1225 yyextra->specialBlock =
false;
1229 yyextra->current->program << *yytext;
1233 yyextra->current->program << yytext;
1236 yyextra->specialBlock =
false;
1237 yyextra->current->program << *yytext;
1241 yyextra->current->program << yytext;
1243 BEGIN(TripleComment);
1248 yyextra->current->program << yytext;
1250 BEGIN(TripleComment);
1256 yyextra->current->name = yytext;
1259 yyextra->bracketDepth=1;
1260 yyextra->genericsContext = YY_START;
1261 yyextra->genericsValue =
"[";
1265 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...
1287<ClassDec>{IDENTIFIER} {
1288 if (yyextra->current->type.empty())
1290 yyextra->current->type =
"class";
1293 yyextra->current->section = EntryType::makeClass();
1294 yyextra->current->name = yytext;
1299 if (yyextra->current_root->section.isScope())
1302 yyextra->current->name.prepend(yyextra->current_root->name+
"::");
1305 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
1306 yyextra->current->fileName = yyextra->fileName;
1307 yyextra->docBlockContext = YY_START;
1308 yyextra->docBlockInBody =
false;
1309 yyextra->docBlockJavaStyle =
false;
1310 yyextra->docBlock.clear();
1311 yyextra->bracketDepth = 0;
1313 BEGIN(ClassInheritance);
1320 yyextra->bracketDepth=1;
1321 yyextra->genericsContext = YY_START;
1322 yyextra->genericsValue =
"[";
1326 yyextra->specialBlock =
true;
1327 yyextra->current->bodyLine = yyextra->yyLineNr;
1328 yyextra->current->program.str(std::string());
1329 BEGIN(ClassCaptureIndent);
1333 yyextra->current->extends.emplace_back(
1334 substitute(yytext,
".",
"::"),Protection::Public,Specifier::Normal
1338 yyextra->stringContext=YY_START;
1339 BEGIN( SingleQuoteStringIgnore );
1342 yyextra->stringContext=YY_START;
1343 BEGIN( DoubleQuoteStringIgnore );
1347<SingleQuoteStringIgnore>{
1349 BEGIN(yyextra->stringContext);
1353<DoubleQuoteStringIgnore>{
1355 BEGIN(yyextra->stringContext);
1360<ClassCaptureIndent>{
1364 yyextra->current->program << yytext;
1369 yyextra->current->program << yytext;
1370 BEGIN(TripleComment);
1374 yyextra->current->program << yytext;
1375 BEGIN(TripleComment);
1377 {STARTDOCSYMS}[#]* {
1379 BEGIN(SpecialComment);
1384 yyextra->current->program << yytext;
1387 yyextra->bodyEntry = yyextra->current;
1388 DBG_CTX((stderr,
"setting indent %d\n",yyextra->curIndent));
1394 ""/({NONEMPTY}|{EXPCHAR}) {
1398 yyextra->current->program << yytext;
1407 ":"{B}{IDENTIFIER} {
1408 yyextra->startInit =
false;
1409 yyextra->current->type =
substitute(yytext,
":",
"");
1411 {STARTDOCSYMS}"<"/.* {
1413 yyextra->packageCommentAllowed =
false;
1415 yyextra->docBlockContext = VariableEnd;
1416 BEGIN(SpecialComment);
1419 BEGIN( VariableEnd );
1423 BEGIN( VariableEnd );
1429 yyextra->current->initializer << *yytext;
1430 if (yyextra->atomStart==*yytext)
1432 yyextra->atomCount++;
1436 yyextra->current->initializer << *yytext;
1437 if (yyextra->atomEnd==*yytext)
1439 yyextra->atomCount--;
1441 if (yyextra->atomCount==0)
1443 yyextra->startInit =
false;
1444 BEGIN(yyextra->atomContext);
1448 yyextra->specialBlock =
false;
1449 yyextra->current->program << yytext;
1451 BEGIN(TripleComment);
1455 yyextra->specialBlock =
false;
1456 yyextra->current->program << yytext;
1458 BEGIN(TripleComment);
1461 yyextra->stringContext=YY_START;
1462 yyextra->current->initializer <<
"'";
1463 yyextra->copyString=&yyextra->current->initializer;
1464 BEGIN( SingleQuoteString );
1467 yyextra->stringContext=YY_START;
1468 yyextra->current->initializer <<
"\"";
1469 yyextra->copyString=&yyextra->current->initializer;
1470 BEGIN( DoubleQuoteString );
1473 yyextra->current->initializer << yytext;
1476 yyextra->current->initializer << yytext;
1479 yyextra->current->initializer << *yytext;
1482 yyextra->current->initializer << *yytext;
1507 {ENDTRIDOUBLEQUOTE} |
1508 {ENDTRISINGLEQUOTE} {
1510 if (yyextra->doubleQuote==(yytext[0]==
'"'))
1512 if (yyextra->specialBlock)
1514 DString actualDoc=yyextra->docBlock;
1515 if (!yyextra->docBlockSpecial)
1517 if (!actualDoc.
empty())
1520 actualDoc.
prepend(
"@iverbatim\n");
1521 actualDoc.
append(
"@endiverbatim ");
1527 else if (yyextra->packageCommentAllowed)
1529 DString actualDoc=yyextra->docBlock;
1530 if (!yyextra->docBlockSpecial)
1532 if (!actualDoc.
empty())
1535 actualDoc.
prepend(
"@iverbatim\n");
1536 actualDoc.
append(
"@endiverbatim ");
1539 if (yyextra->moduleScope.startsWith(
"__") && yyextra->moduleScope.endsWith(
"__"))
1541 actualDoc.
prepend(
"\\namespace \\"+yyextra->moduleScope+
" ");
1545 actualDoc.
prepend(
"\\namespace "+yyextra->moduleScope+
" ");
1549 if ((yyextra->docBlockContext==ClassBody ) ||
1550 yyextra->docBlockContext==FunctionBody)
1552 yyextra->current->program << yyextra->docBlock;
1553 yyextra->current->program << yytext;
1560 BEGIN(yyextra->docBlockContext);
1564 yyextra->docBlock += yytext;
1566 yyextra->packageCommentAllowed =
false;
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
DString & prepend(const char *s)
void stripIndentationVerbatim(DString &doc, size_t indentationLevel, bool skipFirstLine)
1571 if (yyextra->firstPass && yyextra->docBlockSpecial && yyleng >= yyextra->curIndent)
1572 yyextra->docBlock += yytext + yyextra->curIndent;
1574 yyextra->docBlock += yytext;
1577 yyextra->docBlock += yytext;
1581 yyextra->docBlock += yytext;
1583 {CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
1584 yyextra->fileName = &yytext[6];
1585 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1586 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
1587 yyextra->docBlock+=yytext;
1589 {CMD}"ifile"{B}+{FILEMASK} {
1590 yyextra->fileName = &yytext[6];
1591 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1592 yyextra->docBlock+=yytext;
1594 {CMD}"iline"{LINENR}/[\n\.] |
1595 {CMD}"iline"{LINENR}{B} {
1600 warn(yyextra->fileName,yyextra->yyLineNr,
"Invalid line number '{}' for iline command",yytext);
1604 yyextra->yyLineNr = nr;
1606 yyextra->docBlock+=yytext;
int toInt(bool *ok=nullptr, int base=10) const
#define warn(file, line, fmt,...)
1608 ({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
1609 yyextra->docBlock+=yytext;
1612 yyextra->docBlock += yytext;
1615 yyextra->docBlock += yytext;
1623 yyextra->docBlock+=
'\n';
1624 yyextra->docBrief =
false;
1627 {CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
1628 yyextra->fileName = &yytext[6];
1629 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1630 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
1631 yyextra->docBlock+=yytext;
1633 {CMD}"ifile"{B}+{FILEMASK} {
1634 yyextra->fileName = &yytext[6];
1635 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1636 yyextra->docBlock+=yytext;
1638 {CMD}"iline"{LINENR}/[\n\.] |
1639 {CMD}"iline"{LINENR}{B} {
1644 warn(yyextra->fileName,yyextra->yyLineNr,
"Invalid line number '{}' for iline command",yytext);
1648 yyextra->yyLineNr = nr;
1650 yyextra->docBlock+=yytext;
1652 ({CMD}{CMD}){ID}/[^a-z_A-Z0-9] {
1653 yyextra->docBlock+=yytext;
1657 int extraSpaces = std::max(0,
static_cast<int>(yyleng-9-yyextra->curIndent-2));
1658 indent.
fill(
' ',extraSpaces);
1660 yyextra->docBlock +=
"\\ilinebr ";
1661 yyextra->docBlock += indent;
DString fill(char c, size_t len)
Fills a string with a predefined character.
1664 yyextra->docBlock+=yytext;
1668 if (yyextra->docBlockContext == VariableEnd)
1676 BEGIN(yyextra->docBlockContext);
1679 yyextra->docBlock+=*yytext;
1696 BEGIN(yyextra->stringContext);
1719 BEGIN(yyextra->stringContext);
1730 {ENDTRIDOUBLEQUOTE} |
1731 {ENDTRISINGLEQUOTE} {
1732 *yyextra->copyString << yytext;
1733 if (yyextra->doubleQuote==(yytext[0]==
'"'))
1735 BEGIN(yyextra->stringContext);
1740 ({LONGSTRINGBLOCK}) {
1742 *yyextra->copyString << yytext;
1746 *yyextra->copyString << yytext;
1749 *yyextra->copyString << *yytext;
1755 yyextra->doubleQuote=
true;
1756 yyextra->decoratorCommentStr.str(std::string());
1757 yyextra->copyString=&yyextra->decoratorCommentStr;
1758 yyextra->stringContext=YY_START;
1759 BEGIN(TripleString);
1763 yyextra->doubleQuote=
false;
1764 yyextra->decoratorCommentStr.str(std::string());
1765 yyextra->copyString=&yyextra->decoratorCommentStr;
1766 yyextra->stringContext=YY_START;
1767 BEGIN(TripleString);
1770 yyextra->stringContext=YY_START;
1771 yyextra->decoratorCommentStr.str(std::string());
1772 yyextra->copyString=&yyextra->decoratorCommentStr;
1773 BEGIN( SingleQuoteString );
1776 yyextra->stringContext=YY_START;
1777 yyextra->decoratorCommentStr.str(std::string());
1778 yyextra->copyString=&yyextra->decoratorCommentStr;
1779 BEGIN( DoubleQuoteString );
1782 yyextra->decoratorRound++;
1785 yyextra->decoratorRound--;
1786 if (!yyextra->decoratorRound) BEGIN( Search );
1829 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1831 const char *p = yyextra->inputString + yyextra->inputPosition;
1832 while ( c < max_size && *p ) { *buf++ = *p++; c++; }
1833 yyextra->inputPosition+=c;
1839 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1840 yyextra->protection = Protection::Public;
1841 yyextra->mtype = MethodTypes::Method;
1842 yyextra->isStatic =
false;
1843 yyextra->virt = Specifier::Normal;
1844 yyextra->previous = 0;
1845 yyextra->packageCommentAllowed =
true;
1850 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1852 yyextra->current->protection = yyextra->protection ;
1853 yyextra->current->mtype = yyextra->mtype;
1854 yyextra->current->virt = yyextra->virt;
1855 yyextra->current->isStatic = yyextra->isStatic;
1856 yyextra->current->lang = SrcLangExt::Python;
1857 yyextra->current->type.clear();
1858 yyextra->current->name.clear();
1859 yyextra->current->initializer.clear();
1860 yyextra->commentScanner.initGroupInfo(yyextra->current.get());
1861 yyextra->isStatic =
false;
1866 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1867 if (yyextra->current->name.empty())
1873 if (yyextra->checkDupEntry)
1875 for (
auto &v : yyextra->current_root->children())
1878 if (v->name==yyextra->current->name && v->section==yyextra->current->section)
1880 if (v->doc.empty() && !yyextra->current->doc.empty())
1882 v->doc = yyextra->current->doc;
1883 v->docLine = yyextra->current->docLine;
1884 v->docFile = yyextra->current->docFile;
1886 if (v->brief.empty() && !yyextra->current->brief.empty())
1888 v->brief = yyextra->current->brief;
1889 v->briefLine = yyextra->current->briefLine;
1890 v->briefFile = yyextra->current->briefFile;
1892 if (v->type.empty() && !yyextra->current->type.empty())
1895 v->type = yyextra->current->type;
1904 yyextra->previous = yyextra->current;
1905 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
1912 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1914 auto doc = yyextra->current->doc;
1915 auto docLine = yyextra->current->docLine;
1916 auto docFile = yyextra->current->docFile;
1917 auto brief = yyextra->current->brief;
1918 auto briefLine = yyextra->current->briefLine;
1919 auto briefFile = yyextra->current->briefFile;
1921 yyextra->previous = yyextra->current;
1922 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
1925 yyextra->current->doc = doc;
1926 yyextra->current->docLine = docLine;
1927 yyextra->current->docFile = docFile;
1928 yyextra->current->brief = brief;
1929 yyextra->current->briefLine = briefLine;
1930 yyextra->current->briefFile = briefFile;
1935 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1936 if (!yyextra->current->name.empty() && yyextra->current->name.at(0)==
'_')
1938 if (yyextra->current->name.at(1)==
'_')
1940 yyextra->current->protection=Protection::Private;
1944 yyextra->current->protection=Protection::Protected;
1951 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1952 yyextra->current->name = name;
1953 yyextra->current->section=EntryType::makeVariable();
1954 yyextra->current->fileName = yyextra->fileName;
1955 yyextra->current->startLine = yyextra->yyLineNr;
1956 yyextra->current->bodyLine = yyextra->yyLineNr;
1957 yyextra->current->type.clear();
1959 yyextra->checkDupEntry =
true;
1964 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1966 if (yyextra->current_root->section.isCompound())
1968 yyextra->current->isStatic =
true;
1982 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1984 if (yyextra->current_root->section.isCompound())
1986 yyextra->current->isStatic =
true;
1993 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1994 if (yyextra->current->name.startsWith(
"__") && yyextra->current->name.endsWith(
"__"))
1998 yyextra->current->protection=Protection::Public;
2015 else if (c==
'\t') col+=tabSize-(col%tabSize);
2023 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2024 auto it = yyextra->packageNameCache.
find(path.
str());
2025 if (it!=yyextra->packageNameCache.end())
2032 size_t i=path.
rfind(
'/');
2040 scope+=path.
mid(i+1);
2041 yyextra->packageNameCache.emplace(path.
str(),scope.
str());
2050 if (fileName.
empty())
return fileName;
2057 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2058 DString item=all ? yyextra->packageName : yyextra->packageName+
"."+yytext;
2060 yyextra->current->fileName = yyextra->fileName;
2062 yyextra->current->section=all ? EntryType::makeUsingDir() : EntryType::makeUsingDecl();
2063 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
2070 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2071 DBG_CTX((stderr,
"yyextra->yyLineNr=%d\n",yyextra->yyLineNr));
2072 for (
const char *p = yytext; *p; ++p)
2074 yyextra->yyLineNr += (*p ==
'\n') ;
2080 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2081 DBG_CTX((stderr,
"yyextra->yyLineNr=%d\n",yyextra->yyLineNr));
2082 yyextra->yyLineNr++;
2088 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2091 yyextra->current->briefFile = yyextra->fileName;
2092 yyextra->current->briefLine = yyextra->yyLineNr;
2096 yyextra->current->docFile = yyextra->fileName;
2097 yyextra->current->docLine = yyextra->yyLineNr;
2103 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2108 yyextra->docBlockInBody=
false;
2110 if (!yyextra->current->doc.empty())
2112 yyextra->current->doc=yyextra->current->doc.stripWhiteSpace()+
"\n\n";
2114 if (yyextra->docBlockInBody && yyextra->previous && !yyextra->previous->doc.empty())
2116 yyextra->previous->doc=yyextra->previous->doc.stripWhiteSpace()+
"\n\n";
2120 bool needsEntry =
false;
2121 int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine;
2122 Markdown markdown(yyextra->fileName,lineNr);
2127 while (yyextra->commentScanner.parseCommentBlock(
2128 yyextra->thisParser,
2129 (yyextra->docBlockInBody && yyextra->previous) ? yyextra->previous.get() : yyextra->current.get(),
2133 yyextra->docBlockInBody ?
false : brief,
2134 yyextra->docBlockJavaStyle,
2135 yyextra->docBlockInBody,
2136 yyextra->protection,
2158 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2160 if (yyextra->bodyEntry)
2162 yyextra->bodyEntry->endBodyLine = yyextra->yyLineNr-correction;
2163 yyextra->bodyEntry = 0;
2171 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2172 if (yyextra->copyString) (*yyextra->copyString) << s;
2177 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2178 yyextra->docBlockContext = YY_START;
2179 yyextra->docBlockInBody =
false;
2180 yyextra->docBlockJavaStyle =
true;
2181 yyextra->docBlockSpecial = yytext[strlen(yytext) - 1]==
'!' || !
Config_getBool(PYTHON_DOCSTRING);
2182 yyextra->docBlock.clear();
2183 yyextra->commentIndent = yyextra->curIndent;
2184 yyextra->doubleQuote =
true;
2190 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2191 yyextra->docBlockContext = YY_START;
2192 yyextra->docBlockInBody =
false;
2193 yyextra->docBlockJavaStyle =
true;
2194 yyextra->docBlockSpecial = yytext[strlen(yytext) - 1]==
'!' || !
Config_getBool(PYTHON_DOCSTRING);
2195 yyextra->docBlock.clear();
2196 yyextra->commentIndent = yyextra->curIndent;
2197 yyextra->doubleQuote =
false;
2203 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2204 yyextra->docBlockContext = YY_START;
2205 yyextra->docBlockInBody =
false;
2206 yyextra->docBlockJavaStyle =
true;
2207 yyextra->docBrief =
true;
2208 yyextra->docBlock.clear();
2209 yyextra->commentIndent = yyextra->curIndent;
2215 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2216 yyextra->current->fileName = yyextra->fileName;
2217 yyextra->current->startLine = yyextra->yyLineNr;
2218 yyextra->current->bodyLine = yyextra->yyLineNr;
2219 yyextra->current->section = EntryType::makeFunction();
2220 yyextra->current->lang = SrcLangExt::Python;
2221 yyextra->current->virt = Specifier::Normal;
2222 yyextra->current->isStatic = yyextra->isStatic;
2223 yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
2224 yyextra->current->type.clear();
2225 yyextra->current->name.clear();
2226 yyextra->current->args.clear();
2227 yyextra->current->argList.clear();
2228 yyextra->packageCommentAllowed =
false;
2229 yyextra->isStatic=
false;
2235 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2236 yyextra->current->section = EntryType::makeClass();
2237 yyextra->current->argList.clear();
2238 yyextra->current->type +=
"class" ;
2239 yyextra->current->fileName = yyextra->fileName;
2240 yyextra->current->startLine = yyextra->yyLineNr;
2241 yyextra->current->bodyLine = yyextra->yyLineNr;
2242 yyextra->packageCommentAllowed =
false;
2247 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2248 yyextra->current->section = EntryType::makeVariable();
2249 yyextra->current->argList.clear();
2250 yyextra->current->type =
"typedef " ;
2251 yyextra->current->spec.setAlias(
true);
2252 yyextra->current->fileName = yyextra->fileName;
2253 yyextra->current->startLine = yyextra->yyLineNr;
2254 yyextra->current->bodyLine = yyextra->yyLineNr;
2255 yyextra->packageCommentAllowed =
false;
2262 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2264 for (
size_t i=0; i<rt->children().size(); ++i)
2266 std::shared_ptr<Entry> ce = rt->children()[i];
2267 if (!ce->program.empty())
2272 yyextra->programStr = ce->program.str();
2273 yyextra->inputString = yyextra->programStr.data();
2274 yyextra->inputPosition = 0;
2275 yyextra->firstPass =
false;
2276 pyscannerYYrestart(
nullptr, yyscanner );
2277 if (ce->section.isCompound())
2279 yyextra->specialBlock =
false;
2280 yyextra->current_root = ce;
2283 else if (ce->parent())
2285 yyextra->current_root = rt;
2288 BEGIN( SearchMemVars );
2290 yyextra->fileName = ce->fileName;
2291 yyextra->yyLineNr = ce->bodyLine ;
2292 yyextra->current = std::make_shared<Entry>();
2295 yyextra->checkDupEntry =
false;
2298 yyextra->commentScanner.enterCompound(yyextra->fileName,yyextra->yyLineNr,name);
2300 pyscannerYYlex(yyscanner) ;
2301 yyextra->lexInit=
true;
2303 yyextra->programStr.clear();
2304 ce->program.str(std::string());
2306 yyextra->commentScanner.leaveCompound(yyextra->fileName,yyextra->yyLineNr,name);
2318 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2321 if (fileBuf==
nullptr || fileBuf[0]==
'\0')
return;
2323 yyextra->inputString = fileBuf;
2324 yyextra->inputPosition = 0;
2326 yyextra->protection = Protection::Public;
2327 yyextra->mtype = MethodTypes::Method;
2328 yyextra->isStatic =
false;
2329 yyextra->virt = Specifier::Normal;
2330 yyextra->current_root = rt;
2331 yyextra->specialBlock =
false;
2333 yyextra->yyLineNr = 1 ;
2334 yyextra->fileName = fileName;
2335 yyextra->checkDupEntry =
false;
2336 yyextra->firstPass =
true;
2338 msg(
"Parsing file {}...\n",yyextra->fileName);
2343 if (baseName!=
"__init__")
2345 if (!yyextra->moduleScope.empty())
2347 yyextra->moduleScope+=
"::";
2349 yyextra->moduleScope+=baseName;
2353 DString scope = yyextra->moduleScope;
2354 size_t startPos = 0;
2358 pos = scope.
find(
"::",startPos);
2361 startPos = pos = scope.
length();
2367 yyextra->current = std::make_shared<Entry>();
2369 yyextra->current->name = scope.
left(pos);
2370 yyextra->current->section = EntryType::makeNamespace();
2371 yyextra->current->type =
"namespace";
2372 yyextra->current->fileName = yyextra->fileName;
2373 yyextra->current->startLine = yyextra->yyLineNr;
2374 yyextra->current->bodyLine = yyextra->yyLineNr;
2375 yyextra->current_root = yyextra->current;
2376 rt->moveToSubEntryAndRefresh(yyextra->current);
2377 }
while (pos<scope.
length());
2381 yyextra->commentScanner.enterFile(yyextra->fileName,yyextra->yyLineNr);
2383 yyextra->current->reset();
2385 pyscannerYYrestart(
nullptr,yyscanner);
2387 pyscannerYYlex(yyscanner);
2388 yyextra->lexInit=
true;
2390 yyextra->commentScanner.leaveFile(yyextra->fileName,yyextra->yyLineNr);
2392 yyextra->programStr.clear();
2393 yyextra->current_root->program.str(std::string());
2402 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
2406 warn(yyextra->fileName,yyextra->yyLineNr,
"Empty prototype found!");
2410 yyextra->specialBlock =
false;
2411 yyextra->packageCommentAllowed =
false;
2414 YY_BUFFER_STATE orgState = YY_CURRENT_BUFFER;
2415 yy_switch_to_buffer(yy_create_buffer(
nullptr,
YY_BUF_SIZE, yyscanner), yyscanner);
2416 const char *orgInputString = yyextra->inputString;
2417 int orgInputPosition = yyextra->inputPosition;
2420 yyextra->inputString = text.
data();
2421 yyextra->inputPosition = 0;
2422 pyscannerYYrestart(
nullptr, yyscanner );
2424 BEGIN( FunctionDec );
2426 pyscannerYYlex(yyscanner);
2427 yyextra->lexInit=
true;
2429 yyextra->current->name = yyextra->current->name.stripWhiteSpace();
2430 if (yyextra->current->section.isMemberDoc() && yyextra->current->args.empty())
2432 yyextra->current->section = EntryType::makeVariableDoc();
2437 yy_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
2438 yy_switch_to_buffer(orgState, yyscanner);
2440 yyextra->inputString = orgInputString;
2441 yyextra->inputPosition = orgInputPosition;
2456 pyscannerYYlex_init_extra(&
p->state,&
p->yyscanner);
2464 pyscannerYYlex_destroy(
p->yyscanner);
2469 const char *fileBuf,
2470 const std::shared_ptr<Entry> &root,
2473 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
2474 yyextra->thisParser =
this;
2494#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 int yyread(yyscan_t yyscanner, char *buf, int max_size)
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)