28%option never-interactive
29%option case-insensitive
31%option prefix="fortrancodeYY"
32%option extra-type="struct fortrancodeYY_state *"
37#define YY_TYPEDEF_YY_SCANNER_T
71#define DBG_CTX(x) do { } while(0)
73#define YY_NO_TOP_STATE 1
75#define YY_NO_UNISTD_H 1
87#define YY_USER_ACTION {yy_old_start = yy_my_start; yy_my_start = yy_end; yy_end += static_cast<int>(yyleng);}
88#define YY_FTN_RESET {yy_old_start = 0; yy_my_start = 0; yy_end = 1;}
89#define YY_FTN_REJECT {yy_end = yy_my_start; yy_my_start = yy_old_start; REJECT;}
107class UseMap :
public std::map<std::string,UseEntry>
220#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
A abstract class representing of a compound symbol.
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
The common base class of all entity definitions found in the sources.
A model of a file symbol.
A model of a class/file/namespace member symbol.
An abstract interface of a namespace symbol.
Class representing a list of different code generators.
Contains names of used modules and names of local variables.
StringUnorderedSet externalVars
contains names of external entities
StringUnorderedSet localVars
contains names of local variables
std::vector< DString > useNames
contains names of used modules
std::vector< DString > onlyNames
module name -> list of ONLY/remote entries (module name = name of the module, which can be accessed v...
std::unordered_set< std::string > StringUnorderedSet
static void writeMultiLineCodeLink(yyscan_t yyscanner, OutputCodeList &ol, Definition *d, const DString &text)
static void addUse(yyscan_t yyscanner, const DString &moduleName)
static void startScope(yyscan_t yyscanner)
start scope
static void endCodeLine(yyscan_t yyscanner)
static void endScope(yyscan_t yyscanner)
end scope
static bool getLink(yyscan_t yyscanner, const UseMap &useMap, const DString &memberText, OutputCodeList &ol, const DString &text)
static void nextCodeLine(yyscan_t yyscanner)
static void startCodeLine(yyscan_t yyscanner)
static void setCurrentDoc(yyscan_t yyscanner, const DString &anchor)
static MemberDef * getFortranDefs(yyscan_t yyscanner, const DString &memberName, const DString &moduleName, const UseMap &useMap)
searches for definition of function memberName
static void generateLink(yyscan_t yyscanner, OutputCodeList &ol, const DString &lname)
static int countLines(yyscan_t yyscanner)
static bool getFortranNamespaceDefs(const DString &mname, NamespaceDef *&cd)
searches for definition of a module (Namespace)
static bool getFortranTypeDefs(const DString &tname, const DString &moduleName, ClassDef *&cd, const UseMap &useMap)
searches for definition of a type
static void pop_state(yyscan_t yyscanner)
static bool getGenericProcedureLink(yyscan_t yyscanner, const ClassDef *cd, const DString &memberText, OutputCodeList &ol)
gets the link to a generic procedure which depends not on the name, but on the parameter list
static void addToSearchIndex(yyscan_t yyscanner, const DString &text)
static void codifyLines(yyscan_t yyscanner, const DString &text)
static void startFontClass(yyscan_t yyscanner, const char *s, bool specialComment=false)
static void endFontClass(yyscan_t yyscanner, bool specialComment=false)
static void addLocalVar(yyscan_t yyscanner, const DString &varName)
Web server based search engine.
DString str
contents of fortran string
TooltipManager tooltipManager
bool insideSpecialComment
DString docBlock
contents of all lines of a documentation block
int * hasContLine
signals whether or not a line has a continuation line (fixed source form)
bool insideBody
inside subprog/program body? => create links
int contLineNr
current, local, line number for continuation determination
int inputPosition
read offset during parsing
std::vector< Scope > scopeStack
std::unique_ptr< FileDef > exampleFileDef
const FileDef * sourceFileDef
const MemberDef * currentMemberDef
const Definition * searchCtx
UseEntry useEntry
current use statement info
DString currentModule
name of the current enclosing module
int yyLineNr
current line number
UseMap useMembers
info about used modules
std::vector< const Definition * > foldStack
const char * inputString
the code fragment as text
int inputLines
number of line in the code fragment
const Definition * currentDefinition
const char * currentFontClass
A bunch of utility functions.
230SUBPROG (subroutine|function)
235ARGS_L1a [^()]*"("[^)]*")"[^)]*
236ARGS_L1 ("("{ARGS_L1a}*")")
237ARGS_L2 "("({ARGS_L0}|[^()]|{ARGS_L1a}|{ARGS_L1})*")"
238ARGS {BS}({ARGS_L0}|{ARGS_L1}|{ARGS_L2})
240NUM_TYPE (complex|integer|logical|real)
241LOG_OPER (\.and\.|\.eq\.|\.eqv\.|\.ge\.|\.gt\.|\.le\.|\.lt\.|\.ne\.|\.neqv\.|\.or\.|\.not\.)
243CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS}))
244TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}|TYPE|CLASS|PROCEDURE|ENUMERATOR)
246INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")"
247ATTR_SPEC (IMPLICIT|ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|(NON_)?RECURSIVE|PURE|IMPURE|ELEMENTAL|VALUE|NOPASS|DEFERRED|CONTIGUOUS|VOLATILE)
248ACCESS_SPEC (PROTECTED|PRIVATE|PUBLIC)
250FLOW (DO|SELECT|CASE|SELECT{BS}(CASE|TYPE|RANK)|WHERE|IF|THEN|ELSE|WHILE|FORALL|ELSEWHERE|ELSEIF|RETURN|CONTINUE|EXIT|GO{BS}TO)
251COMMANDS (FORMAT|CONTAINS|MODULE{BS_}PROCEDURE|WRITE|READ|ALLOCATE|ALLOCATED|ASSOCIATED|PRESENT|DEALLOCATE|NULLIFY|SIZE|INQUIRE|OPEN|CLOSE|FLUSH|DATA|COMMON)
253PREFIX ((NON_)?RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,4}((NON_)?RECURSIVE|IMPURE|PURE|ELEMENTAL)?0
254LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?")"
282<Start>{IGNORE}/{BS}"(" {
287<Start>{COMMANDS}/{BS}[,( \t\n] {
293<Start>{FLOW}/{BS}[,( \t\n] {
294 if (yyextra->isFixedForm)
298 if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
static std::mutex countFlowKeywordsMutex
virtual void incrementFlowKeyWordCount()=0
MemberDefMutable * toMemberDefMutable(Definition *d)
312<Start>{BS}(RANK){BS_}(DEFAULT) |
313<Start>{BS}(RANK)/{BS}"("{BS}([0-9]+|"*"){BS}")" |
314<Start>{BS}(CASE|CLASS|TYPE){BS_}(IS|DEFAULT) {
319<Start>{BS}"end"({BS}{FLOW})/[ \t\n] {
324<Start>"implicit"{BS}("none"|{TYPE_SPEC}) {
329<Start>^{BS}"namelist"/[/] {
339 yy_push_state(YY_START,yyscanner);
346 yy_push_state(YY_START,yyscanner);
352 yyextra->insideBody=
true;
354 yyextra->insideBody=
false;
358 yyextra->useEntry.module = tmp;
359 yyextra->useMembers.emplace(tmp.str(), yyextra->useEntry);
362<Use,UseOnly,Import>{BS},{BS} {
codifyLines(yyscanner,yytext); }
363<UseOnly,Import>{BS}&{BS}"\n" {
codifyLines(yyscanner,yytext);
364 yyextra->contLineNr++;
369 yyextra->useEntry.onlyNames.push_back(tmp);
370 yyextra->insideBody=
true;
372 yyextra->insideBody=
false;
374<Use,UseOnly,Import>"\n" {
379<*>"import"{BS}/"\n" |
385 yy_push_state(YY_START,yyscanner);
389 yyextra->insideBody=
true;
391 yyextra->insideBody=
false;
393<Import>("ONLY"|"NONE"|"ALL") {
399<Start>("block"{BS}"data"|"program"|"module"|"interface")/{BS_}|({COMMA}{ACCESS_SPEC})|\n {
404 yy_push_state(YY_START,yyscanner);
406 if (!
dstricmp(yytext,
"module")) yyextra->currentModule=
"module";
int dstricmp(const char *s1, const char *s2)
408<Start>("enum")/{BS_}|{BS}{COMMA}{BS}{LANGUAGE_BIND_SPEC}|\n {
413 yy_push_state(YY_START,yyscanner);
416<*>{LANGUAGE_BIND_SPEC} {
422<Start>("type")/{BS_}|({COMMA}({ACCESS_SPEC}|ABSTRACT|EXTENDS))|\n {
427 yy_push_state(YY_START,yyscanner);
431 if (yyextra->currentModule ==
"module")
433 yyextra->currentModule=yytext;
434 yyextra->currentModule = yyextra->currentModule.lower();
439<ClassName>({ACCESS_SPEC}|ABSTRACT|EXTENDS)/[,:( ] {
441 yyextra->code->codify(yytext);
448<Start>^{BS}"end"({BS_}"enum").* {
451<Start>^{BS}"end"({BS_}"type").* {
454<Start>^{BS}"end"({BS_}"module").* {
455 yyextra->currentModule=
nullptr;
459<Start>({PREFIX}{BS_})?{TYPE_SPEC}{BS_}({PREFIX}{BS_})?{BS}/{SUBPROG}{BS_} {
464<Start>({PREFIX}{BS_})?{SUBPROG}{BS_} {
468 yy_push_state(YY_START,yyscanner);
472 DBG_CTX((stderr,
"===> start subprogram %s\n", yytext));
476<Subprog>"result"/{BS}"("[^)]*")" {
481<Subprog>"("[^)]*")" {
484<Subprog,Subprogend>"\n" {
codifyLines(yyscanner,yytext);
485 yyextra->contLineNr++;
489<Start>"end"{BS}("block"{BS}"data"|{SUBPROG}|"module"|"program"|"enum"|"type"|"interface")?{BS} {
495 yy_push_state(YY_START,yyscanner);
498<Subprogend>{ID}/{BS}(\n|!|;) {
502<Start>"end"{BS}("block"{BS}"data"|{SUBPROG}|"module"|"program"|"enum"|"type"|"interface"){BS}/(\n|!|;) {
510<Start>^{BS}"real"/[,:( ] {
511 yy_push_state(YY_START,yyscanner);
514 yyextra->code->codify(yytext);
517<Start>{TYPE_SPEC}/[,:( ] {
521 if (typ ==
"type" || typ ==
"class" || typ ==
"procedure") yyextra->inTypeDecl = 1;
522 yy_push_state(YY_START,yyscanner);
525 yyextra->code->codify(yytext);
DString removeRedundantWhiteSpace(const DString &s)
529 if (
DString(yytext) ==
"external")
531 yy_push_state(YY_START,yyscanner);
533 yyextra->isExternal =
true;
536 yyextra->code->codify(yytext);
539<Declaration>({TYPE_SPEC}|{ATTR_SPEC})/[,:( ] {
540 if (
DString(yytext) ==
"external") yyextra->isExternal =
true;
542 yyextra->code->codify(yytext);
549 yyextra->code->codify(yytext);
552 else if (yyextra->currentMemberDef &&
553 ((yyextra->currentMemberDef->isFunction() && (yyextra->currentMemberDef->typeString()!=
DString(
"subroutine") || yyextra->inTypeDecl)) ||
554 yyextra->currentMemberDef->isVariable() || yyextra->currentMemberDef->isEnumValue()
562 yyextra->code->codify(yytext);
566<Declaration>{BS}("=>"|"="){BS} {
567 BEGIN(DeclarationBinding);
568 yyextra->code->codify(yytext);
570<DeclarationBinding>{ID} {
575 yyextra->bracketCount++;
576 yyextra->code->codify(yytext);
580 yyextra->bracketCount--;
581 if (!yyextra->bracketCount) yyextra->inTypeDecl = 0;
582 yyextra->code->codify(yytext);
585<Declaration,DeclarationBinding>"&" {
586 yyextra->code->codify(yytext);
587 if (!yyextra->isFixedForm)
589 yy_push_state(YY_START,yyscanner);
594 yyextra->contLineNr++;
596 yyextra->bracketCount = 0;
600<Declaration,DeclarationBinding>"\n" {
601 if (yyextra->endComment)
603 yyextra->endComment=
false;
609 yyextra->bracketCount = 0;
610 yyextra->contLineNr++;
611 if (!(yyextra->hasContLine && yyextra->hasContLine[yyextra->contLineNr - 1]))
613 yyextra->isExternal =
false;
625 yy_push_state(YY_START,yyscanner);
629 yyextra->insideBody=
true;
631 yyextra->insideBody=
false;
642 yy_push_state(YY_START,yyscanner);
647 yyextra->code->codify(
DString(yytext + 4));
651 yyextra->insideBody=
true;
653 yyextra->insideBody=
false;
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...
658<Start,Declaration,DeclarationBinding>\n?{BS}"!>"|"!<" {
659 if (yytext[0] ==
'\n')
661 yyextra->contLineNr++;
664 yy_end =
static_cast<int>(yyleng);
668 yy_push_state(YY_START,yyscanner);
670 yyextra->docBlock=yytext;
672<Declaration,DeclarationBinding>{BS}"!<" {
673 yy_push_state(YY_START,yyscanner);
675 yyextra->docBlock=yytext;
679 yyextra->docBlock+=yytext;
681<DocBlock>"\n"{BS}("!>"|"!<"|"!!") {
682 yyextra->contLineNr++;
685 yy_end =
static_cast<int>(yyleng);
688 yyextra->docBlock+=yytext;
692 yyextra->contLineNr++;
697 yyextra->contLineNr--;
702<*>"!"[^><\n].*|"!"$ {
717<*>"assignment"/{BS}"("{BS}"="{BS}")" {
723<*>"operator"/{BS}"("[^)]*")" {
733 yyextra->contLineNr++;
742 yyextra->code->codify(yytext);
745 yyextra->insideBody=
true;
747 yyextra->insideBody=
false;
751 yyextra->contLineNr++;
752 yyextra->str+=yytext;
761 yyextra->str+=yytext;
767<String>[\x80-\xFF]* |
768<String>. {yyextra->str+=yytext;}
773 yy_push_state(YY_START,yyscanner);
774 yyextra->stringStartSymbol=yytext[0];
781 if (yyextra->endComment)
783 yyextra->endComment=
false;
789 if (yyextra->currentFontClass && !strcmp(yyextra->currentFontClass,
"comment"))
endFontClass(yyscanner);
791 yyextra->contLineNr++;
794<*>^{BS}"type"{BS}"=" { yyextra->code->codify(yytext); }
797 if (yyextra->isFixedForm &&
yy_my_start > yyextra->fixedCommentAfter)
804 yyextra->code->codify(yytext);
808 if (yyextra->isFixedForm &&
yy_my_start > yyextra->fixedCommentAfter)
818 yyextra->code->codify(yytext);
822 yyextra->code->codify(yytext);
825 if (YY_START == DocBlock)
840 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
841 int inputPosition = yyextra->inputPosition;
842 const char *s = yyextra->inputString + inputPosition;
844 while( c < max_size && *s)
849 yyextra->inputPosition += c;
855 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
856 if (yyextra->currentFontClass)
858 yyextra->code->endFontClass();
859 yyextra->currentFontClass=
nullptr;
861 if (specialComment && yyextra->insideSpecialComment)
863 yyextra->code->endSpecialComment();
864 yyextra->insideSpecialComment=
false;
870 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
873 yyextra->code->startSpecialComment();
874 yyextra->insideSpecialComment =
true;
877 if (
dstrcmp(yyextra->currentFontClass,s)!=0)
880 yyextra->code->startFontClass(s);
881 yyextra->currentFontClass=s;
887 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
890 if (yyextra->searchCtx)
913 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
914 while (!yyextra->foldStack.empty())
916 const Definition *dd = yyextra->foldStack.back();
919 yyextra->code->endFold();
921 yyextra->foldStack.pop_back();
932 if (endLine!=-1 && startLine!=endLine &&
940 (yyextra->foldStack.empty() || yyextra->foldStack.back()->getEndBodyLine()!=startLine))
943 yyextra->code->startFold(yyextra->yyLineNr,
"",
"");
944 yyextra->foldStack.push_back(d);
956 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
957 if (yyextra->sourceFileDef && yyextra->lineNumbers)
963 const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
965 if (!yyextra->includeCodeFragment && d)
967 yyextra->currentDefinition = d;
968 yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr);
969 yyextra->insideBody =
false;
970 yyextra->endComment =
false;
972 lineAnchor.
sprintf(
"l%05d",yyextra->yyLineNr);
973 if (yyextra->currentMemberDef)
976 yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(),
977 yyextra->currentMemberDef->getOutputFileBase(),
978 yyextra->currentMemberDef->anchor(),yyextra->yyLineNr,
979 !yyextra->includeCodeFragment);
988 !yyextra->includeCodeFragment);
1000 !yyextra->includeCodeFragment);
1003 yyextra->code->startCodeLine(yyextra->yyLineNr);
1004 yyextra->insideCodeLine=
true;
1005 if (yyextra->currentFontClass)
1007 yyextra->code->startFontClass(yyextra->currentFontClass);
1014 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1016 yyextra->code->endCodeLine();
1017 yyextra->insideCodeLine=
false;
1022 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1023 const char * fc = yyextra->currentFontClass;
1025 if (yyextra->yyLineNr<yyextra->inputLines)
1027 yyextra->currentFontClass = fc;
1037 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1039 if (text.
empty())
return;
1040 const char *p=text.
data(),*sp=p;
1046 while ((c=*p++) && c!=
'\n') { }
1049 yyextra->yyLineNr++;
1050 size_t l =
static_cast<size_t>(p-sp-1);
1051 yyextra->code->codify(
DString(sp,l));
1056 yyextra->code->codify(sp);
1069 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1071 yyextra->tooltipManager.addTooltip(d);
1076 if (!sourceTooltips)
1081 const char *p=text.
data();
1086 while ((c=*p++) && c!=
'\n') { }
1089 yyextra->yyLineNr++;
1112 if (mname.
empty())
return false;
1131 if (tname.
empty())
return false;
1148 for (
const auto &[name,useEntry] : useMap)
1172 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1174 if (memberName.
empty())
return nullptr;
1177 for (
auto it = yyextra->scopeStack.rbegin(); it!=yyextra->scopeStack.rend(); ++it)
1179 const Scope &scope = *it;
1180 std::string lowMemName = memberName.
lower().
str();
1198 for (
const auto &md : *mn)
1200 const FileDef *fd=md->getFileDef();
1201 const GroupDef *gd=md->getGroupDef();
1202 const ClassDef *cd=md->getClassDef();
1211 if (nspace ==
nullptr)
1215 if (md.get()->getFileDef() == yyextra->sourceFileDef)
return md.get();
1216 else if (!potentialMd) potentialMd = md.get();
1219 else if (moduleName == nspace->
name())
1226 auto use_it = useMap.find(usedModuleName.
str());
1227 if (use_it!=useMap.end())
1229 const UseEntry &ue = use_it->second;
1241 if (memberName == name)
1271 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1285 if (yyextra->currentDefinition && yyextra->currentMemberDef &&
1286 yyextra->insideBody && yyextra->collectXRefs)
1301 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1328 else if (
getLink(yyscanner,yyextra->useMembers, name, ol, name))
1345 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1346 const char *p=yyextra->inputString;
1352 if (c==
'\n') count++;
1354 if (p>yyextra->inputString && *(p-1)!=
'\n')
1366 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1367 DBG_CTX((stderr,
"===> startScope %s",yytext));
1368 yyextra->scopeStack.emplace_back();
1374 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1375 DBG_CTX((stderr,
"===> endScope %s",yytext));
1376 if (yyextra->scopeStack.empty())
1378 DBG_CTX((stderr,
"WARNING: fortrancode.l: stack empty!\n"));
1382 Scope &scope = yyextra->scopeStack.back();
1383 for (
const auto &name : scope.
useNames)
1385 yyextra->useMembers.erase(name.str());
1387 yyextra->scopeStack.pop_back();
1392 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1393 if (!yyextra->scopeStack.empty())
1394 yyextra->scopeStack.back().useNames.push_back(moduleName);
1399 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1400 if (!yyextra->scopeStack.empty())
1402 std::string lowVarName = varName.
lower().
str();
1403 yyextra->scopeStack.back().localVars.insert(lowVarName);
1404 if (yyextra->isExternal) yyextra->scopeStack.back().externalVars.insert(lowVarName);
1413 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1421 if (*p ==
'\n') numLines++;
1425 yyextra->hasContLine = (
int *) malloc((numLines) *
sizeof(
int));
1426 for (i = 0; i < numLines; i++)
1428 yyextra->hasContLine[i] = 0;
1431 yyextra->hasContLine[0] = 0;
1435 bool ,
const char *,
const FileDef *,
1457 fortrancodeYYlex_init_extra(&
p->state,&
p->yyscanner);
1466 fortrancodeYYlex_destroy(
p->yyscanner);
1471 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
1472 yyextra->currentDefinition =
nullptr;
1473 yyextra->currentMemberDef =
nullptr;
1474 yyextra->currentFontClass =
nullptr;
1475 yyextra->insideCodeLine =
false;
1483 bool stripCodeComments,
1488 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
1489 if (input.
empty())
return;
1492 yyextra->code = &codeOutIntf;
1493 yyextra->inputString = input.
data();
1494 yyextra->inputPosition = 0;
1497 yyextra->contLineNr = 1;
1498 yyextra->hasContLine =
nullptr;
1499 if (yyextra->isFixedForm)
1502 yyextra->fixedCommentAfter =
Config_getInt(FORTRAN_COMMENT_AFTER);
1504 yyextra->currentFontClass =
nullptr;
1505 yyextra->insideCodeLine =
false;
1506 yyextra->searchCtx = options.
searchCtx();
1510 yyextra->exampleBlock = options.
isExample();
1512 yyextra->sourceFileDef = options.
fileDef();
1514 yyextra->foldStack.clear();
1515 yyextra->insideSpecialComment =
false;
1520 yyextra->sourceFileDef = yyextra->exampleFileDef.get();
1522 if (yyextra->sourceFileDef)
1526 yyextra->currentDefinition =
nullptr;
1527 yyextra->currentMemberDef =
nullptr;
1528 if (!yyextra->exampleName.empty())
1534 fortrancodeYYrestart(
nullptr, yyscanner);
1536 fortrancodeYYlex(yyscanner);
1537 if (yyextra->insideCodeLine)
1543 while (!yyextra->foldStack.empty())
1545 yyextra->code->endFold();
1546 yyextra->foldStack.pop_back();
1549 if (yyextra->exampleFileDef)
1552 yyextra->exampleFileDef.reset();
1553 yyextra->sourceFileDef=
nullptr;
1555 if (yyextra->hasContLine) free(yyextra->hasContLine);
1556 yyextra->hasContLine =
nullptr;
1559 yyextra->tooltipManager.writeTooltips(codeOutIntf);
1564 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
1565 if ( yyg->yy_start_stack_ptr <= 0 )
1566 warn(yyextra->fileName,yyextra->yyLineNr,
"Unexpected statement '{}'",yytext );
1568 yy_pop_state(yyscanner);
1572#include "fortrancode.l.h"
virtual CompoundType compoundType() const =0
Returns the type of compound this is, i.e. class/struct/union/...
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
DString & sprintf(const char *format,...)
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.
static bool isFlagSet(const DebugMask mask)
virtual int getEndBodyLine() const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual bool isLinkable() const =0
virtual const DString & name() const =0
virtual DString briefDescriptionAsTooltip() const =0
virtual const FileDef * getBodyDef() const =0
virtual bool isLinkableInProject() const =0
virtual DString anchor() const =0
virtual int getStartDefLine() const =0
virtual DString getReference() const =0
virtual CodeSymbolType codeSymbolType() const =0
virtual Definition * getOuterScope() const =0
virtual DString getOutputFileBase() const =0
static NamespaceLinkedMap * namespaceLinkedMap
static ClassLinkedMap * classLinkedMap
static MemberNameLinkedMap * functionNameLinkedMap
static NamespaceDefMutable * globalScope
static MemberNameLinkedMap * memberNameLinkedMap
static SearchIndexIntf searchIndex
virtual DString fileName() const =0
void parseCode(OutputCodeList &codeOutIntf, const DString &scopeName, const DString &input, SrcLangExt lang, bool stripCodeComments, const CodeParserOptions &options) override
Parses a source file or fragment with the goal to produce highlighted and cross-referenced output.
void resetCodeParserState() override
Resets the state of the code parser.
FortranCodeParser(FortranFormat format=FortranFormat::Unknown)
std::unique_ptr< Private > p
~FortranCodeParser() override
A model of a group of symbols.
const T * find(const std::string &key) const
virtual GroupDef * getGroupDef()=0
virtual bool isVariable() const =0
void writeCodeLink(CodeSymbolType type, const DString &ref, const DString &file, const DString &anchor, const DString &name, const DString &tooltip)
void stripCodeComments(bool b)
void addWord(const DString &word, bool hiPriority)
void setCurrentDoc(const Definition *ctx, const DString &anchor, bool isSourceFile)
#define Config_getInt(name)
#define Config_getBool(name)
int dstrcmp(const char *str1, const char *str2)
const char * qPrint(const char *s)
std::unique_ptr< FileDef > createFileDef(const DString &p, const DString &n, const DString &ref, const DString &dn)
void parseFortranCode(OutputCodeList &, const char *, const DString &, bool, const char *, const FileDef *, int, int, bool, const MemberDef *, bool, const Definition *, bool, FortranFormat)
static void checkContLines(yyscan_t yyscanner, const char *s)
static void codeFolding(yyscan_t yyscanner, const Definition *d)
const char * prepassFixedForm(const char *contents, int *hasContLine, int fixedCommentAfter)
bool recognizeFixedForm(const DString &contents, FortranFormat format)
void addDocCrossReference(const MemberDef *s, const MemberDef *d)
#define warn(file, line, fmt,...)
Options to configure the code parser.
const Definition * searchCtx() const
DString exampleName() const
const FileDef * fileDef() const
bool showLineNumbers() const
bool inlineFragment() const
bool collectXRefs() const
fortrancodeYY_state state
DString convertNameToFile(const DString &name, bool allowDots, bool allowUnderscore)