diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commentcnv.l | 4 | ||||
-rw-r--r-- | src/commentscan.l | 10 | ||||
-rw-r--r-- | src/doctokenizer.l | 2 | ||||
-rw-r--r-- | src/fortrancode.l | 53 | ||||
-rw-r--r-- | src/fortranscanner.l | 49 | ||||
-rw-r--r-- | src/namespacedef.cpp | 2 | ||||
-rw-r--r-- | src/scanner.l | 5 | ||||
-rw-r--r-- | src/tclscanner.l | 17 | ||||
-rw-r--r-- | src/util.cpp | 6 |
9 files changed, 101 insertions, 47 deletions
diff --git a/src/commentcnv.l b/src/commentcnv.l index 44e2543..aca7300 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -1093,7 +1093,9 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) if (Debug::isFlagSet(Debug::CommentCnv)) { g_outBuf->at(g_outBuf->curPos())='\0'; - msg("-------------\n%s\n-------------\n",g_outBuf->data()); + Debug::print(Debug::CommentCnv,0,"-----------\nCommentCnv: %s\n" + "output=[\n%s]\n-----------\n",fileName,g_outBuf->data() + ); } printlex(yy_flex_debug, FALSE, __FILE__, fileName); } diff --git a/src/commentscan.l b/src/commentscan.l index 588d40a..727bbb9 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -1860,10 +1860,10 @@ RCSTAG "$"{ID}":"[^\n$]+"$" addOutput(*yytext); } <FormatBlock><<EOF>> { - QCString endTag = "@end"+blockName; + QCString endTag = "end"+blockName; if (blockName=="startuml") endTag="enduml"; warn(yyFileName,yyLineNr, - "reached end of comment while inside a @%s block; check for missing @%s tag!", + "reached end of comment while inside a \\%s block; check for missing \\%s tag!", blockName.data(),endTag.data() ); yyterminate(); @@ -1944,7 +1944,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" if (guards.isEmpty()) { warn(yyFileName,yyLineNr, - "found @endif without matching start command"); + "found \\endif without matching start command"); } else { @@ -1962,7 +1962,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" if (guards.isEmpty()) { warn(yyFileName,yyLineNr, - "found @else without matching start command"); + "found \\else without matching start command"); } else { @@ -1979,7 +1979,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" if (guards.isEmpty()) { warn(yyFileName,yyLineNr, - "found @elseif without matching start command"); + "found \\elseif without matching start command"); } else { diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 90a8c55..777e963 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -554,7 +554,7 @@ REFWORD_NOCV {LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} g_token->indent = computeIndent(text,dotPos); return TK_ENDLIST; } -<St_Para>"{"{BLANK}*"@link" { +<St_Para>"{"{BLANK}*"@link"/{BLANK}+ { g_token->name = "javalink"; return TK_COMMAND; } diff --git a/src/fortrancode.l b/src/fortrancode.l index 501b492..f491acb 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -159,6 +159,9 @@ static char stringStartSymbol; // single or double quote // declared from referenced names static int bracketCount = 0; +// signal when in type / class /procedure declaration +static int inTypeDecl = 0; + static bool g_endComment; static void endFontClass() @@ -687,14 +690,14 @@ CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS})) TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}COMPLEX|DOUBLE{BS}PRECISION|{CHAR}|TYPE|CLASS|PROCEDURE) INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")" -ATTR_SPEC (IMPLICIT|ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PROTECTED|PRIVATE|PUBLIC|SAVE|TARGET|RECURSIVE|PURE|IMPURE|ELEMENTAL|VALUE|NOPASS|DEFERRED|CONTIGUOUS|VOLATILE) +ATTR_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) ACCESS_SPEC (PROTECTED|PRIVATE|PUBLIC) /* Assume that attribute statements are almost the same as attributes. */ ATTR_STMT {ATTR_SPEC}|DIMENSION FLOW (DO|SELECT|CASE|SELECT{BS}(CASE|TYPE)|WHERE|IF|THEN|ELSE|WHILE|FORALL|ELSEWHERE|ELSEIF|RETURN|CONTINUE|EXIT|GO{BS}TO) COMMANDS (FORMAT|CONTAINS|MODULE{BS_}PROCEDURE|WRITE|READ|ALLOCATE|ALLOCATED|ASSOCIATED|PRESENT|DEALLOCATE|NULLIFY|SIZE|INQUIRE|OPEN|CLOSE|FLUSH|DATA|COMMON) IGNORE (CALL) -PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|IMPURE|PURE|ELEMENTAL)? +PREFIX ((NON_)?RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,4}((NON_)?RECURSIVE|IMPURE|PURE|ELEMENTAL)? /* | */ @@ -813,7 +816,8 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I unput(*yytext); yy_pop_state();YY_FTN_RESET } -<Start>"import"{BS_} { +<*>"import"{BS}/"\n" | +<*>"import"{BS_} { startFontClass("keywordtype"); codifyLines(yytext); endFontClass(); @@ -825,6 +829,11 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I generateLink(*g_code, yytext); g_insideBody=FALSE; } +<Import>("ONLY"|"NONE"|"ALL") { + startFontClass("keywordtype"); + codifyLines(yytext); + endFontClass(); + } /*-------- fortran module -----------------------------------------*/ <Start>("block"{BS}"data"|"program"|"module"|"interface")/{BS_}|({COMMA}{ACCESS_SPEC})|\n { // startScope(); @@ -836,14 +845,14 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I if (!qstricmp(yytext,"module")) currentModule="module"; } <Start>("type")/{BS_}|({COMMA}({ACCESS_SPEC}|ABSTRACT|EXTENDS))|\n { // - startScope(); - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startScope(); + startFontClass("keyword"); + codifyLines(yytext); + endFontClass(); yy_push_state(YY_START); - BEGIN(ClassName); - currentClass="class"; - } + BEGIN(ClassName); + currentClass="class"; + } <ClassName>{ID} { if (currentModule == "module") { @@ -876,7 +885,7 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I codifyLines(yytext); endFontClass(); } -<Start>({PREFIX}{BS_})?{SUBPROG}{BS_} { // Fortran subroutine or function found +<Start>({PREFIX}{BS_})?{SUBPROG}{BS_} { // Fortran subroutine or function found startFontClass("keyword"); codifyLines(yytext); endFontClass(); @@ -923,6 +932,9 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I } /*-------- variable declaration ----------------------------------*/ <Start>{TYPE_SPEC}/[,:( ] { + QCString typ = yytext; + typ = typ.lower(); + if (typ == "type" || typ == "class" || typ == "procedure") inTypeDecl = 1; yy_push_state(YY_START); BEGIN(Declaration); startFontClass("keywordtype"); @@ -946,7 +958,7 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I g_code->codify(yytext); endFontClass(); } - else if (g_currentMemberDef && ((g_currentMemberDef->isFunction() && (g_currentMemberDef->typeString() != QCString("subroutine"))) || + else if (g_currentMemberDef && ((g_currentMemberDef->isFunction() && (g_currentMemberDef->typeString() != QCString("subroutine") || inTypeDecl)) || g_currentMemberDef->isVariable())) { generateLink(*g_code, yytext); @@ -956,22 +968,23 @@ PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|I g_code->codify(yytext); addLocalVar(yytext); } - } -<Declaration>{BS}("=>"|"="){BS} { // Procedure binding - BEGIN(DeclarationBinding); - g_code->codify(yytext); - } -<DeclarationBinding>{ID} { // Type bound procedure link + } +<Declaration>{BS}("=>"|"="){BS} { // Procedure binding + BEGIN(DeclarationBinding); + g_code->codify(yytext); + } +<DeclarationBinding>{ID} { // Type bound procedure link generateLink(*g_code, yytext); yy_pop_state(); - } -<Declaration>[(] { // start of array specification + } +<Declaration>[(] { // start of array or type / class specification bracketCount++; g_code->codify(yytext); } <Declaration>[)] { // end array specification bracketCount--; + if (!bracketCount) inTypeDecl = 0; g_code->codify(yytext); } diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 85b6de9..774251b 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -198,6 +198,8 @@ static SymbolModifiers currentModifiers; //! Holds program scope->symbol name->symbol modifiers. static QMap<Entry*,QMap<QCString,SymbolModifiers> > modifiers; +static Entry *global_scope = NULL; + //----------------------------------------------------------------------------- static int yyread(char *buf,int max_size); @@ -248,6 +250,7 @@ SUBPROG (subroutine|function) B [ \t] BS [ \t]* BS_ [ \t]+ +BT_ ([ \t]+|[ \t]*"(") COMMA {BS},{BS} ARGS_L0 ("("[^)]*")") ARGS_L1a [^()]*"("[^)]*")"[^)]* @@ -271,7 +274,7 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} EXTERNAL_STMT (EXTERNAL) CONTAINS CONTAINS -PREFIX (RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,3}(RECURSIVE|IMPURE|PURE|ELEMENTAL)? +PREFIX ((NON_)?RECURSIVE{BS_}|IMPURE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,4}((NON_)?RECURSIVE|IMPURE|PURE|ELEMENTAL)? SCOPENAME ({ID}{BS}"::"{BS})* %option noyywrap @@ -558,7 +561,18 @@ SCOPENAME ({ID}{BS}"::"{BS})* if (!endScope(current_root)) yyterminate(); defaultProtection = Public; - yy_pop_state(); + if (global_scope) + { + if (global_scope != (Entry *) -1) + yy_push_state(Start); + else + yy_pop_state(); // cannot pop artrificial entry + } + else + { + yy_push_state(Start); + global_scope = (Entry *)-1; // signal that the global_scope has already been used. + } } <Module>{ID} { addModule(yytext, TRUE); @@ -602,7 +616,7 @@ abstract { current->spec |= Entry::AbstractClass; } extends{ARGS} { - QCString basename = extractFromParens(yytext); + QCString basename = extractFromParens(yytext).lower(); current->extends->append(new BaseInfo(basename, Public, Normal)); } public { @@ -667,7 +681,8 @@ private { addCurrentEntry(1); } {BS}"=>"[^(\n|\!)]* { /* Specific bindings come after the ID. */ - last_entry->args = yytext; + QCString args = yytext; + last_entry->args = args.lower(); } "\n" { currentModifiers = SymbolModifiers(); @@ -773,8 +788,10 @@ private { } {ID} { } -^{BS}"type"{BS_}"is"/{BS_} { } +^{BS}"type"{BS_}"is"/{BT_} { } ^{BS}"type"{BS}"=" { } +^{BS}"class"{BS_}"is"/{BT_} { } +^{BS}"class"{BS_}"default" { } } <AttributeList>{ {COMMA} {} @@ -1098,7 +1115,6 @@ private { yy_push_state(YY_START); BEGIN(StrIgnore); debugStr="*!"; - //fprintf(stderr,"start comment %d\n",yyLineNr); } } } @@ -1552,7 +1568,10 @@ const char* prepassFixedForm(const char* contents, int *hasContLine) } // fallthrough default: - if(column==6 && emptyLabel) { // continuation + if ((column < 6) && ((c - '0') >= 0) && ((c - '0') <= 9)) { // remove numbers, i.e. labels from first 5 positions. + newContents[j]=' '; + } + else if(column==6 && emptyLabel) { // continuation if (!commented) fullCommentLine=FALSE; if (c != '0') { // 0 not allowed as continuation character, see f95 standard paragraph 3.3.2.3 newContents[j]=' '; @@ -2017,14 +2036,23 @@ static void startScope(Entry *scope) */ static bool endScope(Entry *scope, bool isGlobalRoot) { + if (global_scope == scope) + { + global_scope = NULL; + return TRUE; + } + if (global_scope == (Entry *) -1) + { + return TRUE; + } //cout<<"end scope: "<<scope->name<<endl; if (current_root->parent() || isGlobalRoot) { current_root= current_root->parent(); /* end substructure */ } - else + else // if (current_root != scope) { - fprintf(stderr,"parse error in end <scopename>"); + fprintf(stderr,"parse error in end <scopename>\n"); scanner_abort(); return FALSE; } @@ -2558,6 +2586,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, Fortra yyFileName = fileName; msg("Parsing file %s...\n",yyFileName.data()); + global_scope = rt; startScope(rt); // implies current_root = rt initParser(); groupEnterFile(yyFileName,yyLineNr); @@ -2579,7 +2608,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, Fortra fortranscannerYYlex(); groupLeaveFile(yyFileName,yyLineNr); - endScope(current_root, TRUE); // TRUE - global root + if (global_scope && global_scope != (Entry *) -1) endScope(current_root, TRUE); // TRUE - global root //debugCompounds(rt); //debug diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index c674760..d3eb0df 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -961,7 +961,7 @@ void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title, bool found=FALSE; for (ni.toFirst();(nd=ni.current()) && !found;++ni) { - if (nd->isLinkable()) + if (nd->isLinkable() && nd->hasDocumentation()) { SrcLangExt lang = nd->getLanguage(); if (SrcLangExt_IDL==lang) diff --git a/src/scanner.l b/src/scanner.l index 08a5e52..619eb5d 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -3639,7 +3639,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->fileName = yyFileName; current->startLine = yyLineNr; current->startColumn = yyColNr; - current->type = "@"; // enum marker + if (!(current_root->spec&Entry::Enum)) + { + current->type = "@"; // enum marker + } current->args = current->args.simplifyWhiteSpace(); current->name = current->name.stripWhiteSpace(); current->section = Entry::VARIABLE_SEC; diff --git a/src/tclscanner.l b/src/tclscanner.l index 791ecc4..56d2e3d 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -703,6 +703,7 @@ static void tcl_codify(const char *s,const char *str) } else { + if (*(p-2)==0x1A) *(p-2) = '\0'; // remove ^Z tcl.code->codify(sp); done=TRUE; } @@ -3024,11 +3025,6 @@ void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, } tcl_inf("%s (%d,%d) %d %d\n",myStr.ascii(),startLine,endLine,isExampleBlock,inlineFragment); //tcl_inf("%s\n"input.data()); - if (isExampleBlock) - { - tcl_codify(NULL,input); - return; - } tcl_init(); tcl.collectXRefs = collectXRefs; tcl.memberdef = memberDef; @@ -3047,8 +3043,15 @@ tcl_inf("%s (%d,%d) %d %d\n",myStr.ascii(),startLine,endLine,isExampleBlock,inli } tcl.file_name = ""; tcl.this_parser = NULL; - tcl.entry_main = tcl_entry_new(); - tcl_parse(myNs,myCls); + if (isExampleBlock) + { + tcl_codify(NULL,input); + } + else + { + tcl.entry_main = tcl_entry_new(); + tcl_parse(myNs,myCls); + } tcl.code->endCodeLine(); tcl.scan.clear(); tcl.ns.clear(); diff --git a/src/util.cpp b/src/util.cpp index 3af1a90..9100706 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1856,7 +1856,11 @@ QCString removeRedundantWhiteSpace(const QCString &s) case '&': if (i>0 && isId(pc)) { - *dst++=' '; + if (nc != '=') + // avoid splitting operator&= + { + *dst++=' '; + } } *dst++=c; break; |