373 {BS}[&]*{BS}!.*\n {
374 yyextra->lineCountPrepass ++;
375 }
376<Prepass>^{BS}\n { /* skip empty lines */
377 yyextra->lineCountPrepass ++;
378 }
379<*>^.*\n { // prepass: look for line continuations
380 yyextra->functionLine =
FALSE;
381
382 DBG_CTX((stderr,
"---%s", yytext));
383
386 if (indexEnd>=0 && yytext[indexEnd]!='&')
387 {
388 indexEnd=-1;
389 }
static int getAmpersandAtTheStart(const char *buf, int length)
390
391 if (indexEnd<0)
392 {
393 if (YY_START == Prepass)
394 {
395
396
397 yyextra->inputStringPrepass+=(const char*)(yytext+(indexStart+1));
398
399
400 pushBuffer(yyscanner,yyextra->inputStringPrepass);
401 yyextra->colNr = 0;
403 }
404 else
405 {
406 yyextra->colNr = 0;
407 REJECT;
408 }
409 }
410 else
411 {
412 if (YY_START != Prepass)
413 {
414 yyextra->comments.clear();
415 yyextra->inputStringPrepass=
QCString();
416 yy_push_state(Prepass,yyscanner);
417 }
static void pop_state(yyscan_t yyscanner)
static void pushBuffer(yyscan_t yyscanner, const QCString &buffer)
418
419 size_t length = yyextra->inputStringPrepass.length();
420
421
422 yyextra->inputStringPrepass+=(const char*)(yytext+(indexStart+1));
423 yyextra->lineCountPrepass ++;
424
425
426 truncatePrepass(yyscanner,
static_cast<int>(length) + indexEnd - indexStart - 1);
427 }
428 }
static void truncatePrepass(yyscan_t yyscanner, int index)
429
430
431
432<String>\"|\' { // string ends with next quote without previous backspace
433 if (yytext[0]!=yyextra->stringStartSymbol)
434 {
435 yyextra->colNr -= (int)yyleng;
436 REJECT;
437 }
438 if (yy_top_state(yyscanner) == Initialization ||
439 yy_top_state(yyscanner) == ArrayInitializer)
440 {
441 yyextra->initializer+=yytext;
442 }
444 }
445<String>[\x80-\xFF]* |
446<String>. { if (yy_top_state(yyscanner) == Initialization ||
447 yy_top_state(yyscanner) == ArrayInitializer)
448 {
449 yyextra->initializer+=yytext;
450 }
451 }
452<*>\"|\' { /* string starts */
453 if (YY_START == StrIgnore)
454 { yyextra->colNr -= (int)yyleng;
455 REJECT;
456 };
457 yy_push_state(YY_START,yyscanner);
458 if (yy_top_state(yyscanner) == Initialization ||
459 yy_top_state(yyscanner) == ArrayInitializer)
460 {
461 yyextra->initializer+=yytext;
462 }
463 yyextra->stringStartSymbol=yytext[0];
464 BEGIN(String);
465 }
466
467
468
469<*>"!"/[^<>\n] { if (YY_START == String || YY_START == DocCopyBlock)
470 { yyextra->colNr -= (int)yyleng;
471 REJECT;
472 }
473
474
475 if ((YY_START != StrIgnore) && (YY_START != String))
476 {
477 yy_push_state(YY_START,yyscanner);
478 BEGIN(StrIgnore);
479 yyextra->debugStr="*!";
480 DBG_CTX((stderr,
"start comment %d\n",yyextra->lineNr));
481 }
482 }
483<StrIgnore>.?/\n { pop_state(yyscanner); // comment ends with endline character
484 DBG_CTX((stderr,
"end comment %d %s\n",yyextra->lineNr,
qPrint(yyextra->debugStr)));
485 }
486<StrIgnore>[\x80-\xFF]* |
487<StrIgnore>. { yyextra->debugStr+=yytext; }
488
489
490
491
492<Start,ModuleBody,SubprogBody>"use"{BS_} {
493 if (YY_START == Start)
494 {
496 yy_push_state(ModuleBody,yyscanner);
497 }
498 yy_push_state(Use,yyscanner);
499 }
500<Use>{ID} {
501 DBG_CTX((stderr,
"using dir %s\n",yytext));
502 yyextra->current->name=yytext;
503 yyextra->current->name=yyextra->current->name.lower();
504 yyextra->current->fileName = yyextra->fileName;
505 yyextra->current->section=EntryType::makeUsingDir();
506 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
509 }
510<Use>{ID}/, {
511 yyextra->useModuleName=yytext;
512 yyextra->useModuleName=yyextra->useModuleName.lower();
513 }
514<Use>,{BS}"ONLY" { BEGIN(UseOnly);
515 }
516<UseOnly>{BS},{BS} {}
517<UseOnly>{ID} {
518 yyextra->current->name= yyextra->useModuleName+"::"+yytext;
519 yyextra->current->name=yyextra->current->name.lower();
520 yyextra->current->fileName = yyextra->fileName;
521 yyextra->current->section=EntryType::makeUsingDecl();
522 yyextra->current_root->moveToSubEntryAndRefresh(yyextra->current);
524 }
525<Use,UseOnly>"\n" {
526 yyextra->colNr -= 1;
527 unput(*yytext);
529 }
530
531
532<Start,ModuleBody,SubprogBody>{
533^{BS}interface{IDSYM}+ { /* variable with interface prefix */ }
534^{BS}interface { yyextra->ifType = IF_SPECIFIC;
535 yy_push_state(InterfaceBody,yyscanner);
536
537
538 }
539
540^{BS}abstract{BS_}interface { yyextra->ifType = IF_ABSTRACT;
541 yy_push_state(InterfaceBody,yyscanner);
542
543
544 }
545
546^{BS}interface{BS_}{ID}{ARGS}? { yyextra->ifType = IF_GENERIC;
547 yyextra->current->bodyLine = yyextra->lineNr + yyextra->lineCountPrepass + 1;
548 yy_push_state(InterfaceBody,yyscanner);
549
550
554 startScope(yyscanner,yyextra->last_entry.get());
555 }
static void addInterface(yyscan_t yyscanner, QCString name, InterfaceType type)
556}
557
558<InterfaceBody>^{BS}end{BS}interface({BS_}{ID})? {
559
561 {
562 yyextra->last_entry->parent()->endBodyLine = yyextra->lineNr - 1;
563 }
565 {
567 }
570 }
static void endScope(yyscan_t yyscanner)
end scope
571<InterfaceBody>module{BS}procedure { yy_push_state(YY_START,yyscanner);
572 BEGIN(ModuleProcedure);
573 }
574<ModuleProcedure>{ID} { QCString name = QCString(yytext).lower();
576 {
578 startScope(yyscanner,yyextra->last_entry.get());
579 }
580
581 yyextra->current->section = EntryType::makeFunction();
582 yyextra->current->name = name;
583 yyextra->moduleProcedures.push_back(yyextra->current);
585 }
586<ModuleProcedure>"\n" { yyextra->colNr -= 1;
587 unput(*yytext);
589 }
590<InterfaceBody>. {}
591
592
593<Start>^{BS}{CONTAINS}/({BS}|\n|!|;) {
594 if (YY_START == Start)
595 {
597 yy_push_state(ModuleBodyContains,yyscanner);
598 }
599 }
600<ModuleBody>^{BS}{CONTAINS}/({BS}|\n|!|;) { BEGIN(ModuleBodyContains); }
601<SubprogBody>^{BS}{CONTAINS}/({BS}|\n|!|;) { BEGIN(SubprogBodyContains); }
602<TypedefBody>^{BS}{CONTAINS}/({BS}|\n|!|;) { BEGIN(TypedefBodyContains); }
603
604
605<Start>block{BS}data{BS}{ID_} { //
607 yy_push_state(BlockData,yyscanner);
609 }
610<Start>module|program{BS_} { //
612 if (yytext[0]=='m' || yytext[0]=='M')
613 {
614 yy_push_state(
Module,yyscanner);
615 }
616 else
617 {
618 yy_push_state(Program,yyscanner);
619 }
621 }
622<BlockData>^{BS}"end"({BS}(block{BS}data)({BS_}{ID})?)?{BS}/(\n|!|;) { // end block data
623
624
627 }
628<Start,ModuleBody,ModuleBodyContains>"end"({BS}(module|program)({BS_}{ID})?)?{BS}/(\n|!|;) { // end module
630 if (!
endScope(yyscanner,yyextra->current_root))
631 {
633 }
635 if (yyextra->global_scope)
636 {
638 {
639 yy_push_state(Start,yyscanner);
640 }
641 else
642 {
644 }
645 }
646 else
647 {
648 yy_push_state(Start,yyscanner);
650 }
651 }
static void resolveModuleProcedures(yyscan_t yyscanner, Entry *current_root)
fill empty interface module procedures with info from corresponding module subprogs
652<Module>{ID} {
654 BEGIN(ModuleBody);
655 }
656<Program>{ID} {
658 BEGIN(ModuleBody);
659 }
660
661
662
663<ModuleBody,TypedefBody,TypedefBodyContains>private/{BS}(\n|"!") {
665 yyextra->current->protection = yyextra->defaultProtection ;
666 }
667<ModuleBody,TypedefBody,TypedefBodyContains>public/{BS}(\n|"!") {
669 yyextra->current->protection = yyextra->defaultProtection ;
670 }
671
672
673
674<ModuleBody>^{BS}type{BS}"=" {}
675<Start,ModuleBody>^{BS}type/[^a-z0-9_] {
676 if (YY_START == Start)
677 {
679 yy_push_state(ModuleBody,yyscanner);
680 }
681
682 yy_push_state(
Typedef,yyscanner);
685 yyextra->typeMode = true;
686 }
687<Typedef>{
688{COMMA} {}
689
690{BS}"::"{BS} {}
691
692abstract {
693 yyextra->current->spec.setAbstractClass(true);
694 }
695extends{ARGS} {
698 }
699public {
701 }
702private {
704 }
705{LANGUAGE_BIND_SPEC} {
706
707 }
708{ID} { /* type name found */
709 yyextra->current->section = EntryType::makeClass();
710 yyextra->current->spec.setStruct(true);
711 yyextra->current->name = yytext;
712 yyextra->current->fileName = yyextra->fileName;
713 yyextra->current->bodyLine = yyextra->lineNr;
714 yyextra->current->startLine = yyextra->lineNr;
715
716
717 if (yyextra->current_root &&
718 (yyextra->current_root->section.isClass() ||
719 yyextra->current_root->section.isNamespace()))
720 {
721 yyextra->current->name = yyextra->current_root->name + "::" + yyextra->current->name;
722 }
723
724
726 {
727 yyextra->current->protection = yyextra->defaultProtection;
728 }
730 {
731 yyextra->modifiers[yyextra->current_root][yyextra->current->name.lower().str()] |=
QCString(
"public");
732 }
734 {
735 yyextra->modifiers[yyextra->current_root][yyextra->current->name.lower().str()] |=
QCString(
"private");
736 }
737
739 startScope(yyscanner,yyextra->last_entry.get());
740 BEGIN(TypedefBody);
741 }
742}
743
744<TypedefBodyContains>{ /* Type Bound Procedures */
745^{BS}PROCEDURE{ARGS}? {
747 }
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
748^{BS}final {
749 yyextra->current->spec.setFinal(true);
751 }
752^{BS}generic {
754 }
755{COMMA} {
756 }
757{ATTR_SPEC} {
759 }
760{BS}"::"{BS} {
761 }
762{ID} {
764 yyextra->modifiers[yyextra->current_root][name.
lower().
str()] |= yyextra->currentModifiers;
765 yyextra->current->section = EntryType::makeFunction();
766 yyextra->current->name = name;
767
768 if (yyextra->current->type.find('(') != -1)
769 {
771 }
772 else
773 {
774 yyextra->current->args = name.
lower();
775 }
776 yyextra->current->fileName = yyextra->fileName;
777 yyextra->current->bodyLine = yyextra->lineNr;
778 yyextra->current->startLine = yyextra->lineNr;
780 }
781{BS}"=>"[^(\n|\!)]* { /* Specific bindings come after the ID. */
783 int i = tmp.
find(
"=>");
784 if (i!=-1)
785 {
787 }
789 if (yyextra->last_entry->type == "generic")
790 {
791
792
793
795 while (i>0)
796 {
797 copyEntry(yyextra->current, yyextra->last_entry);
798 yyextra->current->name = yyextra->last_entry->name;
799 yyextra->current->section = EntryType::makeFunction();
801
805 }
806 }
807
808 yyextra->last_entry->args = tmp;
809 }
QCString left(size_t len) const
810"\n" {
813 yyextra->docBlock.clear();
814 }
static void newLine(yyscan_t yyscanner)
Holds yyextra->modifiers (ie attributes) for one symbol (variable, function, etc)
815}
816
817
818<TypedefBody,TypedefBodyContains>{
819^{BS}"end"{BS}"type"({BS_}{ID})?{BS}/(\n|!|;) { /* end type definition */
820 yyextra->last_entry->parent()->endBodyLine = yyextra->lineNr;
821 if (!
endScope(yyscanner,yyextra->current_root))
822 {
824 }
825 yyextra->typeMode = false;
827 }
828^{BS}"end"{BS}/(\n|!|;) { /* incorrect end type definition */
829 warn(yyextra->fileName,yyextra->lineNr,
"Found 'END' instead of 'END TYPE'");
830 yyextra->last_entry->parent()->endBodyLine = yyextra->lineNr;
831 if (!
endScope(yyscanner,yyextra->current_root))
832 {
834 }
835 yyextra->typeMode = false;
837 }
838}
839
840
841
842<SubprogBody,SubprogBodyContains>^{BS}[0-9]*{BS}"end"({BS}{SUBPROG}({BS_}{ID})?)?{BS}/(\n|!|;) {
843
844
845
846
847
849 {
850 endScope(yyscanner,yyextra->current_root);
851 yyextra->last_entry->endBodyLine = yyextra->lineNr - 1;
852 }
853 yyextra->current_root->endBodyLine = yyextra->lineNr - 1;
854
855 if (!
endScope(yyscanner,yyextra->current_root))
856 {
858 }
859 yyextra->subrCurrent.pop_back();
862 }
863<BlockData>{
864{ID} {
865 }
866}
867<Start,ModuleBody,TypedefBody,SubprogBody,FEnum>{
868^{BS}{TYPE_SPEC}/{SEPARATE} {
869 yyextra->last_enum.reset();
870 if (YY_START == FEnum)
871 {
872 yyextra->argType = "@";
873 }
874 else
875 {
877 }
878 yyextra->current->bodyLine = yyextra->lineNr + 1;
879 yyextra->current->endBodyLine = yyextra->lineNr + yyextra->lineCountPrepass;
880
881 if (YY_START == Start)
882 {
884 yy_push_state(ModuleBody,yyscanner);
885 }
886 yy_push_state(AttributeList,yyscanner);
887 }
888{EXTERNAL_STMT}/({BS}"::"|{BS_}{ID}) {
889
890 if (YY_START == Start)
891 {
893 yy_push_state(ModuleBody,yyscanner);
894 }
898 yy_push_state(AttributeList,yyscanner);
899 }
900{ATTR_STMT}/{BS_}{ID} |
901{ATTR_STMT}/{BS}"::" {
902
903 DBG_CTX((stderr,
"5=========> Attribute statement: %s\n", yytext));
904 if (YY_START == Start)
905 {
907 yy_push_state(ModuleBody,yyscanner);
908 }
911 yyextra->argType="";
912 yy_push_state(YY_START,yyscanner);
913 BEGIN( AttributeList ) ;
914 }
915"common" {
916 if (YY_START == Start)
917 {
919 yy_push_state(ModuleBody,yyscanner);
920 }
921 }
922{ID} {
923 if (YY_START == Start)
924 {
926 yy_push_state(ModuleBody,yyscanner);
927 }
928 }
929^{BS}"type"{BS_}"is"/{BT_} {}
930^{BS}"type"{BS}"=" {}
931^{BS}"class"{BS_}"is"/{BT_} {}
932^{BS}"class"{BS_}"default" {}
933}
934<AttributeList>{
935{COMMA} {}
936{BS} {}
937{LANGUAGE_BIND_SPEC} {
938 yyextra->currentModifiers |= yytext;
939 }
940{ATTR_SPEC}. { /* update yyextra->current yyextra->modifiers when it is an ATTR_SPEC and not a variable name */
941
942 char chr = yytext[(int)yyleng-1];
944 {
945 yyextra->colNr -= (int)yyleng;
946 REJECT;
947 }
948 else
949 {
952 yyextra->colNr -= 1;
953 unput(yytext[(int)yyleng-1]);
954 yyextra->currentModifiers |= (tmp);
955 }
956 }
957"::" { /* end attribute list */
958 BEGIN( FVariable );
959 }
960. { /* unknown attribute, consider variable name */
961
962 yyextra->colNr -= 1;
963 unput(*yytext);
964 BEGIN( FVariable );
965 }
966}
967
968<FVariable>{BS} {}
969<FVariable>{OPERATOR_ID} { /* parse operator access statements "public :: operator(==)" */
971
972
973 int currentState = YY_START;
975 int outerState = YY_START;
976 yy_push_state(currentState,yyscanner);
977 if( outerState == Start || outerState == ModuleBody )
978 {
979 if ((yyextra->current_root) &&
980 (yyextra->current_root->section.isClass() ||
981 yyextra->current_root->section.isNamespace()))
982 {
983 name = yyextra->current_root->name + "::" + name;
984 }
985 }
986
987 yyextra->modifiers[yyextra->current_root][name.
str()] |= yyextra->currentModifiers;
988 }
989<FVariable>{ID} { /* parse variable declaration */
990
991
994
995 if ((yyextra->current_root) && yyextra->current_root->section.isNamespace())
996 {
997 name = yyextra->current_root->name + "::" + name;
998 }
999
1000 yyextra->modifiers[yyextra->current_root][name.
lower().
str()] |= yyextra->currentModifiers;
1001 yyextra->argName= name;
1002
1004 if (!yyextra->argType.isEmpty() && !yyextra->current_root->section.isFunction())
1005 {
1007 yyextra->current->section = EntryType::makeVariable();
1008 yyextra->current->name = yyextra->argName;
1009 yyextra->current->type = yyextra->argType;
1010 yyextra->current->fileName = yyextra->fileName;
1011 yyextra->current->bodyLine = yyextra->lineNr;
1012 yyextra->current->startLine = yyextra->lineNr;
1013 if (yyextra->argType == "@")
1014 {
1015 yyextra->current_root->copyToSubEntry(yyextra->current);
1016
1017 yyextra->last_enum = yyextra->current;
1018 yyextra->current_root->parent()->moveToSubEntryAndRefresh(yyextra->current);
1020 }
1021 else
1022 {
1024 }
1025 }
1026 else if (!yyextra->argType.isEmpty())
1027 {
1029 if (parameter)
1030 {
1033 if (!yyextra->docBlock.isEmpty())
1034 {
1036 }
1037 }
1038
1039 if (parameter)
1040 {
1041 yyextra->modifiers[yyextra->current_root][name.
lower().
str()].type = yyextra->argType;
1042 }
1043 else
1044 {
1045 if ((yyextra->current_root->name.lower() == yyextra->argName.lower()) ||
1046 (yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower().str()].returnName.lower() == yyextra->argName.lower()))
1047 {
1048 int strt = yyextra->current_root->type.find("function");
1051 if (strt != -1)
1052 {
1054 lft = "";
1055 rght = "";
1057 if ((yyextra->current_root->type.length() - strt - strlen("function"))!= 0)
1058 {
1059 rght = yyextra->current_root->type.
right(yyextra->current_root->type.length() - strt - (
int)strlen(
"function")).
stripWhiteSpace();
1060 }
1061 yyextra->current_root->type = lft;
1063 {
1064 if (yyextra->current_root->type.length() > 0) yyextra->current_root->type += " ";
1065 yyextra->current_root->type += rght;
1066 }
1067 if (yyextra->argType.stripWhiteSpace().length() > 0)
1068 {
1069 if (yyextra->current_root->type.length() > 0) yyextra->current_root->type += " ";
1070 yyextra->current_root->type += yyextra->argType.stripWhiteSpace();
1071 }
1072 if (yyextra->current_root->type.length() > 0) yyextra->current_root->type += " ";
1073 yyextra->current_root->type += "function";
1074 if (!yyextra->docBlock.isEmpty())
1075 {
1077 }
1078 }
1079 else
1080 {
1081 yyextra->current_root->type += " " + yyextra->argType.stripWhiteSpace();
1082 }
1083 yyextra->current_root->type = yyextra->current_root->type.
stripWhiteSpace();
1084 yyextra->modifiers[yyextra->current_root][name.
lower().
str()].type = yyextra->current_root->type;
1085 }
1086 else
1087 {
1088 yyextra->modifiers[yyextra->current_root][name.
lower().
str()].type = yyextra->argType;
1089 }
1090 }
1091
1092
1093
1094 yyextra->current->doc.clear();
1095 yyextra->current->brief.clear();
1096 }
1097 }
static void subrHandleCommentBlock(yyscan_t yyscanner, const QCString &doc, bool brief)
Handle parameter description as defined after the declaration of the parameter.
static void subrHandleCommentBlockResult(yyscan_t yyscanner, const QCString &doc, bool brief)
Handle result description as defined after the declaration of the parameter.
1098<FVariable>{ARGS} { /* dimension of the previous entry. */
1101 attr += yytext;
1102 yyextra->modifiers[yyextra->current_root][name.
lower().
str()] |= attr;
1103 }
1104<FVariable>{COMMA} { //printf("COMMA: %d<=..<=%d\n", yyextra->colNr-(int)yyleng, yyextra->colNr);
1105
1107 }
static void updateVariablePrepassComment(yyscan_t yyscanner, int from, int to)
1108<FVariable>{BS}"=" {
1109 yy_push_state(YY_START,yyscanner);
1110 yyextra->initializer="=";
1111 yyextra->initializerScope = yyextra->initializerArrayScope = 0;
1112 BEGIN(Initialization);
1113 }
1114<FVariable>"\n" { yyextra->currentModifiers = SymbolModifiers();
1117 yyextra->docBlock.clear();
1118 }
1119<FVariable>";".*"\n" { yyextra->currentModifiers = SymbolModifiers();
1121 yyextra->docBlock.clear();
1122 yyextra->inputStringSemi =
" \n"+
QCString(yytext+1);
1123 yyextra->lineNr--;
1124 pushBuffer(yyscanner,yyextra->inputStringSemi);
1125 }
1126<*>";".*"\n" {
1127 if (YY_START == FVariable) REJECT;
1128 if (YY_START == String) REJECT;
1129 if (YY_START == StrIgnore) REJECT;
1130 if (YY_START == DocBlock) REJECT;
1131 yyextra->inputStringSemi =
" \n"+
QCString(yytext+1);
1132 yyextra->lineNr--;
1133 pushBuffer(yyscanner,yyextra->inputStringSemi);
1134 }
1135
1136<Initialization,ArrayInitializer>"[" |
1137<Initialization,ArrayInitializer>"(/" { yyextra->initializer+=yytext;
1138 yyextra->initializerArrayScope++;
1139 BEGIN(ArrayInitializer);
1140 }
1141<ArrayInitializer>"]" |
1142<ArrayInitializer>"/)" { yyextra->initializer+=yytext;
1143 yyextra->initializerArrayScope--;
1144 if (yyextra->initializerArrayScope<=0)
1145 {
1146 yyextra->initializerArrayScope = 0;
1147 BEGIN(Initialization);
1148 }
1149 }
1150<ArrayInitializer>. { yyextra->initializer+=yytext; }
1151<Initialization>"(" { yyextra->initializerScope++;
1152 yyextra->initializer+=yytext;
1153 }
1154<Initialization>")" { yyextra->initializerScope--;
1155 yyextra->initializer+=yytext;
1156 }
1157<Initialization>{COMMA} { if (yyextra->initializerScope == 0)
1158 {
1161 if (yyextra->last_enum)
1162 {
1163 yyextra->last_enum->initializer.str(yyextra->initializer.str());
1164 }
1165 else
1166 {
1167 if (yyextra->vtype ==
V_VARIABLE) yyextra->last_entry->initializer.str(yyextra->initializer.str());
1168 }
1169 }
1170 else
1171 {
1172 yyextra->initializer+=", ";
1173 }
1174 }
1175<Initialization>"\n"|"!" { //|
1177 if (yyextra->last_enum)
1178 {
1179 yyextra->last_enum->initializer.str(yyextra->initializer.str());
1180 }
1181 else
1182 {
1183 if (yyextra->vtype ==
V_VARIABLE) yyextra->last_entry->initializer.str(yyextra->initializer.str());
1184 }
1185 yyextra->colNr -= 1;
1186 unput(*yytext);
1187 }
1188<Initialization>. { yyextra->initializer+=yytext; }
1189
1190<*>{BS}"enum"{BS}","{BS}"bind"{BS}"("{BS}"c"{BS}")"{BS} {
1191 if (YY_START == Start)
1192 {
1194 yy_push_state(ModuleBody,yyscanner);
1195 }
1196
1197 yy_push_state(FEnum,yyscanner);
1198 yyextra->current->protection = yyextra->defaultProtection;
1199 yyextra->typeProtection = yyextra->defaultProtection;
1200 yyextra->typeMode = true;
1201
1202 yyextra->current->spec.setStruct(true);
1203 yyextra->current->name.clear();
1204 yyextra->current->args.clear();
1205 yyextra->current->name.sprintf("@%d",yyextra->anonCount++);
1206
1207 yyextra->current->section = EntryType::makeEnum();
1208 yyextra->current->fileName = yyextra->fileName;
1209 yyextra->current->startLine = yyextra->lineNr;
1210 yyextra->current->bodyLine = yyextra->lineNr;
1211 if ((yyextra->current_root) &&
1212 (yyextra->current_root->section.isClass() ||
1213 yyextra->current_root->section.isNamespace()))
1214 {
1215 yyextra->current->name = yyextra->current_root->name + "::" + yyextra->current->name;
1216 }
1217
1219 startScope(yyscanner,yyextra->last_entry.get());
1220 BEGIN( FEnum ) ;
1221 }
1222<FEnum>"end"{BS}"enum" {
1223 yyextra->last_entry->parent()->endBodyLine = yyextra->lineNr;
1224 if (!
endScope(yyscanner,yyextra->current_root))
1225 {
1227 }
1228 yyextra->typeMode = false;
1230 }
1231
1232
1233
1234<Start,ModuleBody,SubprogBody,InterfaceBody,ModuleBodyContains,SubprogBodyContains>^{BS}({PREFIX}{BS_})?{TYPE_SPEC}{BS}({PREFIX}{BS_})?/{SUBPROG}{BS_} {
1236 {
1237 addInterface(yyscanner,
"$interface$", yyextra->ifType);
1238 startScope(yyscanner,yyextra->last_entry.get());
1239 }
1240
1241
1243 yy_push_state(SubprogPrefix,yyscanner);
1244 }
1245
1246<SubprogPrefix>{BS}{SUBPROG}{BS_} {
1247
1252 BEGIN(Subprog);
1253 yyextra->current->bodyLine = yyextra->lineNr + yyextra->lineCountPrepass + 1;
1254 yyextra->current->startLine = yyextra->lineNr;
1255 }
static void addSubprogram(yyscan_t yyscanner, const QCString &text)
1256
1257<Start,ModuleBody,SubprogBody,InterfaceBody,ModuleBodyContains,SubprogBodyContains>^{BS}({PREFIX}{BS_})?{SUBPROG}{BS_} {
1258
1261 {
1262 addInterface(yyscanner,
"$interface$", yyextra->ifType);
1263 startScope(yyscanner,yyextra->last_entry.get());
1264 }
1265
1268 yy_push_state(Subprog,yyscanner);
1269 yyextra->current->bodyLine = yyextra->lineNr + yyextra->lineCountPrepass + 1;
1270 yyextra->current->startLine = yyextra->lineNr;
1271 }
1272
1273<Subprog>{BS} { /* ignore white space */ }
1274<Subprog>{ID} { yyextra->current->name = yytext;
1275
1277
1278 if ((yyextra->current_root) &&
1279 (yyextra->current_root->section.isClass() ||
1280 yyextra->current_root->section.isNamespace()))
1281 {
1282 yyextra->current->name= yyextra->current_root->name + "::" + yyextra->current->name;
1283 }
1284 yyextra->modifiers[yyextra->current_root][yyextra->current->name.lower().str()].returnName = std::move(returnName);
1285
1287 {
1289 yyextra->current_root->name,
"$interface$",
QCString(yytext).lower());
1290 }
1291
1292 BEGIN(Parameterlist);
1293 }
1294<Parameterlist>"(" { yyextra->current->args = "("; }
1295<Parameterlist>")" {
1296 yyextra->current->args += ")";
1299 startScope(yyscanner,yyextra->last_entry.get());
1300 BEGIN(SubprogBody);
1301 }
QCString removeRedundantWhiteSpace(const QCString &s)
1302<Parameterlist>{COMMA}|{BS} { yyextra->current->args += yytext;
1304 if (c)
1305 {
1306 if (!yyextra->current->argList.empty())
1307 {
1308 yyextra->current->argList.back().docs = c->
str;
1309 }
1310 }
1311 }
1312<Parameterlist>{ID} {
1313
1315
1316 yyextra->current->args += param;
1320 yyextra->current->argList.push_back(arg);
1321 }
1322<Parameterlist>{NOARGS} {
1324
1326 startScope(yyscanner,yyextra->last_entry.get());
1327 BEGIN(SubprogBody);
1328 }
1329<SubprogBody>result{BS}\({BS}{ID} {
1330 if (yyextra->functionLine)
1331 {
1335 yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower().str()].returnName = result;
1336 }
1337
1338 }
1339
1340
1341
1342<FVariable,SubprogBody,ModuleBody,TypedefBody,TypedefBodyContains>"!<" { /* backward docu comment */
1344 {
1345 yyextra->current->docLine = yyextra->lineNr;
1346 yyextra->docBlockJavaStyle =
FALSE;
1347 yyextra->docBlock.clear();
1350 yy_push_state(DocBackLine,yyscanner);
1351 }
1352 else
1353 {
1354
1355 if (YY_START == String)
1356 {
1357 yyextra->colNr -= (int)yyleng;
1358 REJECT;
1359 }
1360
1361
1362 if ((YY_START != StrIgnore) && (YY_START != String))
1363 {
1364 yy_push_state(YY_START,yyscanner);
1365 BEGIN(StrIgnore);
1366 yyextra->debugStr="*!";
1367 }
1368 }
1369 }
static void startCommentBlock(yyscan_t yyscanner, bool)
1370<DocBackLine>.* { // contents of yyextra->current comment line
1371 yyextra->docBlock+=yytext;
1372 }
1373<DocBackLine>"\n"{BS}"!"("<"|"!"+) { // comment block (next line is also comment line)
1374 yyextra->docBlock+="\n";
1376 }
1377<DocBackLine>"\n" { // comment block ends at the end of this line
1378
1379 yyextra->colNr -= 1;
1380 unput(*yytext);
1382 {
1383 std::shared_ptr<Entry> tmp_entry = yyextra->current;
1384
1385 if (yyextra->last_enum)
1386 {
1387 yyextra->current = yyextra->last_enum;
1388 }
1389 else
1390 {
1391 yyextra->current = yyextra->last_entry;
1392 }
1394
1395 yyextra->current = std::move(tmp_entry);
1396 }
1398 {
1400 }
1401 else if (yyextra->vtype ==
V_RESULT)
1402 {
1404 }
1406 yyextra->docBlock.clear();
1407 }
1408
1409<Start,SubprogBody,ModuleBody,TypedefBody,InterfaceBody,ModuleBodyContains,SubprogBodyContains,TypedefBodyContains,FEnum>^{BS} {
1411 }
static int computeIndent(const char *s)
1412<Start,SubprogBody,ModuleBody,TypedefBody,InterfaceBody,ModuleBodyContains,SubprogBodyContains,TypedefBodyContains,FEnum>"!>" {
1413 yy_push_state(YY_START,yyscanner);
1414 yyextra->current->docLine = yyextra->lineNr;
1415 yyextra->docBlockJavaStyle =
FALSE;
1416 if (YY_START==SubprogBody) yyextra->docBlockInBody =
TRUE;
1417 yyextra->docBlock.clear();
1420 BEGIN(DocBlock);
1421
1422 }
1423
1424
1425<DocBlock>({CMD}{CMD}){ID}/[^a-z_A-Z0-9] { // escaped command
1426 yyextra->docBlock += yytext;
1427 }
1428<DocBlock>{CMD}("f$"|"f["|"f{"|"f(") {
1429 yyextra->docBlock += yytext;
1430 yyextra->docBlockName=&yytext[1];
1431 if (yyextra->docBlockName.at(1)=='[')
1432 {
1433 yyextra->docBlockName.at(1)=']';
1434 }
1435 if (yyextra->docBlockName.at(1)=='{')
1436 {
1437 yyextra->docBlockName.at(1)='}';
1438 }
1439 if (yyextra->docBlockName.at(1)=='(')
1440 {
1441 yyextra->docBlockName.at(1)=')';
1442 }
1443 yyextra->fencedSize=0;
1444 yyextra->blockString=yytext;
1445 yyextra->blockLineNr=yyextra->lineNr;
1446 BEGIN(DocCopyBlock);
1447 }
1448<DocBlock>{CMD}"ifile"{B}+"\""[^\n\"]+"\"" {
1449 yyextra->fileName = &yytext[6];
1450 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1451 yyextra->fileName = yyextra->fileName.mid(1,yyextra->fileName.length()-2);
1452 yyextra->docBlock += yytext;
1453 }
1454<DocBlock>{CMD}"ifile"{B}+{FILEMASK} {
1455 yyextra->fileName = &yytext[6];
1456 yyextra->fileName = yyextra->fileName.stripWhiteSpace();
1457 yyextra->docBlock += yytext;
1458 }
1459<DocBlock>{CMD}"iline"{LINENR}/[\n\.] |
1460<DocBlock>{CMD}"iline"{LINENR}{B} {
1461 bool ok = false;
1463 if (!ok)
1464 {
1465 warn(yyextra->fileName,yyextra->lineNr,
"Invalid line number '%s' for iline command",yytext);
1466 }
1467 else
1468 {
1469 yyextra->lineNr = nr;
1470 }
1471 yyextra->docBlock += yytext;
1472 }
int toInt(bool *ok=nullptr, int base=10) const
1473<DocBlock>{B}*"<"{PRE}">" {
1474 yyextra->docBlock += yytext;
1475 yyextra->docBlockName="<pre>";
1476 yyextra->fencedSize=0;
1477 yyextra->blockString=yytext;
1478 yyextra->blockLineNr=yyextra->lineNr;
1479 BEGIN(DocCopyBlock);
1480 }
1481<DocBlock>{B}*"<"<CODE>">" {
1482 yyextra->docBlock += yytext;
1483 yyextra->docBlockName="<code>";
1484 yyextra->fencedSize=0;
1485 yyextra->blockString=yytext;
1486 yyextra->blockLineNr=yyextra->lineNr;
1487 BEGIN(DocCopyBlock);
1488 }
1489<DocBlock>{CMD}"startuml"/[^a-z_A-Z0-9\-] { // verbatim command
1490 yyextra->docBlock += yytext;
1491 yyextra->docBlockName="uml";
1492 yyextra->fencedSize=0;
1493 yyextra->blockString=yytext;
1494 yyextra->blockLineNr=yyextra->lineNr;
1495 BEGIN(DocCopyBlock);
1496 }
1497<DocBlock>{CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"rtfonly"|"docbookonly"|"dot"|"msc"|"code")/[^a-z_A-Z0-9\-] { // verbatim command
1498 yyextra->docBlock += yytext;
1499 yyextra->docBlockName=&yytext[1];
1500 yyextra->fencedSize=0;
1501 yyextra->blockString=yytext;
1502 yyextra->blockLineNr=yyextra->lineNr;
1503 BEGIN(DocCopyBlock);
1504 }
1505<DocBlock>"~~~"[~]* {
1507 yyextra->docBlock += pat;
1508 yyextra->docBlockName="~~~";
1509 yyextra->fencedSize=pat.
length();
1510 yyextra->blockString=yytext;
1511 yyextra->blockLineNr=yyextra->lineNr;
1512 BEGIN(DocCopyBlock);
1513 }
1514<DocBlock>"```"[`]*/(".")?[a-zA-Z0-9#_-]+ |
1515<DocBlock>"```"[`]*/"{"[^}]+"}" |
1516<DocBlock>"```"[`]* {
1518 yyextra->docBlock += pat;
1519 yyextra->docBlockName="```";
1520 yyextra->fencedSize=pat.
length();
1521 yyextra->blockString=yytext;
1522 yyextra->blockLineNr=yyextra->lineNr;
1523 BEGIN(DocCopyBlock);
1524 }
1525<DocBlock>"\\ilinebr "{BS} {
1527 int extraSpaces = std::max(0,static_cast<int>(yyleng-9-yyextra->curIndent-2));
1528 indent.
fill(
' ',extraSpaces);
1529
1530 yyextra->docBlock += "\\ilinebr ";
1531 yyextra->docBlock += indent;
1532 }
void fill(char c, int len=-1)
Fills a string with a predefined character.
1533
1534<DocBlock>[^@*`~\/\\\n]+ { // any character that isn't special
1535 yyextra->docBlock += yytext;
1536 }
1537<DocBlock>"\n"{BS}"!"(">"|"!"+) { // comment block (next line is also comment line)
1538 yyextra->docBlock+="\n";
1540 }
1541<DocBlock>"\n" { // comment block ends at the end of this line
1542
1543 yyextra->colNr -= 1;
1544 unput(*yytext);
1547 }
1548<DocBlock>. { // command block
1549 yyextra->docBlock += *yytext;
1550 }
1551
1552
1553
1554<DocCopyBlock>"</"{PRE}">" { // end of a <pre> block
1555 yyextra->docBlock += yytext;
1556 if (yyextra->docBlockName=="<pre>")
1557 {
1558 yyextra->docBlockName="";
1559 yyextra->blockString.clear();
1560 yyextra->blockLineNr=-1;
1561 BEGIN(DocBlock);
1562 }
1563 }
1564<DocCopyBlock>"</"{CODE}">" { // end of a <code> block
1565 yyextra->docBlock += yytext;
1566 if (yyextra->docBlockName=="<code>")
1567 {
1568 yyextra->docBlockName="";
1569 yyextra->blockString.clear();
1570 yyextra->blockLineNr=-1;
1571 BEGIN(DocBlock);
1572 }
1573 }
1574<DocCopyBlock>[\\@]("f$"|"f]"|"f}"|"f)") {
1575 yyextra->docBlock += yytext;
1576 if (yyextra->docBlockName==&yytext[1])
1577 {
1578 yyextra->docBlockName="";
1579 yyextra->blockString.clear();
1580 yyextra->blockLineNr=-1;
1581 BEGIN(DocBlock);
1582 }
1583 }
1584<DocCopyBlock>[\\@]("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"endrtfonly"|"enddot"|"endmsc"|"enduml"|"endcode")/[^a-z_A-Z0-9] { // end of verbatim block
1585 yyextra->docBlock += yytext;
1586 if (&yytext[4]==yyextra->docBlockName)
1587 {
1588 yyextra->docBlockName="";
1589 yyextra->blockString.clear();
1590 yyextra->blockLineNr=-1;
1591 BEGIN(DocBlock);
1592 }
1593 }
1594
1595<DocCopyBlock>^{B}*{COMM} { // start of a comment line
1596 if (yyextra->docBlockName=="verbatim")
1597 {
1598 REJECT;
1599 }
1600 else
1601 {
1604 yyextra->docBlock += indent;
1605 }
1606 }
1607<DocCopyBlock>"~~~"[~]* {
1609 yyextra->docBlock += pat;
1610 if (yyextra->docBlockName ==
"~~~" && yyextra->fencedSize==pat.
length())
1611 {
1612 yyextra->blockString.clear();
1613 yyextra->blockLineNr=-1;
1614 BEGIN(DocBlock);
1615 }
1616 }
1617<DocCopyBlock>"```"[`]* {
1619 yyextra->docBlock += pat;
1620 if (yyextra->docBlockName ==
"```" && yyextra->fencedSize==pat.
length())
1621 {
1622 yyextra->blockString.clear();
1623 yyextra->blockLineNr=-1;
1624 BEGIN(DocBlock);
1625 }
1626 }
1627
1628<DocCopyBlock>[^<@/\*\]!`~"\$\\\n]+ { // any character that is not special
1629 yyextra->docBlock += yytext;
1630 }
1631<DocCopyBlock>\n { // newline
1632 yyextra->docBlock += *yytext;
1634 }
1635<DocCopyBlock>. { // any other character
1636 yyextra->docBlock += *yytext;
1637 }
1638
1639
1640<Prototype>{BS}{SUBPROG}{BS_} {
1641 BEGIN(PrototypeSubprog);
1642 }
1643<Prototype,PrototypeSubprog>{BS}{SCOPENAME}?{BS}{ID} {
1646 BEGIN(PrototypeArgs);
1647 }
1648<PrototypeArgs>{
1649"("|")"|","|{BS_} { yyextra->current->args += yytext; }
1650{ID} { yyextra->current->args += yytext;
1653 yyextra->current->argList.push_back(a);
1654 }
1655}
1656
1657
1658
1659<*>"\n" {
1661
1662 yyextra->debugStr="";
1663 }
1664
1665
1666
1667
1668<*><<EOF>> {
1669 if (yyextra->parsingPrototype)
1670 {
1672 }
1673 else if ( yyextra->includeStackPtr <= 0 )
1674 {
1675 if (YY_START!=INITIAL && YY_START!=Start)
1676 {
1677 DBG_CTX((stderr,
"==== Error: EOF reached in wrong state (end missing)"));
1679 }
1681 }
1682 else
1683 {
1685 }
1686 }
static void popBuffer(yyscan_t yyscanner)
1687<*>{LOG_OPER} { // Fortran logical comparison keywords
1688 }
1689<*>. {
1690
1691
1692 }
1693
1694
1695
1696
1697%%