diff options
Diffstat (limited to 'src')
63 files changed, 5107 insertions, 3620 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 19bcf7a..eb0c170 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -14,11 +14,10 @@ # input used in their production; they are not affected by this license. # -all: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen Makefile.doxytag Makefile +all: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen Makefile $(MAKE) -f Makefile.libdoxycfg PERL=$(PERL) $@ $(MAKE) -f Makefile.libdoxygen PERL=$(PERL) $@ $(MAKE) -f Makefile.doxygen PERL=$(PERL) $@ - $(MAKE) -f Makefile.doxytag PERL=$(PERL) $@ Makefile.libdoxygen: libdoxygen.pro libdoxygen.t $(ENV) $(PERL) $(TMAKE) libdoxygen.pro >Makefile.libdoxygen @@ -29,24 +28,19 @@ Makefile.libdoxycfg: libdoxycfg.pro libdoxycfg.t Makefile.doxygen: doxygen.pro $(ENV) $(PERL) $(TMAKE) doxygen.pro >Makefile.doxygen -Makefile.doxytag: doxytag.pro doxytag.t - $(ENV) $(PERL) $(TMAKE) doxytag.pro >Makefile.doxytag - tmake: $(ENV) $(PERL) $(TMAKE) libdoxygen.pro >Makefile.libdoxygen $(ENV) $(PERL) $(TMAKE) libdoxycfg.pro >Makefile.libdoxycfg $(ENV) $(PERL) $(TMAKE) doxygen.pro >Makefile.doxygen - $(ENV) $(PERL) $(TMAKE) doxytag.pro >Makefile.doxytag -clean: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen Makefile.doxytag +clean: Makefile.libdoxygen Makefile.libdoxycfg Makefile.doxygen $(MAKE) -f Makefile.libdoxygen clean $(MAKE) -f Makefile.libdoxycfg clean $(MAKE) -f Makefile.doxygen clean - $(MAKE) -f Makefile.doxytag clean distclean: clean -$(RM) scanner.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \ - ce_parse.cpp ce_parse.h doxytag.cpp tag.cpp commentscan.cpp \ + ce_parse.cpp ce_parse.h tag.cpp commentscan.cpp \ declinfo.cpp defargs.cpp commentcnv.cpp doctokenizer.cpp \ pycode.cpp pyscanner.cpp fortrancode.cpp fortranscanner.cpp \ vhdlscanner.cpp vhdlcode.cpp tclscanner.cpp vhdlparser.h \ diff --git a/src/classdef.cpp b/src/classdef.cpp index be7429e..c5ff60d 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -1493,30 +1493,8 @@ void ClassDef::writeSummaryLinks(OutputList &ol) ol.popGeneratorState(); } -void ClassDef::writeTagFileMarker(OutputList &ol) +void ClassDef::writeTagFileMarker() { - // write markers for tag file processing to the output - ol.pushGeneratorState(); - ol.disableAllBut(OutputGenerator::Html); - ol.writeString("<!-- doxytag: class=\""); - ol.docify(name()); - ol.writeString("\" -->"); - if (m_impl->inherits && m_impl->inherits->count()>0) - { - BaseClassListIterator bli(*m_impl->inherits); - ol.writeString("<!-- doxytag: inherits=\""); - BaseClassDef *bcd=0; - bool first=TRUE; - for (bli.toFirst();(bcd=bli.current());++bli) - { - if (!first) ol.writeString(","); - ol.docify(bcd->classDef->name()); - first=FALSE; - } - ol.writeString("\" -->"); - } - ol.popGeneratorState(); - // write section to the tag file if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { @@ -1657,7 +1635,7 @@ void ClassDef::writeInlineDocumentation(OutputList &ol) ol.popGeneratorState(); // part 4: write tag file information - writeTagFileMarker(ol); + writeTagFileMarker(); } void ClassDef::writeMoreLink(OutputList &ol,const QCString &anchor) @@ -1812,7 +1790,7 @@ void ClassDef::writeDocumentationContents(OutputList &ol,const QCString &pageTit pageType += compoundTypeString(); toupper(pageType.at(1)); - writeTagFileMarker(ol); + writeTagFileMarker(); Doxygen::indexList.addIndexItem(this,0); @@ -2100,7 +2078,7 @@ void ClassDef::writeMemberList(OutputList &ol) { if (getOuterScope()!=Doxygen::globalScope) { - writeNavigationPath(ol,FALSE); + writeNavigationPath(ol); } ol.endQuickIndices(); } diff --git a/src/classdef.h b/src/classdef.h index d92b5a6..fb37e0b 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -348,7 +348,7 @@ class ClassDef : public Definition void showUsedFiles(OutputList &ol); private: - void writeTagFileMarker(OutputList &ol); + void writeTagFileMarker(); void writeDocumentationContents(OutputList &ol,const QCString &pageTitle); void internalInsertMember(MemberDef *md,Protection prot,bool addToAllList); QCString getMemberListFileName() const; diff --git a/src/cmdmapper.cpp b/src/cmdmapper.cpp index 3c21a75..b42ca4b 100644 --- a/src/cmdmapper.cpp +++ b/src/cmdmapper.cpp @@ -162,6 +162,7 @@ CommandMap htmlTagMap[] = { "h6", HTML_H6 }, { "span", HTML_SPAN }, { "div", HTML_DIV }, + { "blockquote", HTML_BLOCKQUOTE }, { "c", XML_C }, // { "code", XML_CODE }, <= ambiguous <code> is also a HTML tag diff --git a/src/cmdmapper.h b/src/cmdmapper.h index 6a62546..b2950ce 100644 --- a/src/cmdmapper.h +++ b/src/cmdmapper.h @@ -156,6 +156,7 @@ enum HtmlTagType HTML_H6 = 30, HTML_SPAN = 31, HTML_DIV = 32, + HTML_BLOCKQUOTE= 33, XML_CmdMask = 0x100, diff --git a/src/commentscan.l b/src/commentscan.l index cb295d1..4f4408f 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -45,6 +45,7 @@ #include "debug.h" #include "parserintf.h" #include "cite.h" +#include "markdown.h" // forward declarations static bool handleBrief(const QCString &); @@ -110,6 +111,7 @@ static bool handlePublic(const QCString &s); static bool handlePublicSection(const QCString &s); static bool handleInherit(const QCString &); static bool handleExtends(const QCString &); +static bool handleCopyDoc(const QCString &); typedef bool (*DocCmdFunc)(const QCString &name); @@ -209,7 +211,7 @@ static DocCmdMap docCmdMap[] = { "attention", 0, TRUE }, { "author", 0, TRUE }, { "authors", 0, TRUE }, - { "copydoc", 0, TRUE }, + { "copydoc", &handleCopyDoc, TRUE }, { "copybrief", 0, FALSE }, { "copydetails", 0, TRUE }, { "date", 0, TRUE }, @@ -404,6 +406,7 @@ static int g_sectionLevel; static int g_commentCount; static bool g_spaceBeforeCmd; static bool g_spaceBeforeIf; +static QCString g_copyDocArg; //----------------------------------------------------------------------------- @@ -749,6 +752,7 @@ static inline void setOutput(OutputContext ctx) // add a string to the output static inline void addOutput(const char *s) { + //printf("addOutput(%s)\n",s); *pOutputString+=s; } @@ -876,6 +880,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" %x HtmlComment %x SkipLang %x CiteLabel +%x CopyDoc %% @@ -1055,7 +1060,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" <Comment>^{B}*"."{B}*/\n { // explicit end autolist: e.g " ." addOutput(yytext); } -<Comment>^{B}*"-" { // start of autolist +<Comment>^{B}*[1-9][0-9]*"."{B}+ | +<Comment>^{B}*[*+-]{B}+ { // start of autolist if (inContext!=OutputXRef) { briefEndsAtDot=FALSE; @@ -1997,6 +2003,26 @@ RCSTAG "$"{ID}":"[^\n$]+"$" BEGIN(Comment); } + /* ----- handle argument of the copydoc command ------- */ + +<CopyDoc><<EOF>> | +<CopyDoc>{DOCNL} { + if (*yytext=='\n') yyLineNr++; + addOutput('\n'); + setOutput(OutputDoc); + addOutput("\\copydetails "); + addOutput(g_copyDocArg); + addOutput("\n"); + BEGIN(Comment); + } +<CopyDoc>[^\n\\]+ { + g_copyDocArg+=yytext; + addOutput(yytext); + } +<CopyDoc>. { + g_copyDocArg+=yytext; + addOutput(yytext); + } %% @@ -2517,6 +2543,15 @@ static bool handleExtends(const QCString &) return FALSE; } +static bool handleCopyDoc(const QCString &) +{ + setOutput(OutputBrief); + addOutput("\\copybrief "); + g_copyDocArg.resize(0); + BEGIN(CopyDoc); + return FALSE; +} + //---------------------------------------------------------------------------- static void checkFormula() @@ -2609,6 +2644,13 @@ bool parseCommentBlock(/* in */ ParserInterface *parser, openGroup(current,yyFileName,yyLineNr); } + if (Doxygen::markdownSupport) + { + current->brief = processMarkdown(current->brief); + current->doc = processMarkdown(current->doc); + current->inbodyDocs = processMarkdown(current->inbodyDocs); + } + Debug::print(Debug::CommentScan,0, "brief=[%s]\ndocs=[%s]\ninbody=[%s]\n===========\n", current->brief.data(),current->doc.data(),current->inbodyDocs.data() @@ -2631,7 +2673,6 @@ bool parseCommentBlock(/* in */ ParserInterface *parser, lineNr = yyLineNr; //printf("position=%d parseMore=%d\n",position,parseMore); - return parseMore; } diff --git a/src/compound.xsd b/src/compound.xsd index 493fc4e..1149266 100644 --- a/src/compound.xsd +++ b/src/compound.xsd @@ -419,6 +419,7 @@ <xsd:element name="parameterlist" type="docParamListType" /> <xsd:element name="xrefsect" type="docXRefSectType" /> <xsd:element name="copydoc" type="docCopyType" /> + <xsd:element name="blockquote" type="docBlockQuoteType" /> </xsd:choice> </xsd:group> @@ -612,6 +613,12 @@ <xsd:attribute name="link" type="xsd:string" /> </xsd:complexType> + <xsd:complexType name="docBlockQuoteType"> + <xsd:sequence> + <xsd:element name="para" type="docParaType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="docCharType"> <xsd:attribute name="char" type="DoxCharRange"/> </xsd:complexType> diff --git a/src/compound_xsd.h b/src/compound_xsd.h index e84e21f..6531857 100644 --- a/src/compound_xsd.h +++ b/src/compound_xsd.h @@ -419,6 +419,7 @@ " <xsd:element name=\"parameterlist\" type=\"docParamListType\" />\n" " <xsd:element name=\"xrefsect\" type=\"docXRefSectType\" />\n" " <xsd:element name=\"copydoc\" type=\"docCopyType\" />\n" +" <xsd:element name=\"blockquote\" type=\"docBlockQuoteType\" />\n" " </xsd:choice>\n" " </xsd:group>\n" "\n" @@ -612,6 +613,12 @@ " <xsd:attribute name=\"link\" type=\"xsd:string\" /> \n" " </xsd:complexType>\n" "\n" +" <xsd:complexType name=\"docBlockQuoteType\">\n" +" <xsd:sequence>\n" +" <xsd:element name=\"para\" type=\"docParaType\" minOccurs=\"0\" maxOccurs=\"unbounded\" />\n" +" </xsd:sequence>\n" +" </xsd:complexType>\n" +"\n" " <xsd:complexType name=\"docCharType\">\n" " <xsd:attribute name=\"char\" type=\"DoxCharRange\"/> \n" " </xsd:complexType>\n" diff --git a/src/config.l b/src/config.l index 3c22571..ee535e9 100644 --- a/src/config.l +++ b/src/config.l @@ -1334,6 +1334,8 @@ void Config::check() filePatternList.append("*.vhd"); filePatternList.append("*.vhdl"); filePatternList.append("*.tcl"); + filePatternList.append("*.md"); + filePatternList.append("*.markdown"); if (portable_fileSystemIsCaseSensitive()) { // unix => case sensitive match => also include useful uppercase versions @@ -1356,6 +1358,8 @@ void Config::check() filePatternList.append("*.VHD"); filePatternList.append("*.VHDL"); filePatternList.append("*.TCL"); + filePatternList.append("*.MD"); + filePatternList.append("*.MARKDOWN"); } } @@ -1477,21 +1481,24 @@ void Config::check() bool b2 = Config_getBool("INHERIT_DOCS"); bool b3 = Config_getBool("HIDE_SCOPE_NAMES"); bool b4 = Config_getBool("EXTRACT_PRIVATE"); - const char *s1,*s2,*s3,*s4; + bool b5 = Config_getBool("SKIP_FUNCTION_MACROS"); + const char *s1,*s2,*s3,*s4,*s5; if (b1) s1=" INLINDE_INHERITED_MEMB = NO (was YES)\n"; else s1=""; if (b2) s2=" INHERIT_DOCS = NO (was YES)\n"; else s2=""; if (!b3) s3=" HIDE_SCOPE_NAMES = YES (was NO)\n"; else s3=""; if (!b4) s4=" EXTRACT_PRIVATE = YES (was NO)\n"; else s4=""; + if (b5) s5=" ENABLE_PREPROCESSING = NO (was YES)\n"; else s5=""; config_err("warning: enabling OPTIMIZE_OUTPUT_VHDL assumes the following settings:\n" - "%s%s%s%s",s1,s2,s3,s4 + "%s%s%s%s%s",s1,s2,s3,s4,s5 ); Config_getBool("INLINE_INHERITED_MEMB") = FALSE; Config_getBool("INHERIT_DOCS") = FALSE; Config_getBool("HIDE_SCOPE_NAMES") = TRUE; Config_getBool("EXTRACT_PRIVATE") = TRUE; - } + Config_getBool("ENABLE_PREPROCESSING") = FALSE; + } } diff --git a/src/config.xml b/src/config.xml index dc79fc7..adbb326 100644 --- a/src/config.xml +++ b/src/config.xml @@ -250,6 +250,14 @@ doxygen treat .inc files as Fortran files (default is PHP), and .f files as C you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. '> </option> + <option type='bool' id='MARKDOWN_SUPPORT' docs=' +If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +comments according to the Markdown format, which allows for more readable +documentation. See http://daringfireball.net/projects/markdown/ for details. +The output of markdown processing is further processed by doxygen, so you +can mix doxygen, HTML, and XML commands with Markdown formatting. +Disable only in case of backward compatibilities issues. +' defval='1'/> <option type='bool' id='BUILTIN_STL_SUPPORT' docs=' If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to include (a tag file for) the STL sources as input, then you should @@ -1382,20 +1390,16 @@ semicolon, because these will confuse the parser if not removed. </group> <group name='External' docs='Configuration::additions related to external references'> <option type='list' id='TAGFILES' format='file' docs=' -The TAGFILES option can be used to specify one or more tagfiles. -Optionally an initial location of the external documentation -can be added for each tagfile. The format of a tag file without -this location is as follows: +The TAGFILES option can be used to specify one or more tagfiles. For each +tag file the location of the external documentation should be added. The +format of a tag file without this location is as follows: TAGFILES = file1 file2 ... Adding location for the tag files is done as follows: TAGFILES = file1=loc1 "file2 = loc2" ... -where "loc1" and "loc2" can be relative or absolute paths or -URLs. If a location is present for each tag, the installdox tool -does not have to be run to correct the links. -Note that each tag file must have a unique name -(where the name does NOT include the path) -If a tag file is not located in the directory in which doxygen -is run, you must also specify the path to the tagfile here. +where "loc1" and "loc2" can be relative or absolute paths +or URLs. Note that each tag file must have a unique name (where the name does +NOT include the path). If a tag file is not located in the directory in which +doxygen is run, you must also specify the path to the tagfile here. '> </option> <option type='string' id='GENERATE_TAGFILE' format='file' docs=' diff --git a/src/configoptions.cpp b/src/configoptions.cpp index 0fd507b..e211418 100644 --- a/src/configoptions.cpp +++ b/src/configoptions.cpp @@ -350,6 +350,17 @@ void addConfigOptions(Config *cfg) ); //---- cb = cfg->addBool( + "MARKDOWN_SUPPORT", + "If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all\n" + "comments according to the Markdown format, which allows for more readable\n" + "documentation. See http://daringfireball.net/projects/markdown/ for details.\n" + "The output of markdown processing is further processed by doxygen, so you\n" + "can mix doxygen, HTML, and XML commands with Markdown formatting.\n" + "Disable only in case of backward compatibilities issues.", + TRUE + ); + //---- + cb = cfg->addBool( "BUILTIN_STL_SUPPORT", "If you use STL classes (i.e. std::string, std::vector, etc.) but do not want\n" "to include (a tag file for) the STL sources as input, then you should\n" @@ -2087,22 +2098,18 @@ void addConfigOptions(Config *cfg) //---- cl = cfg->addList( "TAGFILES", - "The TAGFILES option can be used to specify one or more tagfiles.\n" - "Optionally an initial location of the external documentation\n" - "can be added for each tagfile. The format of a tag file without\n" - "this location is as follows:\n" + "The TAGFILES option can be used to specify one or more tagfiles. For each\n" + "tag file the location of the external documentation should be added. The\n" + "format of a tag file without this location is as follows:\n" "\n" "TAGFILES = file1 file2 ...\n" "Adding location for the tag files is done as follows:\n" "\n" "TAGFILES = file1=loc1 \"file2 = loc2\" ...\n" - "where \"loc1\" and \"loc2\" can be relative or absolute paths or\n" - "URLs. If a location is present for each tag, the installdox tool\n" - "does not have to be run to correct the links.\n" - "Note that each tag file must have a unique name\n" - "(where the name does NOT include the path)\n" - "If a tag file is not located in the directory in which doxygen\n" - "is run, you must also specify the path to the tagfile here." + "where \"loc1\" and \"loc2\" can be relative or absolute paths\n" + "or URLs. Note that each tag file must have a unique name (where the name does\n" + "NOT include the path). If a tag file is not located in the directory in which\n" + "doxygen is run, you must also specify the path to the tagfile here." ); cl->setWidgetType(ConfigList::File); //---- diff --git a/src/dbusxmlscanner.cpp b/src/dbusxmlscanner.cpp index 2239f85..9cc3d93 100644 --- a/src/dbusxmlscanner.cpp +++ b/src/dbusxmlscanner.cpp @@ -354,7 +354,7 @@ public: // Interface: if (DBUS("interface")) { - CONDITION(m_currentInterface, "end of interface found without start."); + CONDITION(!m_currentInterface, "end of interface found without start."); m_currentInterface->endBodyLine = lineNumber(); closeScopes(); m_currentInterface = 0; @@ -362,8 +362,8 @@ public: if (DBUS("method") || DBUS("signal")) { - CONDITION(m_currentMethod, "end of method found without start."); - CONDITION(m_currentInterface, "end of method found outside interface."); + CONDITION(!m_currentMethod, "end of method found without start."); + CONDITION(!m_currentInterface, "end of method found outside interface."); m_currentMethod->endBodyLine = lineNumber(); m_currentInterface->addSubEntry(m_currentMethod); m_currentMethod = 0; @@ -371,8 +371,8 @@ public: if (DBUS("property")) { - CONDITION(m_currentMethod, "end of property found without start."); - CONDITION(m_currentInterface, "end of property found outside interface."); + CONDITION(!m_currentProperty, "end of property found without start."); + CONDITION(!m_currentInterface, "end of property found outside interface."); m_currentProperty->endBodyLine = lineNumber(); m_currentInterface->addSubEntry(m_currentProperty); m_currentProperty = 0; @@ -380,7 +380,7 @@ public: if (DBUS("arg")) { - CONDITION(m_currentMethod, "end of arg found outside method."); + CONDITION(!m_currentMethod, "end of arg found outside method."); m_currentMethod->argList->append(m_currentArgument); m_currentArgument = 0; } @@ -388,7 +388,7 @@ public: if (EXTENSION("namespace")) { Entry * current = m_namespaceStack.last(); - CONDITION(current, "end of namespace without start."); + CONDITION(!current, "end of namespace without start."); m_namespaceStack.removeLast(); current->endBodyLine = lineNumber(); @@ -398,7 +398,7 @@ public: if (EXTENSION("struct")) { StructData * data = m_structStack.last(); - CONDITION(data, "end of struct without start."); + CONDITION(!data, "end of struct without start."); data->entry->endBodyLine = lineNumber(); @@ -417,13 +417,13 @@ public: if (EXTENSION("member")) { StructData * data = m_structStack.last(); - CONDITION(data, "end of struct without start"); + CONDITION(!data, "end of member outside struct."); data->entry->addSubEntry(m_currentEntry); } if (EXTENSION("enum") || EXTENSION("flagset")) { - CONDITION(m_currentEnum, "end of enum without start"); + CONDITION(!m_currentEnum, "end of enum without start."); m_currentEnum->endBodyLine = lineNumber(); closeScopes(); @@ -432,7 +432,7 @@ public: if (EXTENSION("value")) { - CONDITION(m_currentEntry, "end of value without start"); + CONDITION(!m_currentEntry, "end of value without start"); m_currentEntry->endBodyLine = lineNumber(); m_currentEnum->addSubEntry(m_currentEntry); @@ -451,7 +451,7 @@ public: m_currentComment = new CommentData(m_fileName, lineNumber(), comment_); - if (!m_currentComment->shouldIgnore) + if (m_currentComment->shouldIgnore) { delete m_currentComment; m_currentComment = 0; @@ -532,21 +532,7 @@ private: const QString & qName, const QString & element) { - // isNull happens in startelement if no URI is used. - if (namespaceURI.isNull()) - { return false; } - - // We are in a endElement: URI is always empty there:-( - if (namespaceURI.isEmpty()) - { return qName == m_scopeStack.last()->extensionPrefix + element; } - - // startElemennt: We need to save the qName prefix - // since endElement will forget about the namespaceURi:-( - if (namespaceURI == EXTENSION_URI) - { - int pos = qName.find(':'); - m_scopeStack.last()->extensionPrefix = qName.left(pos + 1); - } + (void)qName; return namespaceURI == EXTENSION_URI && localName == element; } @@ -756,7 +742,6 @@ private: ~ElementData() { } QString element; //*< The element name - QString extensionPrefix; //*< The prefix used for our extension. QString text; //*< The actual xml code. }; QList<ElementData> m_elementStack; @@ -789,7 +774,6 @@ private: ~ScopeData() { } Entry * scope; - QString extensionPrefix; int count; }; QList<ScopeData> m_scopeStack; // Scopes are nested. @@ -846,7 +830,6 @@ void DBusXMLScanner::parseInput(const char * fileName, const char * /* fileBuf */, Entry * root) { - err("Note that the dbusxml parser seems to be broken :-(\nPlease help me to fix it!\n"); QFile inputFile(fileName); QXmlInputSource inputSource(inputFile); @@ -861,7 +844,7 @@ void DBusXMLScanner::parseInput(const char * fileName, handler.setSection(); reader.parse(inputSource); - if (handler.errorString()) + if (!handler.errorString().isEmpty()) { err("DBus XML Parser: Error at line %d: %s\n", handler.locator()->lineNumber(),handler.errorString().utf8().data()); } diff --git a/src/debug.cpp b/src/debug.cpp index a8e0774..1c23737 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -44,6 +44,7 @@ static LabelMap s_labels[] = { "printtree", Debug::PrintTree }, { "time", Debug::Time }, { "extcmd", Debug::ExtCmd }, + { "markdown", Debug::Markdown }, { 0, (Debug::DebugMask)0 } }; diff --git a/src/debug.h b/src/debug.h index f192ffb..98b80b9 100644 --- a/src/debug.h +++ b/src/debug.h @@ -33,7 +33,8 @@ class Debug Validate = 0x00000080, PrintTree = 0x00000100, Time = 0x00000200, - ExtCmd = 0x00000400 + ExtCmd = 0x00000400, + Markdown = 0x00000800 }; static void print(DebugMask mask,int prio,const char *fmt,...); static void setFlag(const char *label); diff --git a/src/definition.cpp b/src/definition.cpp index 3a61b7b..e04c767 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1340,7 +1340,7 @@ void Definition::writePathFragment(OutputList &ol) const ol.writeString(" </li>\n"); } -void Definition::writeNavigationPath(OutputList &ol,bool showSearchInfo) const +void Definition::writeNavigationPath(OutputList &ol) const { static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); @@ -1351,10 +1351,10 @@ void Definition::writeNavigationPath(OutputList &ol,bool showSearchInfo) const { ol.writeString("</div>\n"); } - if (showSearchInfo) - { - ol.writeSearchInfo(); - } + //if (showSearchInfo) + //{ + // ol.writeSearchInfo(); + //} ol.writeString(" <div id=\"nav-path\" class=\"navpath\">\n"); ol.writeString(" <ul>\n"); diff --git a/src/definition.h b/src/definition.h index 8c6bda3..1e51a1c 100644 --- a/src/definition.h +++ b/src/definition.h @@ -317,7 +317,7 @@ class Definition : public DefinitionIntf, public LockableObj void writeSourceReffedBy(OutputList &ol,const char *scopeName); void makePartOfGroup(GroupDef *gd); void writePathFragment(OutputList &ol) const; - void writeNavigationPath(OutputList &ol,bool showSearchInfo=TRUE) const; + void writeNavigationPath(OutputList &ol) const; virtual void writeQuickMemberLinks(OutputList &,MemberDef *) const {} virtual void writeSummaryLinks(OutputList &) {} QCString pathFragment() const; diff --git a/src/docparser.cpp b/src/docparser.cpp index 48810ed..3ec6631 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1605,6 +1605,9 @@ static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, } while (retval==TK_NEWPARA); if (lastPar) lastPar->markLast(); + //printf("internalValidateParsingDoc: %p: isFirst=%d isLast=%d\n", + // lastPar,lastPar?lastPar->isFirst():-1,lastPar?lastPar->isLast():-1); + return retval; } @@ -1900,7 +1903,7 @@ void DocIncOperator::parse() //--------------------------------------------------------------------------- -void DocCopy::parse() +void DocCopy::parse(QList<DocNode> &children) { QCString doc,brief; Definition *def; @@ -1938,7 +1941,7 @@ void DocCopy::parse() if (m_copyBrief) { brief+='\n'; - internalValidatingParseDoc(this,m_children,brief); + internalValidatingParseDoc(m_parent,children,brief); //printf("..2 hasParamCommand=%d hasReturnCommand=%d paramsFound=%d\n", // g_hasParamCommand,g_hasReturnCommand,g_paramsFound.count()); @@ -1954,7 +1957,7 @@ void DocCopy::parse() if (m_copyDetails) { doc+='\n'; - internalValidatingParseDoc(this,m_children,doc); + internalValidatingParseDoc(m_parent,children,doc); //printf("..3 hasParamCommand=%d hasReturnCommand=%d paramsFound=%d\n", // g_hasParamCommand,g_hasReturnCommand,g_paramsFound.count()); @@ -3990,6 +3993,33 @@ endlist: RetVal_OK : retval; } +//-------------------------------------------------------------------------- + +int DocHtmlBlockQuote::parse() +{ + DBG(("DocHtmlBlockQuote::parse() start\n")); + int retval=0; + g_nodeStack.push(this); + + // parse one or more paragraphs + bool isFirst=TRUE; + DocPara *par=0; + do + { + par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } + m_children.append(par); + retval=par->parse(); + } + while (retval==TK_NEWPARA); + if (par) par->markLast(); + + DocNode *n=g_nodeStack.pop(); + ASSERT(n==this); + DBG(("DocHtmlBlockQuote::parse() end retval=%x\n",retval)); + return (retval==RetVal_EndBlockQuote) ? RetVal_OK : retval; +} + //--------------------------------------------------------------------------- int DocSimpleListItem::parse() @@ -4026,11 +4056,37 @@ int DocAutoListItem::parse() { int retval = RetVal_OK; g_nodeStack.push(this); - retval=m_paragraph->parse(); - m_paragraph->markFirst(); - m_paragraph->markLast(); + + //retval=m_paragraph->parse(); + //m_paragraph->markFirst(); + //m_paragraph->markLast(); + + // first parse any number of paragraphs + bool isFirst=TRUE; + DocPara *lastPar=0; + do + { + DocPara *par = new DocPara(this); + if (isFirst) { par->markFirst(); isFirst=FALSE; } + retval=par->parse(); + if (!par->isEmpty()) + { + m_children.append(par); + if (lastPar) lastPar->markLast(FALSE); + lastPar=par; + } + else + { + delete par; + } + // next paragraph should be more indented than the - marker to belong + // to this item + } while (retval==TK_NEWPARA && g_token->indent>m_indent); + if (lastPar) lastPar->markLast(); + DocNode *n=g_nodeStack.pop(); ASSERT(n==this); + //printf("DocAutoListItem: retval=%d indent=%d\n",retval,g_token->indent); return retval; } @@ -4044,7 +4100,7 @@ int DocAutoList::parse() // first item or sub list => create new list do { - DocAutoListItem *li = new DocAutoListItem(this,num++); + DocAutoListItem *li = new DocAutoListItem(this,m_indent,num++); m_children.append(li); retval=li->parse(); } @@ -5179,8 +5235,9 @@ int DocPara::handleCommand(const QCString &cmdName) DocCopy *cpy = new DocCopy(this,g_token->name, cmdId==CMD_COPYDOC || cmdId==CMD_COPYBRIEF, cmdId==CMD_COPYDOC || cmdId==CMD_COPYDETAILS); - m_children.append(cpy); - cpy->parse(); + //m_children.append(cpy); + cpy->parse(m_children); + delete cpy; } break; case CMD_INCLUDE: @@ -5476,6 +5533,13 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta } } break; + case HTML_BLOCKQUOTE: + { + DocHtmlBlockQuote *block = new DocHtmlBlockQuote(this,tagHtmlAttribs); + m_children.append(block); + retval = block->parse(); + } + break; case XML_SUMMARY: case XML_REMARKS: @@ -5727,6 +5791,9 @@ int DocPara::handleHtmlEndTag(const QCString &tagName) // ignore </li> tags } break; + case HTML_BLOCKQUOTE: + retval=RetVal_EndBlockQuote; + break; //case HTML_PRE: // if (!insidePRE(this)) // { @@ -5770,7 +5837,6 @@ int DocPara::handleHtmlEndTag(const QCString &tagName) //doctokenizerYYsetInsidePre(FALSE); break; case HTML_P: - // ignore </p> tag retval=TK_NEWPARA; break; case HTML_DL: @@ -5909,6 +5975,7 @@ reparsetoken: k!=DocNode::Kind_SimpleList && /*k!=DocNode::Kind_Verbatim &&*/ k!=DocNode::Kind_HtmlHeader && + k!=DocNode::Kind_HtmlBlockQuote && k!=DocNode::Kind_ParamSect && k!=DocNode::Kind_XRefItem ) @@ -5940,7 +6007,8 @@ reparsetoken: n=parent(); while(n) { - if(n->kind() == DocNode::Kind_AutoList) ++depth; + if (n->kind() == DocNode::Kind_AutoList && + ((DocAutoList*)n)->isEnumList()) depth++; n=n->parent(); } @@ -5948,8 +6016,7 @@ reparsetoken: DocAutoList *al=0; do { - al = new DocAutoList(this,g_token->indent,g_token->isEnumList, - depth); + al = new DocAutoList(this,g_token->indent,g_token->isEnumList, depth); m_children.append(al); retval = al->parse(); } while (retval==TK_LISTITEM && // new list @@ -6641,7 +6708,6 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, delete v; } - checkUndocumentedParams(); detectNoDocumentedParams(); diff --git a/src/docparser.h b/src/docparser.h index 1e1fb0e..4e8587c 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -132,7 +132,8 @@ class DocNode Kind_InternalRef = 45, Kind_Copy = 46, Kind_Text = 47, - Kind_MscFile = 48 + Kind_MscFile = 48, + Kind_HtmlBlockQuote = 49 }; /*! Creates a new node */ DocNode() : m_parent(0), m_insidePre(FALSE) {} @@ -182,6 +183,8 @@ template<class T> class CompAccept for (cli.toFirst();(n=cli.current());++cli) n->accept(v); v->visitPost(obj); } + const QList<DocNode> &children() const { return m_children; } + QList<DocNode> &children() { return m_children; } protected: QList<DocNode> m_children; @@ -508,7 +511,7 @@ class DocIndexEntry : public DocNode //----------------------------------------------------------------------- /*! @brief Node representing a copy of documentation block. */ -class DocCopy : public CompAccept<DocCopy>, public DocNode +class DocCopy : /*public CompAccept<DocCopy>,*/ public DocNode { public: DocCopy(DocNode *parent,const QCString &link,bool copyBrief,bool copyDetails) @@ -516,8 +519,8 @@ class DocCopy : public CompAccept<DocCopy>, public DocNode m_copyBrief(copyBrief), m_copyDetails(copyDetails) { m_parent = parent; } Kind kind() const { return Kind_Copy; } QCString link() const { return m_link; } - void accept(DocVisitor *v) { CompAccept<DocCopy>::accept(this,v); } - void parse(); + void accept(DocVisitor * /*v*/) { /*CompAccept<DocCopy>::accept(this,v);*/ } + void parse(QList<DocNode> &children); private: QCString m_link; @@ -546,6 +549,24 @@ class DocAutoList : public CompAccept<DocAutoList>, public DocNode int m_depth; }; +/*! @brief Node representing an item of a auto list */ +class DocAutoListItem : public CompAccept<DocAutoListItem>, public DocNode +{ + public: + DocAutoListItem(DocNode *parent,int indent,int num) + : m_indent(indent), m_itemNum(num) + { m_parent = parent; } + Kind kind() const { return Kind_AutoListItem; } + int itemNumber() const { return m_itemNum; } + void accept(DocVisitor *v) { CompAccept<DocAutoListItem>::accept(this,v); } + int parse(); + + private: + int m_indent; + int m_itemNum; +}; + + /*! @brief Node representing a simple section title */ class DocTitle : public CompAccept<DocTitle>, public DocNode @@ -574,7 +595,6 @@ class DocXRefItem : public CompAccept<DocXRefItem>, public DocNode QCString key() const { return m_key; } void accept(DocVisitor *v) { CompAccept<DocXRefItem>::accept(this,v); } bool parse(); - const QList<DocNode> &children() const { return m_children; } private: int m_id; @@ -848,7 +868,6 @@ class DocSecRefItem : public CompAccept<DocSecRefItem>, public DocNode QCString anchor() const { return m_anchor; } void accept(DocVisitor *v) { CompAccept<DocSecRefItem>::accept(this,v); } void parse(); - const QList<DocNode> &children() const { return m_children; } private: QCString m_target; @@ -930,7 +949,6 @@ class DocSimpleSect : public CompAccept<DocSimpleSect>, public DocNode int parseRcs(); int parseXml(); void appendLinkWord(const QCString &word); - const QList<DocNode> &children() const { return m_children; } private: Type m_type; @@ -995,8 +1013,6 @@ class DocPara : public CompAccept<DocPara>, public DocNode void markLast(bool v=TRUE) { m_isLast=v; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } - const QList<DocNode> &children() const { return m_children; } - QList<DocNode> &children() { return m_children; } int handleCommand(const QCString &cmdName); int handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &tagHtmlAttribs); @@ -1018,6 +1034,7 @@ class DocPara : public CompAccept<DocPara>, public DocNode void handleInheritDoc(); int handleStartCode(); int handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level); + bool injectToken(int tok,const QCString &tokText); private: @@ -1068,28 +1085,6 @@ class DocParamList : public DocNode bool m_isLast; }; -/*! @brief Node representing an item of a auto list */ -class DocAutoListItem : public DocNode -{ - public: - DocAutoListItem(DocNode *parent,int num) : m_itemNum(num) - { m_paragraph=new DocPara(this); m_parent = parent; } - virtual ~DocAutoListItem() { delete m_paragraph; } - Kind kind() const { return Kind_AutoListItem; } - int itemNumber() const { return m_itemNum; } - void accept(DocVisitor *v) - { - v->visitPre(this); - m_paragraph->accept(v); - v->visitPost(this); - } - int parse(); - - private: - DocPara *m_paragraph; - int m_itemNum; -}; - /*! @brief Node representing a simple list item */ class DocSimpleListItem : public DocNode { @@ -1122,7 +1117,6 @@ class DocHtmlListItem : public CompAccept<DocHtmlListItem>, public DocNode void accept(DocVisitor *v) { CompAccept<DocHtmlListItem>::accept(this,v); } int parse(); int parseXml(); - const QList<DocNode> &children() const { return m_children; } private: HtmlAttribList m_attribs; @@ -1138,7 +1132,6 @@ class DocHtmlDescData : public CompAccept<DocHtmlDescData>, public DocNode const HtmlAttribList &attribs() const { return m_attribs; } void accept(DocVisitor *v) { CompAccept<DocHtmlDescData>::accept(this,v); } int parse(); - const QList<DocNode> &children() const { return m_children; } private: HtmlAttribList m_attribs; @@ -1159,7 +1152,6 @@ class DocHtmlCell : public CompAccept<DocHtmlCell>, public DocNode void markFirst(bool v=TRUE) { m_isFirst=v; } void markLast(bool v=TRUE) { m_isLast=v; } const HtmlAttribList &attribs() const { return m_attribs; } - const QList<DocNode> &children() const { return m_children; } int parse(); int parseXml(); @@ -1221,7 +1213,22 @@ class DocHtmlTable : public CompAccept<DocHtmlTable>, public DocNode private: DocHtmlCaption *m_caption; - HtmlAttribList m_attribs; + HtmlAttribList m_attribs; +}; + +/*! @brief Node representing an HTML blockquote */ +class DocHtmlBlockQuote : public CompAccept<DocHtmlBlockQuote>, public DocNode +{ + public: + DocHtmlBlockQuote(DocNode *parent,const HtmlAttribList &attribs) + : m_attribs(attribs) { m_parent = parent; } + Kind kind() const { return Kind_HtmlBlockQuote; } + int parse(); + void accept(DocVisitor *v) { CompAccept<DocHtmlBlockQuote>::accept(this,v); } + const HtmlAttribList &attribs() const { return m_attribs; } + + private: + HtmlAttribList m_attribs; }; /*! @brief Root node of a text fragment */ @@ -1244,7 +1251,6 @@ class DocRoot : public CompAccept<DocRoot>, public DocNode void parse(); bool indent() const { return m_indent; } bool singleLine() const { return m_singleLine; } - const QList<DocNode> &children() const { return m_children; } private: bool m_indent; diff --git a/src/doctokenizer.h b/src/doctokenizer.h index 5c352ca..f86020a 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -59,7 +59,8 @@ enum Tokens RetVal_EndTable = 0x10010, RetVal_Internal = 0x10011, RetVal_SwitchLang = 0x10012, - RetVal_CloseXml = 0x10013 + RetVal_CloseXml = 0x10013, + RetVal_EndBlockQuote = 0x10014 }; struct TokenInfo diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 3772807..765e6c8 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -23,6 +23,7 @@ #include <qstring.h> #include <qstack.h> #include <qdict.h> +#include <qregexp.h> #include "doctokenizer.h" #include "cmdmapper.h" @@ -257,17 +258,44 @@ static void handleHtmlTag() } } -static QCString stripEmptyLines(const char *s) +static QCString stripEmptyLines(const QCString &s) { - if (s==0) return QCString(); - int result=0,p=0; + if (s.isEmpty()) return QCString(); + int end=s.length(); + int start=0,p=0; + // skip leading empty lines for (;;) { int c; - while ((c=s[p]) && isspace(c)) p++; - if (s[p]=='\n') result=++p; else break; + while ((c=s[p]) && (c==' ' || c=='\t')) p++; + if (s[p]=='\n') + { + start=++p; + } + else + { + break; + } + } + // skip trailing empty lines + p=end-1; + if (p>=start && s.at(p)=='\n') p--; + while (p>=start) + { + int c; + while ((c=s[p]) && (c==' ' || c=='\t')) p--; + if (s[p]=='\n') + { + end=p; + } + else + { + break; + } + p--; } - return &s[result]; + //printf("stripEmptyLines(%d-%d)\n",start,end); + return s.mid(start,end-start); } //-------------------------------------------------------------------------- @@ -288,18 +316,20 @@ static int yyread(char *buf,int max_size) %} -CMD ("\\"|"@") -WS [ \t\r\n] -NONWS [^ \t\r\n] -BLANK [ \t\r] -ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* -LABELID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF\-]* -CITEID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF\-:/]* -MAILADR [a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+ -OPTSTARS ("//"{BLANK}*)?"*"*{BLANK}* -LISTITEM {BLANK}*{OPTSTARS}"-"("#")?{WS} -ENDLIST {BLANK}*{OPTSTARS}"."{BLANK}*\n -ATTRIB {ID}{WS}*("="{WS}*(("\""[^\"]*"\"")|("'"[^\']*"'")|[^ \t\r\n'"><]+))? +CMD ("\\"|"@") +WS [ \t\r\n] +NONWS [^ \t\r\n] +BLANK [ \t\r] +ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* +LABELID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF\-]* +CITEID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF\-:/]* +MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+ +OPTSTARS ("//"{BLANK}*)?"*"*{BLANK}* +LISTITEM {BLANK}*[-]("#")?{WS} +MLISTITEM {BLANK}*[+*]{WS} +OLISTITEM {BLANK}*[1-9][0-9]*"."{WS} +ENDLIST {BLANK}*"."{BLANK}*\n +ATTRIB {ID}{WS}*("="{WS}*(("\""[^\"]*"\"")|("'"[^\']*"'")|[^ \t\r\n'"><]+))? URLCHAR [a-z_A-Z0-9\!\~\,\:\;\'\$\?\@\&\%\#\.\-\+\/\=] URLMASK ({URLCHAR}+([({]{URLCHAR}*[)}])?)+ FILESCHAR [a-z_A-Z0-9\\:\\\/\-\+] @@ -309,7 +339,7 @@ FILEMASK ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|{HFILEMASK} LINKMASK [^ \t\n\r\\@<&${}]+("("[^\n)]*")")?({BLANK}*("const"|"volatile"){BLANK}+)? VERBATIM "verbatim"{BLANK}* SPCMD1 {CMD}([a-z_A-Z][a-z_A-Z0-9]*|{VERBATIM}) -SPCMD2 {CMD}[\\@<>&$#%~"] +SPCMD2 {CMD}[\\@<>&$#%~".] SPCMD3 {CMD}form#[0-9]+ SPCMD4 {CMD}"::" INOUT "in"|"out"|("in"{BLANK}*","{BLANK}*"out")|("out"{BLANK}*","{BLANK}*"in") @@ -389,14 +419,44 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3} %x St_SecSkip %% -<St_Para>\r /* skip carriage return */ -<St_Para>^{LISTITEM} { /* list item */ +<St_Para>\r /* skip carriage return */ +<St_Para>^{LISTITEM} { /* list item */ QCString text=yytext; int dashPos = text.findRev('-'); g_token->isEnumList = text.at(dashPos+1)=='#'; g_token->indent = computeIndent(yytext,dashPos); return TK_LISTITEM; } +<St_Para>^{MLISTITEM} { /* list item */ + if (!Doxygen::markdownSupport) + { + REJECT; + } + else + { + QCString text=yytext; + static QRegExp re("[*+]"); + int listPos = text.findRev(re); + g_token->isEnumList = FALSE; + g_token->indent = computeIndent(yytext,listPos); + return TK_LISTITEM; + } + } +<St_Para>^{OLISTITEM} { /* numbered list item */ + if (!Doxygen::markdownSupport) + { + REJECT; + } + else + { + QCString text=yytext; + static QRegExp re("[1-9]"); + int digitPos = text.find(re); + g_token->isEnumList = TRUE; + g_token->indent = computeIndent(yytext,digitPos); + return TK_LISTITEM; + } + } <St_Para>{BLANK}*\n{LISTITEM} { /* list item on next line */ QCString text=yytext; text=text.right(text.length()-text.find('\n')-1); @@ -405,6 +465,38 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3} g_token->indent = computeIndent(text,dashPos); return TK_LISTITEM; } +<St_Para>{BLANK}*\n{MLISTITEM} { /* list item on next line */ + if (!Doxygen::markdownSupport) + { + REJECT; + } + else + { + QCString text=yytext; + static QRegExp re("[*+]"); + text=text.right(text.length()-text.find('\n')-1); + int markPos = text.findRev(re); + g_token->isEnumList = FALSE; + g_token->indent = computeIndent(text,markPos); + return TK_LISTITEM; + } + } +<St_Para>{BLANK}*\n{OLISTITEM} { /* list item on next line */ + if (!Doxygen::markdownSupport) + { + REJECT; + } + else + { + QCString text=yytext; + text=text.right(text.length()-text.find('\n')-1); + static QRegExp re("[1-9]"); + int digitPos = text.find(re); + g_token->isEnumList = TRUE; + g_token->indent = computeIndent(text,digitPos); + return TK_LISTITEM; + } + } <St_Para>^{ENDLIST} { /* end list */ int dotPos = QCString(yytext).findRev('.'); g_token->indent = computeIndent(yytext,dotPos); @@ -479,8 +571,22 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3} g_token->isEMailAddr=FALSE; return TK_URL; } +<St_Para>"<"("http:"|"https:"|"ftp:"|"file:"|"news:"){URLMASK}">" { // URL + g_token->name=yytext; + g_token->name = g_token->name.mid(1,g_token->name.length()-2); + g_token->isEMailAddr=FALSE; + return TK_URL; + } <St_Para>{MAILADR} { // Mail address g_token->name=yytext; + g_token->name.stripPrefix("mailto:"); + g_token->isEMailAddr=TRUE; + return TK_URL; + } +<St_Para>"<"{MAILADR}">" { // Mail address + g_token->name=yytext; + g_token->name = g_token->name.mid(1,g_token->name.length()-2); + g_token->name.stripPrefix("mailto:"); g_token->isEMailAddr=TRUE; return TK_URL; } @@ -565,7 +671,7 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3} g_token->name = yytext; return TK_COMMAND; } -<St_Para>({BLANK}*\n)+{BLANK}*\n { +<St_Para>({BLANK}*\n)+{BLANK}*\n{BLANK}* { if (g_insidePre) { /* Inside a <pre>..</pre> blank lines are treated @@ -574,9 +680,19 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3} g_token->chars=yytext; return TK_WHITESPACE; } - else + else // found end of a paragraph { - /* start of a new paragraph */ + g_token->indent=computeIndent(yytext,yyleng-1); + int i; + // put back the indentation (needed for list items) + for (i=0;i<g_token->indent;i++) + { + unput(' '); + } + // tell flex that after putting the last indent + // back we are at the beginning of the line + YY_CURRENT_BUFFER->yy_at_bol=1; + // start of a new paragraph return TK_NEWPARA; } } @@ -618,9 +734,9 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3} <St_XmlOnly>{CMD}"endxmlonly" { return RetVal_OK; } -<St_XmlOnly>[^\\@\n]+ | -<St_XmlOnly>\n | -<St_XmlOnly>. { +<St_XmlOnly>[^\\@\n]+ | +<St_XmlOnly>\n | +<St_XmlOnly>. { g_token->verb+=yytext; } <St_Verbatim>{CMD}"endverbatim" { diff --git a/src/docvisitor.h b/src/docvisitor.h index 8978831..057da5f 100644 --- a/src/docvisitor.h +++ b/src/docvisitor.h @@ -72,14 +72,14 @@ class DocRef; class DocFormula; class DocSecRefItem; class DocSecRefList; -//class DocLanguage; class DocLinkedWord; class DocParamSect; class DocParamList; class DocInternalRef; -class DocCopy; +class DocCopy; // TODO: no longer generated => remove class DocText; class DocSimpleSectSep; +class DocHtmlBlockQuote; /*! @brief Abstract visitor that participates in the visitor pattern. */ @@ -171,8 +171,6 @@ class DocVisitor virtual void visitPost(DocSecRefItem *) = 0; virtual void visitPre(DocSecRefList *) = 0; virtual void visitPost(DocSecRefList *) = 0; - //virtual void visitPre(DocLanguage *) = 0; - //virtual void visitPost(DocLanguage *) = 0; virtual void visitPre(DocParamSect *) = 0; virtual void visitPost(DocParamSect *) = 0; virtual void visitPre(DocParamList *) = 0; @@ -185,6 +183,8 @@ class DocVisitor virtual void visitPost(DocCopy *) = 0; virtual void visitPre(DocText *) = 0; virtual void visitPost(DocText *) = 0; + virtual void visitPre(DocHtmlBlockQuote *) = 0; + virtual void visitPost(DocHtmlBlockQuote *) = 0; /*! @} */ }; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index d200a47..aa61647 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -34,7 +34,6 @@ #include "entry.h" #include "index.h" #include "logos.h" -#include "instdox.h" #include "message.h" #include "config.h" #include "util.h" @@ -82,6 +81,7 @@ #include "eclipsehelp.h" #include "cite.h" #include "filestorage.h" +#include "markdown.h" #include "layout.h" @@ -150,6 +150,7 @@ int Doxygen::subpageNestingLevel = 0; bool Doxygen::userComments = FALSE; QCString Doxygen::spaces; bool Doxygen::generatingXmlOutput = FALSE; +bool Doxygen::markdownSupport = TRUE; // locally accessible globals static QDict<EntryNav> g_classEntries(1009); @@ -502,7 +503,8 @@ static void addRelatedPage(EntryNav *rootNav) PageDef *pd = addRelatedPage(root->name,root->args,doc,root->anchors, root->fileName,root->startLine, root->sli, - gd,rootNav->tagInfo() + gd,rootNav->tagInfo(), + root->lang ); if (pd) { @@ -7652,28 +7654,6 @@ static void generateClassList(ClassSDict &classSDict) static void generateClassDocs() { - // write the installdox script if necessary - if (Config_getBool("GENERATE_HTML") && - (Config_getList("TAGFILES").count()>0 || - Config_getBool("SEARCHENGINE") - ) - ) - { - writeInstallScript(); - } - - //msg("Generating annotated compound index...\n"); - //writeAnnotatedIndex(*g_outputList); - - //msg("Generating alphabetical compound index...\n"); - //writeAlphabeticalIndex(*g_outputList); - - //msg("Generating hierarchical class index...\n"); - //writeHierarchicalIndex(*g_outputList); - - //msg("Generating member index...\n"); - //writeClassMemberIndex(*g_outputList); - generateClassList(*Doxygen::classSDict); generateClassList(*Doxygen::hiddenClasses); } @@ -8442,6 +8422,7 @@ static void buildExampleList(EntryNav *rootNav) root->name,root->brief+root->doc+root->inbodyDocs,root->args); pd->setFileName(convertNameToFile(pd->name()+"-example",FALSE,TRUE)); pd->addSectionsToDefinition(root->anchors); + pd->setLanguage(root->lang); //pi->addSections(root->anchors); Doxygen::exampleSDict->inSort(root->name,pd); @@ -8500,8 +8481,7 @@ static void generateExampleDocs() TRUE, // is example pd->name() ); - g_outputList->endContents(); - endFile(*g_outputList); + endFile(*g_outputList); // contains g_outputList->endContents() } g_outputList->enable(OutputGenerator::Man); } @@ -9358,6 +9338,7 @@ void initDoxygen() Doxygen::parserManager->registerParser("vhdl", new VHDLLanguageScanner); Doxygen::parserManager->registerParser("dbusxml", new DBusXMLScanner); Doxygen::parserManager->registerParser("tcl", new TclLanguageScanner); + Doxygen::parserManager->registerParser("md", new MarkdownFileParser); // register any additional parsers here... @@ -9830,6 +9811,8 @@ void adjustConfiguration() Config_getBool("CALLER_GRAPH") || Config_getBool("REFERENCES_RELATION") || Config_getBool("REFERENCED_BY_RELATION"); + + Doxygen::markdownSupport = Config_getBool("MARKDOWN_SUPPORT"); /************************************************************************** * Add custom extension mappings diff --git a/src/doxygen.css b/src/doxygen.css index b3365a7..613a3d3 100644 --- a/src/doxygen.css +++ b/src/doxygen.css @@ -293,6 +293,13 @@ span.vhdllogic { color: #ff0000 } +blockquote { + background-color: ##F8; + border-left: 2px solid ##AA; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + /* @end */ /* @@ -616,6 +623,8 @@ address { table.doxtable { border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; } table.doxtable td, table.doxtable th { diff --git a/src/doxygen.h b/src/doxygen.h index 0722513..b06d205 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -134,6 +134,7 @@ class Doxygen static int subpageNestingLevel; static QCString spaces; static bool generatingXmlOutput; + static bool markdownSupport; }; void initDoxygen(); diff --git a/src/doxygen_css.h b/src/doxygen_css.h index 4466e07..1e4f161 100644 --- a/src/doxygen_css.h +++ b/src/doxygen_css.h @@ -293,6 +293,13 @@ " color: #ff0000 \n" "}\n" "\n" +"blockquote {\n" +" background-color: ##F8;\n" +" border-left: 2px solid ##AA;\n" +" margin: 0 24px 0 4px;\n" +" padding: 0 12px 0 16px;\n" +"}\n" +"\n" "/* @end */\n" "\n" "/*\n" @@ -616,6 +623,8 @@ "\n" "table.doxtable {\n" " border-collapse:collapse;\n" +" margin-top: 4px;\n" +" margin-bottom: 4px;\n" "}\n" "\n" "table.doxtable td, table.doxtable th {\n" diff --git a/src/doxytag.l b/src/doxytag.l deleted file mode 100644 index f8e4540..0000000 --- a/src/doxytag.l +++ /dev/null @@ -1,930 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2011 by Dimitri van Heesch. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -%{ -/* - * includes - */ -#include <stdio.h> -#include <assert.h> -#include <ctype.h> - -#include "qtbc.h" -#include <qstrlist.h> -#include <qfileinfo.h> -#include <qfile.h> -#include <qdict.h> -#include <qtextstream.h> -#include <qdir.h> - -#include "version.h" -//#include "suffixtree.h" -//#include "searchindex.h" -#include "logos.h" - -static QCString convertToXML(const char *s) -{ - QCString result; - if (s==0) return result; - const char *p=s; - char c; - while ((c=*p++)) - { - switch (c) - { - case '<': result+="<"; break; - case '>': result+=">"; break; - case '&': result+="&"; break; - case '\'': result+="'"; break; - case '"': result+="""; break; - default: result+=c; break; - } - } - return result; -} - -struct MemberDef -{ - QCString name; - QCString anchor; - QCString args; -}; - -struct ClassDef -{ - QCString name; - QStrList bases; - QCString fileName; - bool isFile; - QList<MemberDef> memberList; -}; - -QList<ClassDef> classList; -QDict<ClassDef> classDict(1009); -QList<ClassDef> fileList; -QDict<ClassDef> fileDict(1009); - -static bool genTag; -static bool genIndex; - -static QStrList bases; -static QCString inputString; -static int inputPosition; -static QCString yyFileName; -static int yyLineNr; -static QCString classFile; -static QCString memberRef; -static QCString memberName; -static QCString memberArgs; -static QCString className; -static QCString baseName; -static QCString docBaseLink; -static QCString docAnchor; -static QCString docRefName; -static bool nameBug; -//static SearchIndex searchIndex; - -#define YY_NEVER_INTERACTIVE 1 - -/* ----------------------------------------------------------------- - */ -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); - -static int yyread(char *buf,int max_size) -{ - int c=0; - while( c < max_size && inputString[inputPosition] ) - { - *buf = inputString[inputPosition++] ; - c++; buf++; - } - return c; -} - -static void addClass(const char *clName) -{ - if (classDict[clName]==0) - { - //printf("addClass(%s)\n",clName); - ClassDef *cd=new ClassDef; - cd->name=clName; - cd->fileName=yyFileName; - cd->isFile=FALSE; - classList.append(cd); - classDict.insert(clName,cd); - } -} - -static void addFile(const char *fName) -{ - if (classDict[fName]==0) - { - ClassDef *fd=new ClassDef; - fd->name=fName; - fd->fileName=yyFileName; - fd->isFile=TRUE; - classList.append(fd); - classDict.insert(fName,fd); - } -} - -static void addBases(const char *clName) -{ - ClassDef *cd=0; - if (clName && (cd=classDict[clName])) cd->bases=bases; -} - -static void addMember(const char *memName,const char *memRef,const char *memArgs) -{ - //printf("addMember(%s,%s,%s)\n",memName,memRef,memArgs); - ClassDef *cd=classList.last(); - if (cd) - { - MemberDef *md; - md=new MemberDef; - md->name=memName; - md->anchor=memRef; - md->args=memArgs; - cd->memberList.append(md); - } - else - { - //printf("Warning: found member %s %s but not class was found to insert it!\n", - // memName,memArgs); - } -} - -static void addReference() -{ - //printf("addReference() key: %s ref:%s\n", - // docRefName.data(),(docBaseLink+"#"+docAnchor).data()); - //if (genIndex && !docRefName.isEmpty() && !docBaseLink.isEmpty()) - //{ - // if (docAnchor.isEmpty()) - // searchIndex.addReference(docRefName,docBaseLink); - // else - // searchIndex.addReference(docRefName,docBaseLink+"#"+docAnchor); - // searchIndex.addWord(docRefName,docRefName,TRUE); - //} -} - -QCString unhtmlify(const char *str) -{ - QCString result; - const char *p=str; - char c; - while ((c=*p)!='\0') - { - if (c!='&') { result+=c; p++; } - else - { - if (strncmp(p,"&",5)==0) { result+='&'; p+=5; } - else if (strncmp(p,"<",4)==0) { result+='<'; p+=4; } - else if (strncmp(p,">",4)==0) { result+='>'; p+=4; } - else if (strncmp(p,""",6)==0) { result+='"'; p+=4; } - else /* should not happen */ { result+='&'; p++; } - } - } - return result; -} - -%} - -%x Start -%x SearchClassFile -%x ReadClassFile -%x CheckClassName -%x ReadClassName -%x SearchMemberRef -%x ReadMemberRef -%x SearchMemberName -%x ReadMemberName -%x ReadOperator -%x SearchBaseClasses -%x ReadBaseClass -%x SearchRefName -%x ReadRefName -%x SearchArgs -%x ReadArgs -%x SearchWords -%x SkipHTMLTag -%x CheckConstructor -%x SkipPreformated - -%x Qt3ReadType -%x Qt3ReadAnchor -%x Qt3ReadName -%x Qt3ReadOperator -%x Qt3ReadArgs - -%x DoxReadAnchor -%x DoxReadName -%x DoxReadArgs -%x DoxClassName -%x DoxClassBase - -%% - -<Start>^"<li>" { - BEGIN( SearchClassFile ); - } -<Start>^"<td"[^\n]*"<h1 align=center>" | // Qt-3.x.x -<Start>"</table><h1 align=\"center\">" | // Qt-4 -<Start>"</table><h1 class=\"title\">" | // >Qt-4.4.0 -<Start>^"<h1 align=center>" { // Qt variant - BEGIN( ReadClassName ); - } -<Start>^("<hr>")?"<h1>" { // Doxygen variant - BEGIN( ReadClassName ); - } -<Start>^"Inherits " { - //printf("Inherits found\n"); - BEGIN( SearchBaseClasses ); - } -<Start>^"<h3 class=\"fn\">"/[a-z_A-Z0-9] { // needed due to inconsistency in the Qt docs - BEGIN( CheckConstructor ); - } - - /* --------------------------------------------------- */ - /* Qt member extraction rules */ - -<Start>^"<h3 class=fn>" { - BEGIN( Qt3ReadType ); - } -<Start>^"<h3 class=fn><a name=\"" { // Qt-3.3+ html file - BEGIN( Qt3ReadAnchor ); - } -<Start>^"<h3 class=\"fn\"><a name=\"" { // Qt-4 html file - BEGIN( Qt3ReadAnchor ); - } -<Qt3ReadType>"<a name=\"" { - BEGIN( Qt3ReadAnchor ); - } -<Qt3ReadType>. -<Qt3ReadAnchor>[~a-z_A-Z0-9\-\[\]*+%\^&|!]+ { - memberRef = yytext; - } -<Qt3ReadAnchor>"\"></a>" { - BEGIN( Qt3ReadName ); - } -<Qt3ReadAnchor>. { - BEGIN( Start ); - } -<Qt3ReadName>[a-z_A-Z0-9]+"::operator" { - memberName="operator"; - BEGIN(Qt3ReadOperator); - } -<Qt3ReadOperator>[+\-*/%\^&|~!=\[\]]+ { memberName+=yytext; } -<Qt3ReadOperator>"<" { memberName+="<"; } -<Qt3ReadOperator>">" { memberName+=">"; } -<Qt3ReadOperator>"new" { memberName+=" new"; } -<Qt3ReadOperator>"delete" { memberName+=" delete"; } -<Qt3ReadOperator>"()" { memberName+="()"; BEGIN( Qt3ReadArgs ); } -<Qt3ReadOperator>. { unput(*yytext); BEGIN( Qt3ReadArgs ); } -<Qt3ReadName>[a-z_A-Z0-9]+"::"[~a-z_A-Z0-9]+ { - memberName=yytext; - memberName=memberName.mid(memberName.find("::")+2); - BEGIN(Qt3ReadArgs); - } -<Qt3ReadName>. -<Qt3ReadArgs>[ \t]*"(" { - memberArgs+='('; - } -<Qt3ReadArgs>"&" { memberArgs+='&'; } -<Qt3ReadArgs>"<" { memberArgs+='<'; } -<Qt3ReadArgs>">" { memberArgs+='>'; } -<Qt3ReadArgs>""" { memberArgs+='"'; } -<Qt3ReadArgs>" " { memberArgs+=' '; } -<Qt3ReadArgs>"</h3>" { - addMember(memberName,memberRef,memberArgs); - memberName.resize(0); - memberRef.resize(0); - memberArgs.resize(0); - BEGIN(Start); - } -<Qt3ReadArgs>"<"[^>]+">" -<Qt3ReadArgs>")" { - memberArgs+=')'; - addMember(memberName,memberRef,memberArgs); - memberName.resize(0); - memberRef.resize(0); - memberArgs.resize(0); - BEGIN(Start); - } -<Qt3ReadArgs>[a-z_A-Z0-9]+ { memberArgs+=yytext; } -<Qt3ReadArgs>. { memberArgs+=*yytext; } - - /* --------------------------------------------------- */ - /* Doxygen class extraction rules */ - -<Start>"<!-- doxytag: class=\"" { - className.resize(0); - BEGIN(DoxClassName); - } -<DoxClassName>[^&"]+ { - className=yytext; - addClass(className); - } -<DoxClassName>"<" { - className+='<'; - } -<DoxClassName>">" { - className+='>'; - } -<DoxClassName>"&" { - className+='&'; - } -<DoxClassName>""" { - className+='"'; - } -<DoxClassName>. { - className+=*yytext; - } -<DoxClassName>"\" -->" { - BEGIN(Start); - } - - /* --------------------------------------------------- */ - /* Doxygen inheritance extraction rules */ - -<Start>"<!-- doxytag: inherits=\"" { - bases.clear(); - baseName.resize(0); - BEGIN(DoxClassBase); - } -<DoxClassBase>[^&,"]+ { - baseName+=yytext; - } -<DoxClassBase>"," { - bases.append(baseName); - baseName.resize(0); - } -<DoxClassBase>"<" { - baseName+='<'; - } -<DoxClassBase>">" { - baseName+='>'; - } -<DoxClassBase>"&" { - baseName+='&'; - } -<DoxClassBase>""" { - baseName+='"'; - } -<DoxClassBase>. { - baseName+=*yytext; - } -<DoxClassBase>"\" -->" { - bases.append(baseName); - baseName.resize(0); - addBases(className); - BEGIN(Start); - } - - /* --------------------------------------------------- */ - /* Doxygen member extraction rules */ - -<Start>"<!-- doxytag: member=\"" { - memberName.resize(0); - BEGIN(DoxReadName); - } -<DoxReadName>[^&"]+ { - memberName+=yytext; - } -<DoxReadName>"<" { - memberName+='<'; - } -<DoxReadName>">" { - memberName+='>'; - } -<DoxReadName>"&" { - memberName+='&'; - } -<DoxReadName>""" { - memberName+='"'; - } -<DoxReadName>. { - memberName+=*yytext; - } -<DoxReadName>"\" ref=\"" { - memberName=memberName.mid(memberName.find("::")+2); - memberRef.resize(0); - BEGIN(DoxReadAnchor); - } -<DoxReadAnchor>[^&"]+ { - memberRef+=yytext; - } -<DoxReadAnchor>"<" { - memberRef+='<'; - } -<DoxReadAnchor>">" { - memberRef+='>'; - } -<DoxReadAnchor>"&" { - memberRef+='&'; - } -<DoxReadAnchor>""" { - memberRef+='"'; - } -<DoxReadAnchor>. { - memberRef+=*yytext; - } -<DoxReadAnchor>"\" args=\"" { - memberArgs.resize(0); - BEGIN(DoxReadArgs); - } -<DoxReadArgs>[^&"]+ { - memberArgs+=yytext; - } -<DoxReadArgs>"<" { - memberArgs+='<'; - } -<DoxReadArgs>">" { - memberArgs+='>'; - } -<DoxReadArgs>"&" { - memberArgs+='&'; - } -<DoxReadArgs>""" { - memberArgs+='"'; - } -<DoxReadArgs>. { - memberArgs+=*yytext; - } -<DoxReadArgs>"\" -->" { - addMember(memberName,memberRef,memberArgs); - memberName.resize(0); - memberRef.resize(0); - memberArgs.resize(0); - BEGIN(Start); - } - - /** --------------------------------------------------- */ - -<Start>"<pre>" { - BEGIN( SkipPreformated ); - } -<Start>"<a name=\"" { - BEGIN( SearchWords ); - } -<Start>"<" { - BEGIN( SkipHTMLTag ); - } -<Start>"&"[a-zA-Z]+";" -<Start,SkipPreformated>[a-z_A-Z][a-z_A-Z0-9]* { - //printf("tag: %s#%s ref: %s word: `%s'\n", - // docBaseLink.data(),docAnchor.data(), - // docRefName.data(),yytext); - //if (genIndex && !docRefName.isEmpty() && yyleng>2) - // searchIndex.addWord(docRefName, - // yytext,FALSE - // ); - } -<SkipPreformated>"</pre>" { - BEGIN( Start ); - } -<SkipPreformated>[^\<\n]+ -<CheckConstructor>[a-z_A-Z0-9~:]+ { - QCString s=yytext; - if (s.find("::")!=-1) - { - docRefName=yytext; - addReference(); - nameBug=TRUE; - } - else - { - nameBug=FALSE; - } - BEGIN( Start ); - } -<SearchWords>[a-z_A-Z0-9]+ { - docAnchor = yytext; - if (docAnchor=="details" || - docAnchor=="_details") - { - docRefName=className.copy(); - addReference(); - BEGIN( Start ); - } - else - { - BEGIN( SearchRefName ); - } - } -<SearchRefName>"\" doxytag=\"" { - BEGIN( ReadRefName ); - } -<SearchRefName>"\"></a><a" { // HACK: avoid finding links in code fragments - BEGIN( Start ); - } -<SearchRefName>"\"></a>" { // HACK: deal with Qt code - if (nameBug) - BEGIN( Start ); - else - BEGIN( ReadRefName ); - } - -<ReadRefName>[a-z_A-Z0-9:\.\+\-]*"operator"[ \t]*("new"|"delete"|("&"("&"|"=")*)|(">"(">"|"=")*)|("<"("<"|"=")*)|("->"[*]*)|[+\-*%/|~!=,\^]|[+\-*%/\^!|~=\[(][=|+\-\])]) { // hmm, looks impressive :-) - docRefName=unhtmlify(yytext); - addReference(); - BEGIN( Start ); - } -<ReadRefName>[a-z_A-Z0-9~:\.\+\-]+ { - //printf("ReadRef=%s\n",yytext); - docRefName=yytext; - addReference(); - BEGIN( Start ); - } -<SearchBaseClasses>"<a "[a-z_A-Z0-9 .:\=\"\-\+\/\@]+">" { - //printf("Search %s\n",yytext); - BEGIN( ReadBaseClass ); - } -<SearchBaseClasses>\n { - addBases(className); - BEGIN( Start ); - } -<ReadBaseClass>[a-z_A-Z0-9]+ { - bases.append(yytext); - BEGIN( SearchBaseClasses ); - } -<SearchClassFile>"<a class=\"el\" href=\"" { - BEGIN( ReadClassFile ); - } -<SearchClassFile>"<a href=\"" { - BEGIN( ReadClassFile ); - } -<ReadClassName>[a-z_A-Z0-9:\.\-\+]+ { - className=yytext; - BEGIN( CheckClassName); - } -<CheckClassName>"Class Reference" { - //printf("className=%s\n",className.data()); - addClass(className); - BEGIN( Start ); - } -<CheckClassName>"File Reference" { - //printf("className=%s\n",className.data()); - addFile(className); - BEGIN( Start ); - } -<CheckClassName>[a-z_A-Z0-9]+ { // not a class file - className.resize(0); - BEGIN( Start ); - } -<ReadClassFile>[a-z_A-Z0-9.\-\+]+ { - classFile=yytext; - BEGIN( SearchMemberRef ); - } -<SearchMemberRef,ReadClassFile>"#" { - if (YY_START==ReadClassFile) - { - classFile=yyFileName; - } - //BEGIN( ReadMemberRef ); - BEGIN( Start ); - } -<ReadMemberRef>[a-z_A-Z0-9]+ { - memberRef=yytext; - BEGIN( SearchMemberName ); - } -<SearchMemberName>"<strong>"|"<b>" { // <strong> is for qt-1.44, <b> is for qt-2.00 - BEGIN( ReadMemberName ); - } -<SearchMemberName>[a-z_A-Z~] { - unput(*yytext); - BEGIN( ReadMemberName ); - } -<ReadMemberName>"operator" { - memberName="operator"; - BEGIN( ReadOperator ); - } -<ReadOperator>[+\-*/%\^&|~!=()\[\]] { memberName+=*yytext; } -<ReadOperator>"<" { memberName+="<"; } -<ReadOperator>">" { memberName+=">"; } -<ReadOperator>"new" { memberName+=" new"; } -<ReadOperator>"delete" { memberName+=" delete"; } -<ReadOperator>"<" { BEGIN( SearchArgs ); } -<ReadMemberName>[a-z_A-Z0-9]+ { - memberName=yytext; - BEGIN( SearchArgs ); - } -<SearchArgs>"</a>" { - //printf("SearchArg className=%s memberName=%s\n",className.data(),memberName.data()); - if (!className.isEmpty() && !memberName.isEmpty()) - BEGIN( ReadArgs ); - else - BEGIN( Start ); - } -<ReadArgs>"&" { memberArgs+='&'; } -<ReadArgs>"<" { memberArgs+='<'; } -<ReadArgs>">" { memberArgs+='>'; } -<ReadArgs>""" { memberArgs+='"'; } -<ReadArgs>" " { memberArgs+=' '; } - /* -<ReadArgs>[{}] { // handle enums - memberArgs.resize(0); - addMember(memberName,memberRef,memberArgs); - if (*yytext=='}') - BEGIN( Start ); - else - BEGIN( SearchClassFile ); - } - */ -<ReadArgs>"<"|"\n" { - //printf("adding member %s\n",memberName.data()); - memberArgs=memberArgs.stripWhiteSpace(); - //if (newClass) - //{ - // newClass=FALSE; - // addClass(className); - //} - addMember(memberName,memberRef,memberArgs); - memberName.resize(0); - memberRef.resize(0); - memberArgs.resize(0); - if (*yytext=='<') - BEGIN( SkipHTMLTag); - else - BEGIN( Start ); - } -<ReadArgs>. { memberArgs+=(*yytext)&0x7f; } -<SkipHTMLTag>">" { BEGIN( Start ); } -<SkipHTMLTag>[a-zA-Z]+ -<*>. -<*>\n { yyLineNr++; - if (YY_START!=SkipHTMLTag) BEGIN( Start ); - } - -%% - -/*@ ---------------------------------------------------------------------------- - */ - - -void parse(QCString &s) -{ - bases.clear(); - nameBug = FALSE; - //newClass = TRUE; - inputString = s; - inputPosition = 0; - yyLineNr = 0; - tagYYrestart( tagYYin ); - BEGIN( Start ); - tagYYlex(); - //printf("Number of lines scanned: %d\n",yyLineNr); -} - -void parseFile(QFileInfo &fi) -{ - printf("Parsing file %s...\n",fi.fileName().data()); - QFile f; - f.setName(fi.absFilePath()); - if (f.open(IO_ReadOnly)) - { - yyFileName = fi.fileName(); - className.resize(0); - memberName.resize(0); - //printf("Parsing file %s...\n",fi.fileName().data()); - QCString input(fi.size()+1); - docBaseLink=fi.fileName(); - docRefName=fi.fileName().copy(); - //searchIndex.addReference(docRefName,docBaseLink); - //searchIndex.addWord(docRefName,docRefName,TRUE); - f.readBlock(input.data(),fi.size()); - input.at(fi.size())='\0'; - parse(input); - } - else - { - fprintf(stderr,"Warning: Cannot open file %s\n",fi.fileName().data()); - } -} - -void parseFileOrDir(const char *fileName) -{ - QFileInfo fi(fileName); - if (fi.exists()) - { - if (fi.isFile()) - { - parseFile(fi); - } - else if (fi.isDir()) - { - QDir dir(fileName); - dir.setFilter( QDir::Files ); - dir.setNameFilter( "*.html" ); - const QFileInfoList *list = dir.entryInfoList(); - QFileInfoListIterator it( *list ); - QFileInfo *cfi; - for ( it.toFirst() ; (cfi=it.current()) ; ++it) - { - if (cfi->isFile()) - { - parseFile(*cfi); - } - } - } - } - else - { - fprintf(stderr,"Warning: File %s does not exist\n",fileName); - } -} - -void usage(const char *name) -{ - fprintf(stderr,"Doxytag version %s\nCopyright Dimitri van Heesch 1997-2011\n\n", - versionString); - fprintf(stderr," Generates a tag file and/or a search index for a set of HTML files\n\n"); - fprintf(stderr,"Usage: %s [-t tag_file] [ html_file [html_file...] ]\n",name); - fprintf(stderr,"Options:\n"); - fprintf(stderr," -t <tag_file> Generate tag file <tag_file>.\n"); - fprintf(stderr,"If no HTML files are given all files in the current dir that\n" - "have a .html extension are parsed.\n\n"); - exit(1); -} - -const char *getArg(int argc,char **argv,int &optind,const char c) -{ - char *s=0; - if (strlen(&argv[optind][2])>0) - s=&argv[optind][2]; - else if (optind+1<argc) - s=argv[++optind]; - else - { - fprintf(stderr,"option -%c requires an argument\n",c); - exit(1); - } - return s; -} - -int main(int argc,char **argv) -{ - QCString tagName; - QCString indexName; - - int optind=1; - const char *arg; - while (optind<argc && argv[optind][0]=='-') - { - switch(argv[optind][1]) - { - case 't': - arg=getArg(argc,argv,optind,'t'); - tagName=arg; - break; - case 's': - arg=getArg(argc,argv,optind,'s'); - indexName=arg; - break; - case 'h': - case '?': - usage(argv[0]); - break; - default: - fprintf(stderr,"Unknown option -%c\n",argv[optind][1]); - usage(argv[0]); - } - optind++; - } - - genTag = !tagName.isEmpty(); - genIndex = !indexName.isEmpty(); - - if (!genTag && !genIndex) - { - fprintf(stderr,"Nothing to do !\n\n"); - usage(argv[0]); - } - - int i; - if (optind>=argc) - { - parseFileOrDir("."); - } - else - { - for (i=optind;i<argc;i++) - { - parseFileOrDir(argv[i]); - } - } - if (genIndex) - { - fprintf(stderr,"Error: doxytag cannot be used to generate a search index anymore.\n" - "This functionality has been integrated into doxygen.\n"); -// printf("Writing search index\n"); -// if (!searchIndex.saveIndex(indexName)) -// { -// fprintf(stderr,"Error: Could not write search index\n"); -// } -// QFileInfo fi(indexName); -// if (fi.exists()) -// { -// QCString dir=convertToQCString(fi.dir().absPath()); -// fi.setFile(dir+"/search.png"); -// if (!fi.exists()) writeSearchButton(dir); -// fi.setFile(dir+"/doxygen.png"); -// if (!fi.exists()) writeLogo(dir); -// fi.setFile(dir+"/search.cgi"); -// if (!fi.exists()) -// { -// QFile f; -// f.setName(dir+"/search.cgi"); -// if (f.open(IO_WriteOnly)) -// { -// QTextStream t(&f); -// t << "#!/bin/sh" << endl -// << "DOXYSEARCH=" << endl -// << "DOXYPATH=" << endl -// << "if [ -f $DOXYSEARCH ]" << endl -// << "then" << endl -// << " $DOXYSEARCH $DOXYPATH" << endl -// << "else" << endl -// << " echo \"Content-Type: text/html\"" << endl -// << " echo \"\"" << endl -// << " echo \"<H1>Error: $DOXYSEARCH not found. Check cgi script!\"" << endl -// << "fi" << endl; -// f.close(); -// } -// else -// { -// fprintf(stderr,"Error: could not open file %s for writing\n",(dir+"/search.cgi").data()); -// } -// } -// } - } - if (genTag) - { - QFile f; - f.setName(tagName); - if (f.open(IO_WriteOnly)) - { - QTextStream t(&f); - t << "<tagfile>" << endl; - ClassDef *cd=classList.first(); - while (cd) - { - t << " <compound kind=\""; - if (cd->isFile) t << "file"; else t << "class"; - t << "\">" << endl; - t << " <name>" << convertToXML(cd->name) << "</name>" << endl; - char *base=cd->bases.first(); - while (base) - { - t << " <base>" << convertToXML(base) << "</base>" << endl; - base=cd->bases.next(); - } - t << " <filename>" << convertToXML(cd->fileName) << "</filename>" << endl; - MemberDef *md=cd->memberList.first(); - while (md) - { - if (md->anchor.right(5)=="-enum") - { - t << " <member kind=\"enum\">" << endl; - } - else - { - t << " <member kind=\"function\">" << endl; - } - t << " <name>" << convertToXML(md->name) << "</name>" << endl; - t << " <anchor>" << convertToXML(md->anchor) << "</anchor>" << endl; - t << " <arglist>" << convertToXML(md->args) << "</arglist>" << endl; - t << " </member>" << endl; - md=cd->memberList.next(); - } - t << " </compound>" << endl; - cd=classList.next(); - } - t << "</tagfile>" << endl; - } - else - { - fprintf(stderr,"Error: Could not write tag file %s\n",tagName.data()); - } - } - return 0; -} - -extern "C" { -int tagYYwrap() { return 1 ; } -}; diff --git a/src/doxytag.pro.in b/src/doxytag.pro.in deleted file mode 100644 index d448f97..0000000 --- a/src/doxytag.pro.in +++ /dev/null @@ -1,31 +0,0 @@ -# -# -# -# Copyright (C) 1997-2011 by Dimitri van Heesch. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation under the terms of the GNU General Public License is hereby -# granted. No representations are made about the suitability of this software -# for any purpose. It is provided "as is" without express or implied warranty. -# See the GNU General Public License for more details. -# -# Documents produced by Doxygen are derivative works derived from the -# input used in their production; they are not affected by this license. -# -# TMake project file for doxytag - -TEMPLATE = doxytag.t -CONFIG = console warn_on $extraopts -HEADERS = logos.h version.h -SOURCES = doxytag.cpp logos.cpp version.cpp -unix:LIBS += -L../lib -lqtools -win32:INCLUDEPATH += . -win32-mingw:LIBS += -L../lib -lqtools -win32-msvc:LIBS += qtools.lib shell32.lib -win32-msvc:TMAKE_LFLAGS += /LIBPATH:..\lib -win32-borland:LIBS += qtools.lib shell32.lib -win32-borland:TMAKE_LFLAGS += -L..\lib -L$(BCB)\lib\psdk -win32:TMAKE_CXXFLAGS += -DQT_NODLL -INCLUDEPATH += ../qtools -OBJECTS_DIR = ../objects -TARGET = ../bin/doxytag diff --git a/src/doxytag.t b/src/doxytag.t deleted file mode 100644 index c74c7ef..0000000 --- a/src/doxytag.t +++ /dev/null @@ -1,50 +0,0 @@ -# -# -# -# Copyright (C) 1997-2011 by Dimitri van Heesch. -# -# Permission to use, copy, modify, and distribute this software and its -# documentation under the terms of the GNU General Public License is hereby -# granted. No representations are made about the suitability of this software -# for any purpose. It is provided "as is" without express or implied warranty. -# See the GNU General Public License for more details. -# -# Documents produced by Doxygen are derivative works derived from the -# input used in their production; they are not affected by this license. -# -#! -#! doxytag.t: This is a custom template for building Doxytag -#! -#$ IncludeTemplate("app.t"); - -LEX = flex - -#${ -sub GenerateDep { - my($obj,$src,$dep) = @_; - my(@objv,$srcv,$i,$s,$o,$d,$c); - @objv = split(/\s+/,$obj); - @srcv = split(/\s+/,$src); - for $i ( 0..$#objv ) { - $s = $srcv[$i]; - $o = $objv[$i]; - next if $s eq ""; - $text .= $o . ": " . $s; - $text .= " ${linebreak}\n\t\t" . $dep if $dep ne ""; - if ( $moc_output{$s} ne "" ) { - $text .= " ${linebreak}\n\t\t" . $moc_output{$s}; - } - $d = &make_depend($s); - $text .= " ${linebreak}\n\t\t" . $d if $d ne ""; - $text .= "\n"; - } - chop $text; -} -#$} - -##################### - -#$ GenerateDep("doxytag.cpp","doxytag.l"); - $(LEX) -PtagYY -t doxytag.l >doxytag.cpp - - diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 7dd03c4..5d1061c 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -687,7 +687,6 @@ void FTVHelp::generateJSLink(FTextStream &t,FTVNode *n) } else // link into other page { - // TODO: external links with installdox // TODO: use m_topLevelIndex t << "\"" << convertToJSString(n->name) << "\", \""; t << externalRef("",n->ref,TRUE); diff --git a/src/growbuf.h b/src/growbuf.h new file mode 100644 index 0000000..6798692 --- /dev/null +++ b/src/growbuf.h @@ -0,0 +1,38 @@ +#ifndef GROWBUF_H +#define GROWBUF_H + +#include <stdlib.h> +#include <string.h> + +class GrowBuf +{ + public: + GrowBuf() : str(0), pos(0), len(0) {} + ~GrowBuf() { free(str); str=0; pos=0; len=0; } + void clear() { pos=0; } + void addChar(char c) { if (pos>=len) { len+=1024; str = (char*)realloc(str,len); } + str[pos++]=c; + } + void addStr(const char *s) { + int l=strlen(s); + if (pos+l>=len) { len+=l+1024; str = (char*)realloc(str,len); } + strcpy(&str[pos],s); + pos+=l; + } + void addStr(const char *s,int n) { + int l=strlen(s); + if (n<l) l=n; + if (pos+l>=len) { len+=l+1024; str = (char*)realloc(str,len); } + strncpy(&str[pos],s,n); + pos+=l; + } + const char *get() { return str; } + int getPos() const { return pos; } + char at(int i) const { return str[i]; } + private: + char *str; + int pos; + int len; +}; + +#endif diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 16c5b46..5ecb124 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -94,6 +94,8 @@ static bool mustBeOutsideParagraph(DocNode *n) * preserve formatting. */ case DocNode::Kind_Copy: + /* <blockquote> */ + case DocNode::Kind_HtmlBlockQuote: return TRUE; case DocNode::Kind_StyleChange: return ((DocStyleChange*)n)->style()==DocStyleChange::Preformatted || @@ -211,11 +213,37 @@ void HtmlDocVisitor::visit(DocSymbol *s) void HtmlDocVisitor::visit(DocURL *u) { if (m_hide) return; - m_t << "<a href=\""; - if (u->isEmail()) m_t << "mailto:"; - m_t << u->url() << "\">"; - filter(u->url()); - m_t << "</a>"; + if (u->isEmail()) // mail address + { + // do obfuscation via javascript + m_t << "<a href=\"#\" onclick=\"location.href='mai'+'lto:'"; + QCString url = u->url(); + uint i; + int size=3; + for (i=0;i<url.length();) + { + m_t << "+'" << url.mid(i,size) << "'"; + i+=size; + if (size==3) size=2; else size=3; + } + m_t << "; return false;\">"; + size=5; + for (i=0;i<url.length();) + { + filter(url.mid(i,size)); + if (i<url.length()-size) m_t << "<span style=\"display: none;\">.nosp@m.</span>"; + i+=size; + if (size==5) size=4; else size=5; + } + m_t << "</a>"; + } + else // web address + { + m_t << "<a href=\""; + m_t << u->url() << "\">"; + filter(u->url()); + m_t << "</a>"; + } } void HtmlDocVisitor::visit(DocLineBreak *) @@ -702,8 +730,10 @@ static int getParagraphContext(DocPara *p,bool &isFirst,bool &isLast) switch (p->parent()->kind()) { case DocNode::Kind_AutoListItem: - isFirst=TRUE; - isLast =TRUE; + //isFirst=TRUE; + //isLast =TRUE; + isFirst=isFirstChildNode((DocAutoListItem*)p->parent(),p); + isLast =isLastChildNode ((DocAutoListItem*)p->parent(),p); t=1; // not used break; case DocNode::Kind_SimpleListItem: @@ -790,6 +820,7 @@ void HtmlDocVisitor::visitPre(DocPara *p) case DocNode::Kind_SimpleSect: case DocNode::Kind_XRefItem: case DocNode::Kind_Copy: + case DocNode::Kind_HtmlBlockQuote: needsTag = TRUE; break; case DocNode::Kind_Root: @@ -862,6 +893,7 @@ void HtmlDocVisitor::visitPost(DocPara *p) case DocNode::Kind_SimpleSect: case DocNode::Kind_XRefItem: case DocNode::Kind_Copy: + case DocNode::Kind_HtmlBlockQuote: needsTag = TRUE; break; case DocNode::Kind_Root: @@ -1581,6 +1613,29 @@ void HtmlDocVisitor::visitPost(DocText *) { } +void HtmlDocVisitor::visitPre(DocHtmlBlockQuote *b) +{ + if (m_hide) return; + forceEndParagraph(b); + + QString attrs = htmlAttribsToString(b->attribs()); + if (attrs.isEmpty()) + { + m_t << "<blockquote class=\"doxtable\">\n"; + } + else + { + m_t << "<blockquote " << htmlAttribsToString(b->attribs()) << ">\n"; + } +} + +void HtmlDocVisitor::visitPost(DocHtmlBlockQuote *b) +{ + if (m_hide) return; + m_t << "</blockquote>" << endl; + forceStartParagraph(b); +} + void HtmlDocVisitor::filter(const char *str) { if (str==0) return; diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index b4a50ae..cf71e22 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -126,6 +126,8 @@ class HtmlDocVisitor : public DocVisitor void visitPost(DocCopy *); void visitPre(DocText *); void visitPost(DocText *); + void visitPre(DocHtmlBlockQuote *); + void visitPost(DocHtmlBlockQuote *); private: diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 4a203b1..c3921af 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -1401,17 +1401,10 @@ void HtmlGenerator::writeStyleInfo(int part) } void HtmlGenerator::startDoxyAnchor(const char *,const char *, - const char *anchor, const char *name, - const char *args) + const char *anchor, const char *, + const char *) { t << "<a class=\"anchor\" id=\"" << anchor << "\"></a>"; - t << "<!-- doxytag: member=\""; - docify(name,TRUE); - t << "\" ref=\""; - docify(anchor,TRUE); - t << "\" args=\""; - docify(args,TRUE); - t << "\" -->"; } void HtmlGenerator::endDoxyAnchor(const char *,const char *) diff --git a/src/index.cpp b/src/index.cpp index 7d094d8..09e152c 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -286,7 +286,6 @@ void startFile(OutputList &ol,const char *name,const char *manName, const char *altSidebarName) { static bool disableIndex = Config_getBool("DISABLE_INDEX"); - static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); ol.startFile(name,manName,title); ol.startQuickIndices(); if (!disableIndex) @@ -297,10 +296,8 @@ void startFile(OutputList &ol,const char *name,const char *manName, { ol.endQuickIndices(); } - if (generateTreeView) - { - ol.writeSplitBar(altSidebarName ? altSidebarName : name); - } + ol.writeSplitBar(altSidebarName ? altSidebarName : name); + ol.writeSearchInfo(); } void endFile(OutputList &ol,bool skipNavIndex,bool skipEndContents) @@ -311,7 +308,6 @@ void endFile(OutputList &ol,bool skipNavIndex,bool skipEndContents) if (!skipNavIndex) { if (!skipEndContents) ol.endContents(); - ol.writeSearchInfo(); if (generateTreeView) { ol.writeString("</div>\n"); @@ -1980,7 +1976,6 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h { if (documentedClassMembers[hl]==0) return; - static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); static bool disableIndex = Config_getBool("DISABLE_INDEX"); bool multiPageIndex=FALSE; @@ -2067,11 +2062,8 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h } } ol.endQuickIndices(); - - if (generateTreeView) - { - ol.writeSplitBar(fileName); - } + ol.writeSplitBar(fileName); + ol.writeSearchInfo(); ol.startContents(); @@ -2161,7 +2153,6 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) { if (documentedFileMembers[hl]==0) return; - static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); static bool disableIndex = Config_getBool("DISABLE_INDEX"); bool multiPageIndex=FALSE; @@ -2245,11 +2236,8 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) } } ol.endQuickIndices(); - - if (generateTreeView) - { - ol.writeSplitBar(fileName); - } + ol.writeSplitBar(fileName); + ol.writeSearchInfo(); ol.startContents(); @@ -2337,7 +2325,6 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, { if (documentedNamespaceMembers[hl]==0) return; - static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); static bool disableIndex = Config_getBool("DISABLE_INDEX"); @@ -2423,11 +2410,8 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, } ol.endQuickIndices(); - - if (generateTreeView) - { - ol.writeSplitBar(fileName); - } + ol.writeSplitBar(fileName); + ol.writeSearchInfo(); ol.startContents(); @@ -3456,7 +3440,6 @@ static void writeIndex(OutputList &ol) title = filterTitle(Doxygen::mainPage->title()); } - static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); QCString indexName="index"; ol.startFile(indexName,0,title); @@ -3476,10 +3459,8 @@ static void writeIndex(OutputList &ol) ol.writeQuickLinks(TRUE,HLI_Main,0); } ol.endQuickIndices(); - if (generateTreeView) - { - ol.writeSplitBar(indexName); - } + ol.writeSplitBar(indexName); + ol.writeSearchInfo(); bool headerWritten=FALSE; if (Doxygen::mainPage && !Doxygen::mainPage->title().isEmpty()) { diff --git a/src/instdox.cpp b/src/instdox.cpp deleted file mode 100644 index 56a3630..0000000 --- a/src/instdox.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2011 by Dimitri van Heesch. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#include <sys/types.h> -#include <sys/stat.h> - -#include "qtbc.h" -#include <qfile.h> -#include <qfileinfo.h> - -#include "instdox.h" -#include "doxygen.h" -#include "config.h" -#include "message.h" - -void writeInstallScript() -{ - QCString fileName=Config_getString("HTML_OUTPUT")+"/installdox"; - QFile f(fileName); - if (f.open(IO_WriteOnly)) - { - FTextStream t(&f); - t << "#!" << Config_getString("PERL_PATH") << endl << endl << "%subst = ( "; - - char *s=Config_getList("TAGFILES").first(); - while (s) - { - QCString tagLine=s; - QCString fileName; - int eqPos = tagLine.find('='); - if (eqPos!=-1) // strip destination part - { - fileName = tagLine.left(eqPos).stripWhiteSpace(); - } - else - { - fileName = tagLine; - } - QFileInfo fi(fileName); - t << "\"" << fi.fileName() << "\", \"\""; - s=Config_getList("TAGFILES").next(); - if (s) t << ", "; - } - - t << ");\n"; - t << "$quiet = 0;\n"; - t << "\n"; - t << "while ( @ARGV ) {\n"; - t << " $_ = shift @ARGV;\n"; - t << " if ( s/^-// ) {\n"; - t << " if ( /^l(.*)/ ) {\n"; - t << " $v = ($1 eq \"\") ? shift @ARGV : $1;\n"; - t << " ($v =~ /\\/$/) || ($v .= \"/\");\n"; - t << " $_ = $v;\n"; - t << " if ( /(.+)\\@(.+)/ ) {\n"; - t << " if ( exists $subst{$1} ) {\n"; - t << " $subst{$1} = $2;\n"; - t << " } else {\n"; - t << " print STDERR \"Unknown tag file $1 given with option -l\\n\";\n"; - t << " &usage();\n"; - t << " }\n"; - t << " } else {\n"; - t << " print STDERR \"Argument $_ is invalid for option -l\\n\";\n"; - t << " &usage();\n"; - t << " }\n"; - t << " }\n"; - t << " elsif ( /^q/ ) {\n"; - t << " $quiet = 1;\n"; - t << " }\n"; - t << " elsif ( /^\\?|^h/ ) {\n"; - t << " &usage();\n"; - t << " }\n"; - t << " else {\n"; - t << " print STDERR \"Illegal option -$_\\n\";\n"; - t << " &usage();\n"; - t << " }\n"; - t << " }\n"; - t << " else {\n"; - t << " push (@files, $_ );\n"; - t << " }\n"; - t << "}\n"; - t << "\n"; - t << "foreach $sub (keys %subst)\n"; - t << "{\n"; - t << " if ( $subst{$sub} eq \"\" ) \n"; - t << " {\n"; - t << " print STDERR \"No substitute given for tag file `$sub'\\n\";\n"; - t << " &usage();\n"; - t << " }\n"; - t << " elsif ( ! $quiet && $sub ne \"_doc\" && $sub ne \"_cgi\" )\n"; - t << " {\n"; - t << " print \"Substituting $subst{$sub} for each occurrence of tag file $sub\\n\"; \n"; - t << " }\n"; - t << "}\n"; - t << "\n"; - t << "if ( ! @files ) {\n"; - t << " if (opendir(D,\".\")) {\n"; - t << " foreach $file ( readdir(D) ) {\n"; - t << " $match = \"" << Config_getString("HTML_FILE_EXTENSION") << "\";\n"; - t << " next if ( $file =~ /^\\.\\.?$/ );\n"; - t << " ($file =~ /$match/) && (push @files, $file);\n"; - t << " ($file =~ /\\.svg/) && (push @files, $file);\n"; - t << " ($file =~ \"navtree.js\") && (push @files, $file);\n"; - t << " }\n"; - t << " closedir(D);\n"; - t << " }\n"; - t << "}\n"; - t << "\n"; - t << "if ( ! @files ) {\n"; - t << " print STDERR \"Warning: No input files given and none found!\\n\";\n"; - t << "}\n"; - t << "\n"; - t << "foreach $f (@files)\n"; - t << "{\n"; - t << " if ( ! $quiet ) {\n"; - t << " print \"Editing: $f...\\n\";\n"; - t << " }\n"; - t << " $oldf = $f;\n"; - t << " $f .= \".bak\";\n"; - t << " unless (rename $oldf,$f) {\n"; - t << " print STDERR \"Error: cannot rename file $oldf\\n\";\n"; - t << " exit 1;\n"; - t << " }\n"; - t << " if (open(F,\"<$f\")) {\n"; - t << " unless (open(G,\">$oldf\")) {\n"; - t << " print STDERR \"Error: opening file $oldf for writing\\n\";\n"; - t << " exit 1;\n"; - t << " }\n"; - t << " if ($oldf ne \"tree.js\") {\n"; - t << " while (<F>) {\n"; - t << " s/doxygen\\=\\\"([^ \\\"\\:\\t\\>\\<]*)\\:([^ \\\"\\t\\>\\<]*)\\\" (xlink:href|href|src)=\\\"\\2/doxygen\\=\\\"$1:$subst{$1}\\\" \\3=\\\"$subst{$1}/g;\n"; - t << " print G \"$_\";\n"; - t << " }\n"; - t << " }\n"; - t << " else {\n"; - t << " while (<F>) {\n"; - t << " s/\\\"([^ \\\"\\:\\t\\>\\<]*)\\:([^ \\\"\\t\\>\\<]*)\\\", \\\"\\2/\\\"$1:$subst{$1}\\\" ,\\\"$subst{$1}/g;\n"; - t << " print G \"$_\";\n"; - t << " }\n"; - t << " }\n"; - t << " } \n"; - t << " else {\n"; - t << " print STDERR \"Warning file $f does not exist\\n\";\n"; - t << " }\n"; - t << " unlink $f;\n"; - t << "}\n"; - t << "\n"; - t << "sub usage {\n"; - t << " print STDERR \"Usage: installdox [options] [html-file [html-file ...]]\\n\";\n"; - t << " print STDERR \"Options:\\n\";\n"; - t << " print STDERR \" -l tagfile\\@linkName tag file + URL or directory \\n\";\n"; - t << " print STDERR \" -q Quiet mode\\n\\n\";\n"; - t << " exit 1;\n"; - t << "}\n"; - } - else - { - err("Error: Cannot open file %s for writing\n",fileName.data()); - } - f.close(); - struct stat stat_struct; - stat(fileName,&stat_struct); -#if !defined(_WIN32) - chmod(fileName,stat_struct.st_mode|S_IXUSR|S_IXGRP|S_IXOTH); -#endif -} diff --git a/src/instdox.h b/src/instdox.h deleted file mode 100644 index 55c1864..0000000 --- a/src/instdox.h +++ /dev/null @@ -1,23 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2011 by Dimitri van Heesch. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#ifndef INSTDOX_H -#define INSTDOX_H - -extern void writeInstallScript(); - -#endif diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 8d84c4d..dc3b4e7 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -1367,6 +1367,18 @@ void LatexDocVisitor::visitPost(DocText *) { } +void LatexDocVisitor::visitPre(DocHtmlBlockQuote *) +{ + if (m_hide) return; + m_t << "\\begin{quotation}" << endl; +} + +void LatexDocVisitor::visitPost(DocHtmlBlockQuote *) +{ + if (m_hide) return; + m_t << "\\end{quotation}" << endl; +} + void LatexDocVisitor::filter(const char *str) { filterLatexString(m_t,str,m_insideTabbing,m_insidePre,m_insideItem); diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h index 359b9f7..fc0218e 100644 --- a/src/latexdocvisitor.h +++ b/src/latexdocvisitor.h @@ -117,8 +117,6 @@ class LatexDocVisitor : public DocVisitor void visitPost(DocSecRefItem *); void visitPre(DocSecRefList *); void visitPost(DocSecRefList *); - //void visitPre(DocLanguage *); - //void visitPost(DocLanguage *); void visitPre(DocParamSect *); void visitPost(DocParamSect *); void visitPre(DocParamList *); @@ -131,6 +129,8 @@ class LatexDocVisitor : public DocVisitor void visitPost(DocCopy *); void visitPre(DocText *); void visitPost(DocText *); + void visitPre(DocHtmlBlockQuote *); + void visitPost(DocHtmlBlockQuote *); private: diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 66302b3..6f92f79 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -158,7 +158,7 @@ void LatexGenerator::init() << "pdf: refman.pdf" << endl << endl; t << "refman.pdf: clean refman.tex" << endl; t << "\tpdflatex refman" << endl; - t << "\t" << mkidx_command << " refman.tex" << endl; + t << "\t" << mkidx_command << " refman.idx" << endl; if (generateBib) { t << "\tbibtex refman" << endl; diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in index 626b7d9..1446a17 100644 --- a/src/libdoxygen.pro.in +++ b/src/libdoxygen.pro.in @@ -64,7 +64,6 @@ HEADERS = bufstr.h \ image.h \ index.h \ index_xsd.h \ - instdox.h \ jquery_js.h \ jquery_ui_js.h \ sizzle_js.h \ @@ -78,6 +77,7 @@ HEADERS = bufstr.h \ logos.h \ mandocvisitor.h \ mangen.h \ + markdown.h \ marshal.h \ memberdef.h \ membergroup.h \ @@ -208,7 +208,6 @@ SOURCES = ce_lex.cpp \ indexlog.cpp \ image.cpp \ index.cpp \ - instdox.cpp \ language.cpp \ latexdocvisitor.cpp \ latexgen.cpp \ @@ -217,6 +216,7 @@ SOURCES = ce_lex.cpp \ logos.cpp \ mandocvisitor.cpp \ mangen.cpp \ + markdown.cpp \ marshal.cpp \ memberdef.cpp \ membergroup.cpp \ diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index 541a5e1..9a630b7 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -955,6 +955,27 @@ void ManDocVisitor::visitPost(DocText *) { } +void ManDocVisitor::visitPre(DocHtmlBlockQuote *) +{ + if (m_hide) return; + if (!m_firstCol) + { + m_t << endl; + m_t << ".PP" << endl; + } + m_t << ".RS 4" << endl; // TODO: add support for nested block quotes +} + +void ManDocVisitor::visitPost(DocHtmlBlockQuote *) +{ + if (m_hide) return; + if (!m_firstCol) m_t << endl; + m_t << ".RE" << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; +} + + void ManDocVisitor::filter(const char *str) { if (str) diff --git a/src/mandocvisitor.h b/src/mandocvisitor.h index 929780e..14559d5 100644 --- a/src/mandocvisitor.h +++ b/src/mandocvisitor.h @@ -129,6 +129,8 @@ class ManDocVisitor : public DocVisitor void visitPost(DocCopy *); void visitPre(DocText *); void visitPost(DocText *); + void visitPre(DocHtmlBlockQuote *); + void visitPost(DocHtmlBlockQuote *); private: diff --git a/src/markdown.cpp b/src/markdown.cpp new file mode 100644 index 0000000..42b5bee --- /dev/null +++ b/src/markdown.cpp @@ -0,0 +1,1890 @@ +/****************************************************************************** + * + * Copyright (C) 1997-2012 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +/* Note: part of the code below is inspired by libupskirt written by + * Natacha Porté. Original copyright message follows: + * + * Copyright (c) 2008, Natacha Porté + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <stdio.h> +#include <qglobal.h> +#include <qregexp.h> +#include <qfileinfo.h> +#include <qdict.h> + +#include "markdown.h" +#include "growbuf.h" +#include "debug.h" +#include "util.h" +#include "doxygen.h" +#include "commentscan.h" + +//---------- + +struct LinkRef +{ + LinkRef(const QCString &l,const QCString &t) : link(l), title(t) {} + QCString link; + QCString title; +}; + +typedef int (*action_t)(GrowBuf &out,const char *data,int offset,int size); + +enum Alignment { AlignNone, AlignLeft, AlignCenter, AlignRight }; + + +//---------- + +static QDict<LinkRef> g_linkRefs(257); +static action_t g_actions[256]; +//static QDict<void> g_htmlBlockTags(17); + +//---------- + +const int codeBlockIndent = 4; + +static void processInline(GrowBuf &out,const char *data,int size); + +// escape characters that have a special meaning later on. +static QCString escapeSpecialChars(const QCString &s) +{ + if (s.isEmpty()) return ""; + GrowBuf growBuf; + const char *p=s; + char c; + while ((c=*p++)) + { + switch (c) + { + case '<': growBuf.addStr("\\<"); break; + case '>': growBuf.addStr("\\>"); break; + case '\\': growBuf.addStr("\\\\"); break; + case '@': growBuf.addStr("\\@"); break; + default: growBuf.addChar(c); break; + } + } + growBuf.addChar(0); + return growBuf.get(); +} + +static void convertStringFragment(QCString &result,const char *data,int size) +{ + if (size<0) size=0; + result.resize(size+1); + memcpy(result.data(),data,size); + result.at(size)='\0'; +} + +/** helper function to convert presence of left and/or right alignment markers + * to a alignment value + */ +static Alignment markersToAlignment(bool leftMarker,bool rightMarker) +{ + //printf("markerToAlignment(%d,%d)\n",leftMarker,rightMarker); + if (leftMarker && rightMarker) + { + return AlignCenter; + } + else if (leftMarker) + { + return AlignLeft; + } + else if (rightMarker) + { + return AlignRight; + } + else + { + return AlignNone; + } +} + + +// Check if data contains a block command. If so returned the command +// that ends the block. If not an empty string is returned. +// Note When offset>0 character position -1 will be inspected. +// +// Checks for and skip the following block commands: +// {@code .. { .. } .. } +// \dot .. \enddot +// \code .. \endcode +// \msc .. \endmsc +// \f$..\f$ +// \f[..\f] +// \f{..\f} +// \verbatim..\endverbatim +// \latexonly..\endlatexonly +// \htmlonly..\endhtmlonly +// \xmlonly..\endxmlonly +// \rtfonly..\endrtfonly +// \manonly..\endmanonly +static QCString isBlockCommand(const char *data,int offset,int size) +{ + bool openBracket = offset>0 && data[-1]=='{'; + bool isEscaped = offset>0 && (data[-1]=='\\' || data[-1]=='@'); + if (isEscaped) return QCString(); + + int end=1; + while (end<size && (data[end]>='a' && data[end]<='z')) end++; + if (end==1) return QCString(); + QCString blockName; + convertStringFragment(blockName,data+1,end-1); + if (blockName=="code" && openBracket) + { + return "}"; + } + else if (blockName=="dot" || + blockName=="code" || + blockName=="msc" || + blockName=="verbatim" || + blockName=="latexonly" || + blockName=="htmlonly" || + blockName=="xmlonly" || + blockName=="rtfonly" || + blockName=="manonly" + ) + { + return "end"+blockName; + } + else if (blockName=="f" && end<size) + { + if (data[end]=='$') + { + return "f$"; + } + else if (data[end]=='[') + { + return "f]"; + } + else if (data[end]=='}') + { + return "f}"; + } + } + return QCString(); +} + + +/** looks for the next emph char, skipping other constructs, and + * stopping when either it is found, or we are at the end of a paragraph. + */ +static int findEmphasisChar(const char *data, int size, char c) +{ + int i = 1; + + while (i<size) + { + while (i<size && data[i]!=c && data[i]!='`' && + data[i]!='\\' && data[i]!='@' && + data[i]!='\n') i++; + //printf("findEmphasisChar: data=[%s] i=%d c=%c\n",data,i,data[i]); + + if (data[i] == c) + { + if (i<size-1 && ((data[i+1]>='a' && data[i+1]<='z') || + (data[i+1]>='A' && data[i+1]<='Z') || + (data[i+1]>='0' && data[i+1]<='9') + ) + ) // to prevent touching some_underscore_identifier + { + i++; + continue; + } + return i; // found it + } + + // not counting escaped chars + if (i>0 && (data[i-1]=='\\' || data[i-1]=='@')) + { + i++; + continue; + } + + // skipping a code span + if (data[i]=='`') + { + int snb=0; + while (i<size && data[i]=='`') snb++,i++; + + // find same pattern to end the span + int enb=0; + while (i<size && enb<snb) + { + if (data[i]=='`') enb++; + if (snb==1 && data[i]=='\'') break; // ` ended by ' + i++; + } + } + else if (data[i]=='@' || data[i]=='\\') + { // skip over blocks that should not be processed + QCString endBlockName = isBlockCommand(data+i,i,size-i); + if (!endBlockName.isEmpty()) + { + i++; + int l = endBlockName.length(); + while (i<size-l-1) + { + if ((data[i]=='\\' || data[i]=='@') && // command + data[i-1]!='\\' && data[i-1]!='@') // not escaped + { + if (strncmp(&data[i+1],endBlockName,l)==0) + { + break; + } + } + i++; + } + } + else + { + i++; + } + } + else if (data[i]=='\n') // end * or _ at paragraph boundary + { + i++; + while (i<size && data[i]==' ') i++; + if (i>=size || data[i]=='\n') return 0; // empty line -> paragraph + } + else // should not get here! + { + i++; + } + + } + return 0; +} + +/** process single emphasis */ +static int processEmphasis1(GrowBuf &out, const char *data, int size, char c) +{ + int i = 0, len; + + /* skipping one symbol if coming from emph3 */ + if (size>1 && data[0]==c && data[1]==c) { i=1; } + + while (i<size) + { + len = findEmphasisChar(data+i, size-i, c); + if (len==0) return 0; + i+=len; + if (i>=size) return 0; + + if (i+1<size && data[i+1]==c) + { + i++; + continue; + } + if (data[i]==c && data[i-1]!=' ' && data[i-1]!='\n') + { + out.addStr("<em>"); + processInline(out,data,i); + out.addStr("</em>"); + return i+1; + } + } + return 0; +} + +/** process double emphasis */ +static int processEmphasis2(GrowBuf &out, const char *data, int size, char c) +{ + int i = 0, len; + + while (i<size) + { + len = findEmphasisChar(data+i, size-i, c); + if (len==0) + { + return 0; + } + i += len; + if (i+1<size && data[i]==c && data[i+1]==c && i && data[i-1]!=' ' && + data[i-1]!='\n' + ) + { + out.addStr("<strong>"); + processInline(out,data,i); + out.addStr("</strong>"); + return i + 2; + } + i++; + } + return 0; +} + +/** Parsing single emphase. + * Finds the first closing tag, and delegates to the other emph + */ +static int processEmphasis3(GrowBuf &out, const char *data, int size, char c) +{ + int i = 0, len; + + while (i<size) + { + len = findEmphasisChar(data+i, size-i, c); + if (len==0) + { + return 0; + } + i+=len; + + /* skip whitespace preceded symbols */ + if (data[i]!=c || data[i-1]==' ' || data[i-1]=='\n') + { + continue; + } + + if (i+2<size && data[i+1]==c && data[i+2]==c) + { + out.addStr("<em><strong>"); + processInline(out,data,i); + out.addStr("</strong></em>"); + return i+3; + } + else if (i+1<size && data[i+1]==c) + { + // double symbol found, handing over to emph1 + len = processEmphasis1(out, data-2, size+2, c); + if (len==0) + { + return 0; + } + else + { + return len - 2; + } + } + else + { + // single symbol found, handing over to emph2 + len = processEmphasis2(out, data-1, size+1, c); + if (len==0) + { + return 0; + } + else + { + return len - 1; + } + } + } + return 0; +} + +static int processEmphasis(GrowBuf &out,const char *data,int,int size) +{ + char c = data[0]; + size_t ret; + if (size>2 && data[1]!=c) + { + // whitespace cannot follow an opening emphasis + if (data[1]==' ' || data[1]=='\n' || + (ret = processEmphasis1(out, data+1, size-1, c)) == 0) + { + return 0; + } + return ret+1; + } + if (size>3 && data[1]==c && data[2]!=c) + { + if (data[2]==' ' || data[2]=='\n' || + (ret = processEmphasis2(out, data+2, size-2, c)) == 0) + { + return 0; + } + return ret+2; + } + if (size>4 && data[1]==c && data[2]==c && data[3]!=c) + { + if (data[3]==' ' || data[3]=='\n' || + (ret = processEmphasis3(out, data+3, size-3, c)) == 0) + { + return 0; + } + return ret+3; + } + return 0; +} + +static int processLink(GrowBuf &out,const char *data,int,int size) +{ + QCString content; + QCString link; + QCString title; + int contentStart,contentEnd,linkStart,titleStart,titleEnd; + bool isImageLink = FALSE; + int i=1; + if (data[0]=='!') + { + isImageLink = TRUE; + if (size<2 || data[1]!='[') + { + return 0; + } + i++; + } + contentStart=i; + int level=1; + int nl=0; + // find the matching ] + while (i<size) + { + if (data[i-1]=='\\') // skip escaped characters + { + } + else if (data[i]=='[') + { + level++; + } + else if (data[i]==']') + { + level--; + if (level<=0) break; + } + else if (data[i]=='\n') + { + nl++; + if (nl>1) return 0; // only allow one newline in the content + } + i++; + } + if (i>=size) return 0; // premature end of comment -> no link + contentEnd=i; + convertStringFragment(content,data+contentStart,contentEnd-contentStart); + //printf("processLink: content={%s}\n",content.data()); + if (content.isEmpty()) return 0; // no link text + i++; // skip over ] + + // skip whitespace + while (i<size && data[i]==' ') i++; + if (i<size && data[i]=='\n') // one newline allowed here + { + i++; + // skip more whitespace + while (i<size && data[i]==' ') i++; + } + + bool explicitTitle=FALSE; + if (i<size && data[i]=='(') // inline link + { + i++; + while (i<size && data[i]==' ') i++; + if (i<size && data[i]=='<') i++; + linkStart=i; + nl=0; + while (i<size && data[i]!='\'' && data[i]!='"' && data[i]!=')') + { + if (data[i]=='\n') + { + nl++; + if (nl>1) return 0; + } + i++; + } + if (i>=size || data[i]=='\n') return 0; + convertStringFragment(link,data+linkStart,i-linkStart); + link = link.stripWhiteSpace(); + //printf("processLink: link={%s}\n",link.data()); + if (link.isEmpty()) return 0; + if (link.at(link.length()-1)=='>') link=link.left(link.length()-1); + + // optional title + if (data[i]=='\'' || data[i]=='"') + { + char c = data[i]; + i++; + titleStart=i; + nl=0; + while (i<size && data[i]!=')') + { + if (data[i]=='\n') + { + if (nl>1) return 0; + nl++; + } + i++; + } + if (i>=size) + { + return 0; + } + titleEnd = i-1; + // search back for closing marker + while (titleEnd>titleStart && data[titleEnd]==' ') titleEnd--; + if (data[titleEnd]==c) // found it + { + convertStringFragment(title,data+titleStart,titleEnd-titleStart); + //printf("processLink: title={%s}\n",title.data()); + } + else + { + return 0; + } + } + i++; + } + else if (i<size && data[i]=='[') // reference link + { + i++; + linkStart=i; + nl=0; + // find matching ] + while (i<size && data[i]!=']') + { + if (data[i]=='\n') + { + nl++; + if (nl>1) return 0; + } + i++; + } + if (i>=size) return 0; + // extract link + convertStringFragment(link,data+linkStart,i-linkStart); + //printf("processLink: link={%s}\n",link.data()); + link = link.stripWhiteSpace(); + if (link.isEmpty()) // shortcut link + { + link=content; + } + // lookup reference + LinkRef *lr = g_linkRefs.find(link.lower()); + if (lr) // found it + { + link = lr->link; + title = lr->title; + //printf("processLink: ref: link={%s} title={%s}\n",link.data(),title.data()); + } + else // reference not found! + { + //printf("processLink: ref {%s} do not exist\n",link.lower().data()); + return 0; + } + i++; + } + else if (i<size && data[i]!=':') // minimal link ref notation [some id] + { + LinkRef *lr = g_linkRefs.find(content.lower()); + //printf("processLink: minimal link {%s} lr=%p",content.data(),lr); + if (lr) // found it + { + link = lr->link; + title = lr->title; + explicitTitle=TRUE; + i=contentEnd; + } + else + { + return 0; + } + i++; + } + else + { + return 0; + } + if (isImageLink) // TODO: use @image? + { + out.addStr("<img src=\""); + out.addStr(link); + out.addStr("\" alt=\""); + out.addStr(content); + out.addStr("\""); + if (!title.isEmpty()) + { + out.addStr(" title=\""); + out.addStr(substitute(title.simplifyWhiteSpace(),"\"",""")); + out.addStr("\""); + } + out.addStr("/>"); + } + else + { + static QRegExp re("^[@\\]ref "); + if (link.find('/')!=-1) // file/url link + { + out.addStr("<a href=\""); + out.addStr(link); + out.addStr("\""); + if (!title.isEmpty()) + { + out.addStr(" title=\""); + out.addStr(substitute(title.simplifyWhiteSpace(),"\"",""")); + out.addStr("\""); + } + out.addStr(">"); + out.addStr(content.simplifyWhiteSpace()); + out.addStr("</a>"); + } + else if (link.find("@ref ")!=-1 || link.find("\\ref ")!=-1) + // assume doxygen symbol link + { + out.addStr(link); + out.addStr(" \""); + if (explicitTitle && !title.isEmpty()) + { + out.addStr(title); + } + else + { + out.addStr(content); + } + out.addStr("\""); + } + else // avoid link to F[x](y) + { + //printf("no link for '%s'\n",link.data()); + return 0; + } + } + return i; +} + +/** '`' parsing a code span (assuming codespan != 0) */ +static int processCodeSpan(GrowBuf &out, const char *data, int /*offset*/, int size) +{ + int end, nb = 0, i, f_begin, f_end; + + /* counting the number of backticks in the delimiter */ + while (nb<size && data[nb]=='`') + { + nb++; + } + + /* finding the next delimiter */ + i = 0; + int nl=0; + for (end=nb; end<size && i<nb && nl<2; end++) + { + if (data[end]=='`') + { + i++; + } + else if (data[end]=='\n') + { + i=0; + nl++; + } + else + { + i=0; + } + } + if (i < nb && end >= size) + { + return 0; // no matching delimiter + } + if (nl==2) // too many newlines inside the span + { + return 0; + } + + // trimming outside whitespaces + f_begin = nb; + while (f_begin < end && data[f_begin]==' ') + { + f_begin++; + } + f_end = end - nb; + while (f_end > nb && data[f_end-1]==' ') + { + f_end--; + } + + if (nb==1) // check for closing ' followed by space within f_begin..f_end + { + i=f_begin; + while (i<f_end-1) + { + if (data[i]=='\'' && !((data[i+1]>='a' && data[i+1]<='z') || + (data[i+1]>='A' && data[i+1]<='Z') || + (data[i+1]>='0' && data[i+1]<='9') + )) // reject `some word' and not `it's cool` + { + return 0; + } + i++; + } + } + printf("found code span '%s'\n",QCString(data+f_begin).left(f_end-f_begin).data()); + + /* real code span */ + if (f_begin < f_end) + { + QCString codeFragment; + convertStringFragment(codeFragment,data+f_begin,f_end-f_begin); + out.addStr("<code>"); + //out.addStr(convertToHtml(codeFragment,TRUE)); + out.addStr(escapeSpecialChars(codeFragment)); + out.addStr("</code>"); + } + return end; +} + + +static int processSpecialCommand(GrowBuf &out, const char *data, int offset, int size) +{ + int i=1; + QCString endBlockName = isBlockCommand(data,offset,size); + if (!endBlockName.isEmpty()) + { + int l = endBlockName.length(); + while (i<size-l-1) + { + if ((data[i]=='\\' || data[i]=='@') && // command + data[i-1]!='\\' && data[i-1]!='@') // not escaped + { + if (strncmp(&data[i+1],endBlockName,l)==0) + { + //printf("found end at %d\n",i); + out.addStr(data,i+1+l); + return i+1+l; + } + } + i++; + } + } + if (size>1) + { + char c=data[1]; + if (c=='[' || c==']' || c=='*' || c=='_' || c=='+' || c=='-' || + c=='!' || c=='(' || c==')' || c=='.' || c=='`') + { + out.addStr(&data[1],1); + return 2; + } + } + return 0; +} + +#if 0 +static int processHtmlBlock(GrowBuf &out, const char *data, int offset, int size) +{ + if (size<2 || data[0]!='<') return 0; + int i=1; + while (i<size && ((data[i]>='0' && data[i]<='9') || + (data[i]>='A' && data[i]<='Z') || + (data[i]>='a' && data[i]<='z'))) i++; + if (i<=1 || i>=size) return 0; + QCString tagName; + convertStringFragment(tagName,data+1,i-1); + printf("found html tag '%s'\n",tagName.data()); + if (g_htmlBlockTags.find(tagName)!=0) + { + printf("found block tag\n"); + + // search for end of the block... + } + return 0; +} +#endif + +static void processInline(GrowBuf &out,const char *data,int size) +{ + int i=0, end=0; + action_t action; + while (i<size) + { + while (end<size && ((action=g_actions[(uchar)data[end]])==0)) end++; + out.addStr(data+i,end-i); + if (end>=size) break; + i=end; + end = action(out,data+i,i,size-i); + if (!end) + { + end=i+1; + } + else + { + i+=end; + end=i; + } + } +} + +/** returns whether the line is a setext-style hdr underline */ +static int isHeaderline(const char *data, int size) +{ + int i = 0; + while (i<size && data[i]==' ') i++; + + // test of level 1 header + if (data[i]=='=') + { + while (i<size && data[i]=='=') i++; + while (i<size && data[i]==' ') i++; + return (i>=size || data[i]=='\n') ? 1 : 0; + } + // test of level 2 header + if (data[i]=='-') + { + while (i<size && data[i]=='-') i++; + while (i<size && data[i]==' ') i++; + return (i>=size || data[i]=='\n') ? 2 : 0; + } + return 0; +} + +/** returns TRUE if this line starts a block quote */ +static bool isBlockQuote(const char *data,int size,int indent) +{ + int i = 0; + while (i<size && data[i]==' ') i++; + return i<size && data[i]=='>' && i<indent+codeBlockIndent; +} + +/** returns end of the link ref if this is indeed a link reference. */ +static int isLinkRef(const char *data,int size, + QCString &refid,QCString &link,QCString &title) +{ + //printf("isLinkRef data={%s}\n",data); + // format: start with [some text]: + int i = 0; + while (i<size && data[i]==' ') i++; + if (i>=size || data[i]!='[') return 0; + i++; + int refIdStart=i; + while (i<size && data[i]!='\n' && data[i]!=']') i++; + if (i>=size || data[i]!=']') return 0; + convertStringFragment(refid,data+refIdStart,i-refIdStart); + if (refid.isEmpty()) return 0; + //printf(" isLinkRef: found refid='%s'\n",refid.data()); + i++; + if (i>=size || data[i]!=':') return 0; + i++; + + // format: whitespace* \n? whitespace* (<url> | url) + while (i<size && data[i]==' ') i++; + if (i<size && data[i]=='\n') + { + i++; + while (i<size && data[i]==' ') i++; + } + if (i>=size) return 0; + + if (i<size && data[i]=='<') i++; + int linkStart=i; + while (i<size && data[i]!=' ' && data[i]!='\n') i++; + int linkEnd=i; + if (i<size && data[i]=='>') i++; + if (linkStart==linkEnd) return 0; // empty link + convertStringFragment(link,data+linkStart,linkEnd-linkStart); + //printf(" isLinkRef: found link='%s'\n",link.data()); + if (link=="@ref" || link=="\\ref") + { + int argStart=i; + while (i<size && data[i]!='\n' && data[i]!='"') i++; + QCString refArg; + convertStringFragment(refArg,data+argStart,i-argStart); + link+=refArg; + } + + title.resize(0); + + // format: (whitespace* \n? whitespace* ( 'title' | "title" | (title) ))? + int eol=0; + while (i<size && data[i]==' ') i++; + if (i<size && data[i]=='\n') + { + i++; + eol=i; + while (i<size && data[i]==' ') i++; + } + if (i>=size) + { + //printf("end of isLinkRef while looking for title! i=%d\n",i); + return i; // end of buffer while looking for the optional title + } + + char c = data[i]; + if (c=='\'' || c=='"' || c=='(') // optional title present? + { + //printf(" start of title found! char='%c'\n",c); + i++; + if (c=='(') c=')'; // replace c by end character + int titleStart=i; + // search for end of the line + while (i<size && data[i]!='\n') i++; + + // search back to matching character + int end=i-1; + while (end>titleStart && data[end]!=c) end--; + if (end>titleStart) + { + convertStringFragment(title,data+titleStart,end-titleStart); + } + //printf(" title found: '%s'\n",title.data()); + } + while (i<size && data[i]==' ') i++; + //printf("end of isLinkRef: i=%d size=%d data[i]='%c' eol=%d\n", + // i,size,data[i],eol); + if (i>=size) return i; // end of buffer while ref id was found + else if (data[i]=='\n') return i+1; // end of line while ref id was found + else if (eol) return eol; // no optional title found + return 0; // invalid link ref +} + +static int isHRuler(const char *data,int size) +{ + int i=0; + if (size>0 && data[size-1]=='\n') size--; // ignore newline character + while (i<size && data[i]==' ') i++; + if (i>=size) return 0; // empty line + char c=data[i]; + if (c!='*' && c!='-' && c!='_') + { + return 0; // not a hrule character + } + int n=0; + while (i<size) + { + if (data[i]==c) + { + n++; // count rule character + } + else if (data[i]!=' ') + { + return 0; // line contains non hruler characters + } + i++; + } + return n>=3; // at least 3 characters needed for a hruler +} + +static QCString extractTitleId(QCString &title) +{ + static QRegExp r1("^[a-z_A-Z][a-z_A-Z0-9\\-]*:"); + static QRegExp r2("\\{#[a-z_A-Z][a-z_A-Z0-9\\-]*\\}$"); + int l=0; + int i = r2.match(title,0,&l); + if (i!=-1) // found {#id} style id + { + QCString id = title.mid(i+2,l-3); + title = title.left(i)+title.mid(i+l); + //printf("found id='%s' title='%s'\n",id.data(),title.data()); + return id; + } + i = r1.match(title,0,&l); + if (i!=-1) // found id: style id + { + QCString id = title.mid(i,l-1); + title = title.left(i)+title.mid(i+l); + //printf("found id='%s' title='%s'\n",id.data(),title.data()); + return id; + } + //printf("no id found in title '%s'\n",title.data()); + return ""; +} + + +static int isAtxHeader(const char *data,int size,QCString &header) +{ + int i = 0, end; + int level = 0; + + // find start of header text and determine heading level + while (i<size && data[i]==' ') i++; + if (i>=size || data[i]!='#') return 0; + while (i<size && level<6 && data[i]=='#') i++,level++; + while (i<size && data[i]==' ') i++; + + // find end of header text + end=i; + while (end<size && data[end]!='\n') end++; + while (end>i && (data[end-1]=='#' || data[end-1]==' ')) end--; + + // store result + convertStringFragment(header,data+i,end-i); + + return level; +} + +static int isEmptyLine(const char *data,int size) +{ + int i=0; + while (i<size) + { + if (data[i]=='\n') return TRUE; + if (data[i]!=' ') return FALSE; + i++; + } + return TRUE; +} + +// compute the indent from the start of the input, excluding list markers +// such as -, *, +, and 1. +static int computeIndentExcludingListMarkers(const char *data,int size) +{ + int i=0; + int indent=0; + bool isDigit=FALSE; + bool listMarkerSkipped=FALSE; + while (i<size && + (data[i]==' ' || // space + (!listMarkerSkipped && // first list marker + (data[i]=='+' || data[i]=='-' || data[i]=='*' || // unordered list char + (isDigit=(data[i]>='1' && data[i]<='9'))) // ordered list marker? + ) + ) + ) + { + if (isDigit) // skip over ordered list marker '10. ' + { + int j=i+1; + while (j<size && ((data[j]>='0' && data[j]<='9') || data[j]=='.')) + { + if (data[j]=='.') // should be end of the list marker + { + if (j<size-1 && data[j+1]==' ') // valid list marker + { + listMarkerSkipped=TRUE; + indent+=j+1-i; + i=j+1; + break; + } + else // not a list marker + { + break; + } + } + j++; + } + } + else if (data[i]!=' ' && i<size-1 && data[i+1]==' ') + { + listMarkerSkipped=TRUE; // only a single list marker is accepted + } + if (data[i]!=' ' && !listMarkerSkipped) + { + break; + } + indent++,i++; + } + //printf("{%s}->%d\n",QCString(data).left(size).data(),indent); + return indent; +} + +static bool isCodeBlock(const char *data,int offset,int size,int &indent) +{ + //printf("<isCodeBlock(offset=%d,size=%d,indent=%d)\n",offset,size,indent); + // determine the indent of this line + int i=0; + int indent0=0; + while (i<size && data[i]==' ') indent0++,i++; + + if (indent0<codeBlockIndent) + { + //printf(">isCodeBlock: line is not indented enough %d<4\n",indent0); + return FALSE; + } + + i=offset; + int nl=0; + int nl_pos[3]; + // search back 3 lines and remember the start of lines -1 and -2 + while (i>0 && nl<3) + { + if (data[i-offset-1]=='\n') nl_pos[nl++]=i-offset; + i--; + } + + // if there are only 2 preceding lines, then line -2 starts at -offset + if (i==0 && nl==2) nl_pos[nl++]=-offset; + //printf(" nl=%d\n",nl); + + if (nl==3) // we have at least 2 preceding lines + { + //printf(" positions: nl_pos=[%d,%d,%d] line[-2]='%s' line[-1]='%s'\n", + // nl_pos[0],nl_pos[1],nl_pos[2], + // QCString(data+nl_pos[1]).left(nl_pos[0]-nl_pos[1]-1).data(), + // QCString(data+nl_pos[2]).left(nl_pos[1]-nl_pos[2]-1).data()); + + // check that line -1 is empty + if (!isEmptyLine(data+nl_pos[1],nl_pos[0]-nl_pos[1]-1)) + { + return FALSE; + } + + // determine the indent of line -2 + indent=computeIndentExcludingListMarkers(data+nl_pos[2],nl_pos[1]-nl_pos[2]); + + //printf(">isCodeBlock local_indent %d>=%d+4=%d\n", + // indent0,indent2,indent0>=indent2+4); + // if the difference is >4 spaces -> code block + return indent0>=indent+codeBlockIndent; + } + else // not enough lines to determine the relative indent, use global indent + { + // check that line -1 is empty + if (nl==1 && !isEmptyLine(data-offset,offset-1)) + { + return FALSE; + } + //printf(">isCodeBlock global indent %d>=%d+4=%d\n", + // indent0,indent,indent0>=indent+4); + return indent0>=indent+codeBlockIndent; + } +} + +/** Finds the location of the table's contains in the string \a data. + * Only one line will be inspected. + * @param[in] data pointer to the string buffer. + * @param[in] size the size of the buffer. + * @param[out] start offset of the first character of the table content + * @param[out] end offset of the last character of the table content + * @param[out] columns number of table columns found + * @returns The offset until the next line in the buffer. + */ +int findTableColumns(const char *data,int size,int &start,int &end,int &columns) +{ + int i=0; + int eol; + // find start character of the table line + while (i<size && data[i]==' ') i++; + if (i<size && data[i]=='|') i++; // leading | does not count + start = i; + + // find end character of the table line + while (i<size && data[i]!='\n') i++; + eol=i+1; + i--; + while (i>0 && data[i]==' ') i--; + if (i>0 && data[i]=='|') i--; // trailing | does not count + end = i; + + // count columns between start and end + columns=1; + if (end>start) + { + i=start; + while (i<=end) + { + if (data[i]=='|' && (i==0 || data[i-1]!='\\')) columns++; + i++; + } + } + //printf("findTableColumns(start=%d,end=%d,columns=%d) eol=%d\n", + // start,end,columns,eol); + return eol; +} + +/** Returns TRUE iff data points to the start of a table block */ +static bool isTableBlock(const char *data,int size) +{ + int cc0,start,end; + + // the first line should have at least two columns separated by '|' + int i = findTableColumns(data,size,start,end,cc0); + if (i>=size || cc0<2) + { + //printf("isTableBlock: no |'s in the header\n"); + return FALSE; + } + + int cc1; + int ret = findTableColumns(data+i,size-i,start,end,cc1); + int j=i+start; + // separator line should consist of |, - and : and spaces only + while (j<=end+i) + { + if (data[j]!=':' && data[j]!='-' && data[j]!='|' && data[j]!=' ') + { + //printf("isTableBlock: invalid character '%c'\n",data[j]); + return FALSE; // invalid characters in table separator + } + j++; + } + if (cc1!=cc0) // number of columns should be same as previous line + { + return FALSE; + } + + i+=ret; // goto next line + int cc2; + ret = findTableColumns(data+i,size-i,start,end,cc2); + + //printf("isTableBlock: %d\n",cc1==cc2); + return cc1==cc2; +} + +static int writeTableBlock(GrowBuf &out,const char *data,int size) +{ + int i=0,j,k; + int columns,start,end,cc; + + i = findTableColumns(data,size,start,end,columns); + + out.addStr("<table>"); + + // write table header, in range [start..end] + out.addStr("<tr>"); + j=start; + for (k=0;k<columns;k++) + { + out.addStr("<th>"); + while (j<=end && (data[j]!='|' || (j>0 && data[j-1]=='\\'))) + { + out.addChar(data[j++]); + } + j++; + } + + // read cell alignments + int ret = findTableColumns(data+i,size-i,start,end,cc); + k=0; + Alignment *columnAlignment = new Alignment[columns]; + + bool leftMarker=FALSE,rightMarker=FALSE; + bool startFound=FALSE; + j=start+i; + while (j<=end+i) + { + if (!startFound) + { + if (data[j]==':') { leftMarker=TRUE; startFound=TRUE; } + if (data[j]=='-') startFound=TRUE; + //printf(" data[%d]=%c startFound=%d\n",j,data[j],startFound); + } + if (data[j]=='-') rightMarker=FALSE; + else if (data[j]==':') rightMarker=TRUE; + if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) + { + if (k<columns) + { + columnAlignment[k] = markersToAlignment(leftMarker,rightMarker); + //printf("column[%d] alignment=%d\n",k,columnAlignment[k]); + leftMarker=FALSE; + rightMarker=FALSE; + startFound=FALSE; + } + k++; + } + j++; + } + if (k<columns) + { + columnAlignment[k] = markersToAlignment(leftMarker,rightMarker); + //printf("column[%d] alignment=%d\n",k,columnAlignment[k]); + } + // proceed to next line + i+=ret; + + // write table cells + while (i<size) + { + int ret = findTableColumns(data+i,size-i,start,end,cc); + //printf("findTableColumns cc=%d\n",cc); + if (cc!=columns) break; // end of table + + out.addStr("<tr>"); + j=start+i; + int columnStart=j; + k=0; + while (j<=end+i) + { + if (j==columnStart) + { + out.addStr("<td"); + switch (columnAlignment[k]) + { + case AlignLeft: out.addStr(" align=left"); break; + case AlignRight: out.addStr(" align=right"); break; + case AlignCenter: out.addStr(" align=center"); break; + case AlignNone: break; + } + out.addStr(">"); + } + if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) + { + columnStart=j+1; + k++; + } + else + { + out.addChar(data[j]); + } + j++; + } + out.addChar('\n'); + + // proceed to next line + i+=ret; + } + + out.addStr("</table>\n"); + + delete columnAlignment; + return i; +} + + +void writeOneLineHeaderOrRuler(GrowBuf &out,const char *data,int size) +{ + int level; + QCString header; + if (isHRuler(data,size)) + { + out.addStr("<hr>\n"); + } + else if ((level=isAtxHeader(data,size,header))) + { + QCString hTag; + hTag.sprintf("h%d",level); + out.addStr("<"+hTag+">"); + out.addStr(header); + out.addStr("</"+hTag+">\n"); + } + else // nothing interesting -> just output the line + { + out.addStr(data,size); + } +} + +static int writeBlockQuote(GrowBuf &out,const char *data,int size) +{ + int l; + int i=0; + int curLevel=0; + int end=0; + while (i<size) + { + // find end of this line + end=i+1; + while (end<size && data[end-1]!='\n') end++; + int j=i; + int level=0; + int indent=i; + // compute the quoting level + while (j<end && (data[j]==' ' || data[j]=='>')) + { + if (data[j]=='>') { level++; indent=j+1; } + else if (j>0 && data[j-1]=='>') indent=j+1; + j++; + } + if (level>curLevel) // quote level increased => add start markers + { + for (l=curLevel;l<level;l++) + { + out.addStr("<blockquote>\n"); + } + } + else if (level<curLevel) // quote level descreased => add end markers + { + for (l=level;l<curLevel;l++) + { + out.addStr("\n</blockquote>\n"); + } + } + curLevel=level; + if (level==0) break; // end of quote block + // copy line without quotation marks + out.addStr(data+indent,end-indent); + // proceed with next line + i=end; + } + // end of comment within blockquote => add end markers + for (l=0;l<curLevel;l++) + { + out.addStr("\n</blockquote>\n"); + } + return i; +} + +static int writeCodeBlock(GrowBuf &out,const char *data,int size,int refIndent) +{ + int i=0,end; + //printf("writeCodeBlock: data={%s}\n",QCString(data).left(size).data()); + out.addStr("@verbatim\n"); + while (i<size) + { + // find end of this line + end=i+1; + while (end<size && data[end-1]!='\n') end++; + int j=i; + int indent=0; + while (j<end && data[j]==' ') j++,indent++; + //printf("j=%d end=%d indent=%d refIndent=%d data={%s}\n",j,end,indent,refIndent,QCString(data+i).left(end-i-1).data()); + if (j==end-1) // empty line + { + // add empty line + out.addStr("\n"); + i=end; + } + else if (indent>=refIndent+codeBlockIndent) // enough indent to contine the code block + { + // add code line minus the indent + out.addStr(data+i+refIndent+codeBlockIndent,end-i-refIndent-codeBlockIndent); + i=end; + } + else // end of code block + { + break; + } + } + out.addStr("@endverbatim\n"); + //printf("i=%d\n",i); + return i; +} + +// start searching for the end of the line start at offset \a i +// keeping track of possible blocks that need to to skipped. +static void findEndOfLine(GrowBuf &out,const char *data,int size, + int &pi,int&i,int &end) +{ + // find end of the line + for (end=i+1; end<size && data[end-1]!='\n'; end++) + { + // while looking for the end of the line we might encounter a block + // that needs to be passed unprocessed. + if ((data[end-1]=='\\' || data[end-1]=='@') && // command + (end<=1 || (data[end-2]!='\\' && data[end-2]!='@')) // not escaped + ) + { + QCString endBlockName = isBlockCommand(data+end-1,end-1,size-(end-1)); + if (!endBlockName.isEmpty()) + { + if (pi!=-1) // output previous line if available + { + out.addStr(data+pi,i-pi); + } + int l = endBlockName.length(); + for (;end<size-l-1;end++) // search for end of block marker + { + if ((data[end]=='\\' || data[end]=='@') && + data[end-1]!='\\' && data[end-1]!='@' + ) + { + if (strncmp(&data[end+1],endBlockName,l)==0) + { + // found end marker, skip over this block + out.addStr(data+i,end+l+1-i); + pi=-1; + i=end+l+1; // continue after block + end=i+1; + break; + } + } + } + } + } + } +} + +static QCString processQuotations(const QCString &s,int refIndent) +{ + GrowBuf out; + const char *data = s.data(); + int size = s.length(); + int i=0,end=0,pi=-1; + while (i<size) + { + findEndOfLine(out,data,size,pi,i,end); + // line is now found at [i..end) + + if (pi!=-1) + { + if (isBlockQuote(data+pi,i-pi,refIndent)) + { + i = pi+writeBlockQuote(out,data+pi,size-pi); + pi=-1; + end=i+1; + continue; + } + else + { + out.addStr(data+pi,i-pi); + } + } + pi=i; + i=end; + } + if (pi!=-1 && pi<size) // deal with the last line + { + if (isBlockQuote(data+pi,size-pi,refIndent)) + { + writeBlockQuote(out,data+pi,size-pi); + } + else + { + out.addStr(data+pi,size-pi); + } + } + out.addChar(0); + + //printf("Process quotations\n---- input ----\n%s\n---- output ----\n%s\n------------\n", + // s.data(),out.get()); + + return out.get(); +} + +static QCString processBlocks(const QCString &s,int indent) +{ + GrowBuf out; + const char *data = s.data(); + int size = s.length(); + int i=0,end=0,pi=-1,ref,level; + QCString id,link,title; + int blockIndent = indent; + + // get indent for the first line + end = i+1; + int sp=0; + while (end<size && data[end-1]!='\n') + { + if (data[end-1]==' ') sp++; + end++; + } + + // special case when the documentation starts with a code block + // since the first line is skipped when looking for a code block later on. + if (end>codeBlockIndent && isCodeBlock(data,0,end,blockIndent)) + { + i=writeCodeBlock(out,data,size,blockIndent); + end=i+1; + pi=-1; + } + + // process each line + while (i<size) + { + findEndOfLine(out,data,size,pi,i,end); + // line is now found at [i..end) + + if (pi!=-1) + { + blockIndent = indent; + //printf("isHeaderLine(%s)=%d\n",QCString(data+i).left(size-i).data(),level); + if ((level=isHeaderline(data+i,size-i))>0) + { + //printf("Found header at %d-%d\n",i,end); + while (pi<size && data[pi]==' ') pi++; + if (i-pi>1) + { + out.addStr(level==1?"<h1>":"<h2>"); + out.addStr(data+pi,i-pi-1); + out.addStr(level==1?"</h1>\n":"</h2>\n"); + } + else + { + out.addStr("<hr>\n"); + } + pi=-1; + i=end; + end=i+1; + continue; + } + else if ((ref=isLinkRef(data+pi,size-pi,id,link,title))) + { + //printf("found link ref: id='%s' link='%s' title='%s'\n", + // id.data(),link.data(),title.data()); + g_linkRefs.insert(id.lower(),new LinkRef(link,title)); + i=ref+pi; + pi=-1; + end=i+1; + } + else if (isCodeBlock(data+i,i,end-i,blockIndent)) + //if (isCodeBlock(data+pi,pi,end-pi,blockIndent)) + { + // skip previous line (it is empty anyway) + i=pi+writeCodeBlock(out,data+pi,size-pi,blockIndent); + pi=-1; + end=i+1; + continue; + } + else if (isTableBlock(data+pi,size-pi)) + { + i=pi+writeTableBlock(out,data+pi,size-pi); + pi=-1; + end=i+1; + continue; + } + else + { + writeOneLineHeaderOrRuler(out,data+pi,i-pi); + } + } + pi=i; + i=end; + } + //printf("last line %d size=%d\n",i,size); + if (pi!=-1 && pi<size) // deal with the last line + { + if (isLinkRef(data+pi,size-pi,id,link,title)) + { + //printf("found link ref: id='%s' link='%s' title='%s'\n", + // id.data(),link.data(),title.data()); + g_linkRefs.insert(id,new LinkRef(link,title)); + } + else + { + writeOneLineHeaderOrRuler(out,data+pi,size-pi); + } + } + + out.addChar(0); + return out.get(); +} + +static QCString extractPageTitle(QCString &docs) +{ + // first first non-empty line + QCString title; + const char *data = docs.data(); + int i=0; + int size=docs.size(); + while (i<size && (data[i]==' ' || data[i]=='\n')) i++; + if (i>=size) return ""; + int end1=i+1; + while (end1<size && data[end1-1]!='\n') end1++; + //printf("i=%d end1=%d size=%d line='%s'\n",i,end1,size,docs.mid(i,end1-i).data()); + // first line from i..end1 + if (end1<size) + { + // second line form end1..end2 + int end2=end1+1; + while (end2<size && data[end2-1]!='\n') end2++; + if (isHeaderline(data+end1,size-end1)) + { + convertStringFragment(title,data+i,end1-i); + docs=docs.mid(end2); + return title; + } + } + if (i<end1 && isAtxHeader(data+i,end1-i,title)>0) + { + docs=docs.mid(end1); + } + //printf("extractPageTitle(title='%s' docs='%s')\n",title.data(),docs.data()); + return title; +} + +static QCString detab(const QCString &s,int &refIndent) +{ + static int tabSize = Config_getInt("TAB_SIZE"); + GrowBuf out; + int size = s.length(); + const char *data = s.data(); + int i=0; + int col=0; + const int maxIndent=1000000; // value representing infinity + int minIndent=maxIndent; + while (i<size) + { + char c = data[i++]; + switch(c) + { + case '\t': // expand tab + { + int stop = tabSize - (col%tabSize); + col+=stop; + while (stop--) out.addChar(' '); + } + break; + case '\n': // reset colomn counter + out.addChar(c); + col=0; + break; + case ' ': // increment column counter + out.addChar(c); + col++; + break; + default: // non-whitespace => update minIndent + out.addChar(c); + if (col<minIndent) minIndent=col; + col++; + } + } + if (minIndent!=maxIndent) refIndent=minIndent; else refIndent=0; + out.addChar(0); + return out.get(); +} + +//--------------------------------------------------------------------------- + +QCString processMarkdown(const QCString &input) +{ +#if 0 + static bool g_init = FALSE; + if (!g_init) + { + g_htmlBlockTags.insert("p",(void*)0x8); + g_htmlBlockTags.insert("dl",(void*)0x8); + g_htmlBlockTags.insert("h1",(void*)0x8); + g_htmlBlockTags.insert("h2",(void*)0x8); + g_htmlBlockTags.insert("h3",(void*)0x8); + g_htmlBlockTags.insert("h4",(void*)0x8); + g_htmlBlockTags.insert("h5",(void*)0x8); + g_htmlBlockTags.insert("h6",(void*)0x8); + g_htmlBlockTags.insert("ol",(void*)0x8); + g_htmlBlockTags.insert("ul",(void*)0x8); + g_htmlBlockTags.insert("div",(void*)0x8); + g_htmlBlockTags.insert("pre",(void*)0x8); + g_htmlBlockTags.insert("form",(void*)0x8); + g_htmlBlockTags.insert("math",(void*)0x8); + g_htmlBlockTags.insert("table",(void*)0x8); + g_htmlBlockTags.insert("iframe",(void*)0x8); + g_htmlBlockTags.insert("script",(void*)0x8); + g_htmlBlockTags.insert("fieldset",(void*)0x8); + g_htmlBlockTags.insert("noscript",(void*)0x8); + g_init=TRUE; + } +#endif + g_linkRefs.setAutoDelete(TRUE); + g_linkRefs.clear(); + static GrowBuf out; + if (input.isEmpty()) return input; + out.clear(); + int refIndent; + // for replace tabs by spaces + QCString s = detab(input,refIndent); + // then process quotation blocks (as these may contain other blocks) + s = processQuotations(s,refIndent); + //printf("======== Quotations =========\n---- output -----\n%s\n---------\n",s.data()); + // then process block items (headers, rules, and code blocks, references) + s = processBlocks(s,refIndent); + //printf("======== Blocks =========\n---- output -----\n%s\n---------\n",s.data()); + int size=s.length(); + g_actions['_']=processEmphasis; + g_actions['*']=processEmphasis; + g_actions['`']=processCodeSpan; + g_actions['\\']=processSpecialCommand; + g_actions['@']=processSpecialCommand; + g_actions['[']=processLink; + g_actions['!']=processLink; + //g_actions['<']=processHtmlBlock; + // finally process the inline markup (links, emphasis and code spans) + processInline(out,s,size); + out.addChar(0); + Debug::print(Debug::Markdown,0,"======== Markdown =========\n---- input ------- \n%s\n---- output -----\n%s\n---------\n",input.data(),out.get()); + return out.get(); +} + +//--------------------------------------------------------------------------- + +void MarkdownFileParser::parseInput(const char *fileName, + const char *fileBuf, + Entry *root) +{ + Entry *current = new Entry; + current->lang = SrcLangExt_Markdown; + QCString docs = fileBuf; + QCString title=extractPageTitle(docs).stripWhiteSpace(); + QCString id=extractTitleId(title); + QCString baseName = substitute(QFileInfo(fileName).baseName().utf8()," ","_"); + if (id.isEmpty()) id = "md_"+baseName; + if (id=="mainpage" || id=="index") + { + docs.prepend("@mainpage "+title+"\n"); + } + else + { + docs.prepend("@page "+id+" "+title+"\n"); + } + int lineNr=1; + int position=0; + + // even without markdown support enabled, we still + // parse markdown files as such + bool markdownEnabled = Doxygen::markdownSupport; + Doxygen::markdownSupport = TRUE; + + bool needsEntry; + Protection prot; + while (parseCommentBlock( + this, + current, + docs, + fileName, + lineNr, + FALSE, // isBrief + FALSE, // javadoc autobrief + FALSE, // inBodyDocs + prot, // protection + position, + needsEntry)) + { + if (needsEntry) + { + QCString docFile = current->docFile; + root->addSubEntry(current); + current = new Entry; + current->lang = SrcLangExt_Markdown; + current->docFile = docFile; + current->docLine = lineNr; + } + } + if (needsEntry) + { + root->addSubEntry(current); + } + + // restore setting + Doxygen::markdownSupport = markdownEnabled; +} + +void MarkdownFileParser::parseCode(CodeOutputInterface &codeOutIntf, + const char *scopeName, + const QCString &input, + bool isExampleBlock, + const char *exampleName, + FileDef *fileDef, + int startLine, + int endLine, + bool inlineFragment, + MemberDef *memberDef, + bool showLineNumbers + ) +{ + ParserInterface *pIntf = Doxygen::parserManager->getParser("*.cpp"); + if (pIntf!=this) + { + pIntf->parseCode( + codeOutIntf,scopeName,input,isExampleBlock,exampleName, + fileDef,startLine,endLine,inlineFragment,memberDef,showLineNumbers); + } +} + +void MarkdownFileParser::resetCodeParserState() +{ + ParserInterface *pIntf = Doxygen::parserManager->getParser("*.cpp"); + if (pIntf!=this) + { + pIntf->resetCodeParserState(); + } +} + +void MarkdownFileParser::parsePrototype(const char *text) +{ + ParserInterface *pIntf = Doxygen::parserManager->getParser("*.cpp"); + if (pIntf!=this) + { + pIntf->parsePrototype(text); + } +} + diff --git a/src/markdown.h b/src/markdown.h new file mode 100644 index 0000000..616c01e --- /dev/null +++ b/src/markdown.h @@ -0,0 +1,52 @@ +/****************************************************************************** + * + * Copyright (C) 1997-2011 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef MARKDOWN_H +#define MARKDOWN_H + +#include <qcstring.h> +#include "parserintf.h" + +/** processes string \a s and converts markdown into doxygen/html commands. */ +QCString processMarkdown(const QCString &s); + +class MarkdownFileParser : public ParserInterface +{ + public: + virtual ~MarkdownFileParser() {} + void parseInput(const char *fileName, + const char *fileBuf, + Entry *root); + bool needsPreprocessing(const QCString &) { return FALSE; } + void parseCode(CodeOutputInterface &codeOutIntf, + const char *scopeName, + const QCString &input, + bool isExampleBlock, + const char *exampleName=0, + FileDef *fileDef=0, + int startLine=-1, + int endLine=-1, + bool inlineFragment=FALSE, + MemberDef *memberDef=0, + bool showLineNumbers=TRUE + ); + void resetCodeParserState(); + void parsePrototype(const char *text); +}; + + + + +#endif diff --git a/src/memberlist.cpp b/src/memberlist.cpp index f35f5b7..f3cfe54 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -575,7 +575,7 @@ void MemberList::writeDocumentationPage(OutputList &ol, container->getOutputFileBase()); if (!generateTreeView) { - container->writeNavigationPath(ol,FALSE); + container->writeNavigationPath(ol); ol.endQuickIndices(); } ol.startContents(); diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 4bf42cb..63b24d8 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -98,7 +98,7 @@ void PageDef::writeDocumentation(OutputList &ol) { if (getOuterScope()!=Doxygen::globalScope && !Config_getBool("DISABLE_INDEX")) { - getOuterScope()->writeNavigationPath(ol,FALSE); + getOuterScope()->writeNavigationPath(ol); } ol.endQuickIndices(); } @@ -183,6 +183,13 @@ void PageDef::writeDocumentation(OutputList &ol) void PageDef::writePageDocumentation(OutputList &ol) { + + bool markdownEnabled = Doxygen::markdownSupport; + if (getLanguage()==SrcLangExt_Markdown) + { + Doxygen::markdownSupport = TRUE; + } + ol.startTextBlock(); ol.parseDoc( docFile(), // fileName @@ -195,6 +202,8 @@ void PageDef::writePageDocumentation(OutputList &ol) ); ol.endTextBlock(); + Doxygen::markdownSupport = markdownEnabled; + if (hasSubPages()) { // for printed documentation we write subpages as section's of the diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index ebe09e8..30e4788 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -375,6 +375,8 @@ public: void visitPost(DocCopy *); void visitPre(DocText *); void visitPost(DocText *); + void visitPre(DocHtmlBlockQuote *); + void visitPost(DocHtmlBlockQuote *); private: @@ -1300,6 +1302,18 @@ void PerlModDocVisitor::visitPost(DocText *) { } +void PerlModDocVisitor::visitPre(DocHtmlBlockQuote *) +{ + openItem("blockquote"); + openSubBlock("content"); +} + +void PerlModDocVisitor::visitPost(DocHtmlBlockQuote *) +{ + closeSubBlock(); + closeItem(); +} + static void addTemplateArgumentList(ArgumentList *al,PerlModOutput &output,const char *) { QCString indentStr; diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index 4cfc06a..4a41647 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -668,6 +668,16 @@ class PrintDocVisitor : public DocVisitor indent_post(); printf("</text>\n"); } + void visitPre(DocHtmlBlockQuote *) + { + indent_pre(); + printf("<blockquote>\n"); + } + void visitPost(DocHtmlBlockQuote *) + { + indent_post(); + printf("</blockquote>\n"); + } private: // helper functions diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index b66a9a8..4923bb1 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -1519,24 +1519,49 @@ void RTFDocVisitor::visitPost(DocInternalRef *) void RTFDocVisitor::visitPre(DocCopy *) { + if (m_hide) return; DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocCopy)}\n"); } void RTFDocVisitor::visitPost(DocCopy *) { + if (m_hide) return; DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocCopy)}\n"); } void RTFDocVisitor::visitPre(DocText *) { + if (m_hide) return; DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocText)}\n"); } void RTFDocVisitor::visitPost(DocText *) { + if (m_hide) return; DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocText)}\n"); } +void RTFDocVisitor::visitPre(DocHtmlBlockQuote *) +{ + if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHtmlBlockQuote)}\n"); + if (!m_lastIsPara) m_t << "\\par" << endl; + m_t << "{"; // start desc + incIndentLevel(); + m_t << rtf_Style_Reset << getStyle("DescContinue"); +} + +void RTFDocVisitor::visitPost(DocHtmlBlockQuote *) +{ + if (m_hide) return; + DBG_RTF("{\\comment RTFDocVisitor::visitPost(DocHtmlBlockQuote)}\n"); + if (!m_lastIsPara) m_t << "\\par" << endl; + decIndentLevel(); + m_t << "}"; // end desc + m_lastIsPara=TRUE; +} + + //static char* getMultiByte(int c) //{ // static char s[10]; diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h index fd76af2..db70b00 100644 --- a/src/rtfdocvisitor.h +++ b/src/rtfdocvisitor.h @@ -115,8 +115,6 @@ class RTFDocVisitor : public DocVisitor void visitPost(DocSecRefItem *); void visitPre(DocSecRefList *); void visitPost(DocSecRefList *); - //void visitPre(DocLanguage *); - //void visitPost(DocLanguage *); void visitPre(DocParamSect *); void visitPost(DocParamSect *); void visitPre(DocParamList *); @@ -129,6 +127,8 @@ class RTFDocVisitor : public DocVisitor void visitPost(DocCopy *); void visitPre(DocText *); void visitPost(DocText *); + void visitPre(DocHtmlBlockQuote *); + void visitPost(DocHtmlBlockQuote *); private: diff --git a/src/scanner.l b/src/scanner.l index 49495f3..d211301 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -5401,7 +5401,7 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) handleCommentBlock(docBlock.data(),FALSE); BEGIN(docBlockContext); } -<DocBlock>^{B}*("//")?{B}*"*"+/[^//] { // start of a comment line +<DocBlock>^{B}*("//")?{B}*"*"+/[^//a-z_A-Z0-9*] { // start of a comment line } <DocBlock>^{B}*("//"){B}* { // strip embedded C++ comments if at the start of a line } diff --git a/src/tclscanner.l b/src/tclscanner.l index 08b330e..fec5dc7 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -392,16 +392,16 @@ void tcl_split_list(QString &str, QStringList &list) //! Structure containing information about current scan context. typedef struct { - int type; - QCString string_after; + char type[2]; // type of scan context: "\"" "{" "[" "?" " " int line0; // start line of scan context int line1; // end line of scan context YY_BUFFER_STATE buffer_state; // value of scan context - QString ns; // current namespace + QCString ns; // current namespace Entry *entry_fn; // if set contains the current proc/method/constructor/destructor Entry *entry_cl; // if set contain the current class Entry *entry_scan; // current scan entry Protection protection; // current protections state + QStringList after; // option/value list (options: NULL comment keyword script) } tcl_scan; //* Structure containing all internal global variables. @@ -422,27 +422,27 @@ static struct int brace_level; // bookkeeping of braces int bracket_level; // bookkeeping of brackets int bracket_quote; // bookkeeping of quotes (toggles) - int word_is; // type of current word + char word_is; // type of current word: "\"" "{" "[" "?" " " int line_comment; // line number of comment int line_commentline; // line number of comment after command int line_command; // line number of command int line_body0; // start line of body int line_body1; // end line of body - QString string_command; // contain current command - QString string_commentline; // contain current comment after command - QString string_commentcodify; // current comment string used in codifying - QString string_comment; // contain current comment - QString string_last; // contain last read word or part of word - QString string; // temporary string value + QCString string_command; // contain current command + QCString string_commentline; // contain current comment after command + QCString string_commentcodify; // current comment string used in codifying + QCString string_comment; // contain current comment + QCString string_last; // contain last read word or part of word + QCString string; // temporary string value Entry* entry_main; // top level entry Entry* entry_file; // entry of current file Entry* entry_current; // currently used entry Entry* entry_inside; // contain entry of current scan context QStringList list_commandwords; // list of command words QList<tcl_scan> scan; // stack of scan contexts - QDict<Entry> ns; // all read namespace entries - QDict<Entry> cl; // all read class entries - QDict<Entry> fn; // all read function entries + QAsciiDict<Entry> ns; // all read namespace entries + QAsciiDict<Entry> cl; // all read class entries + QAsciiDict<Entry> fn; // all read function entries QList<Entry> entry; // list of all created entries, will be deleted after codifying Protection protection; // current protections state MemberDef *memberdef; // contain current MemberDef when codifying @@ -450,7 +450,7 @@ static struct // scanner functions static int yyread(char *buf,int max_size); -static void tcl_scan_start(int type, QString content, const char *after, QString ns, Entry *entry_cls, Entry *entry_fn); +static tcl_scan *tcl_scan_start(char type, QString content, QCString ns, Entry *entry_cls, Entry *entry_fn); static void tcl_scan_end(); static void tcl_comment(int what,const char *text); static void tcl_word(int what,const char *text); @@ -498,18 +498,18 @@ void tcl_protection(Entry *entry) //! Check name. // @return 'ns' and 'name' of given current 'ns0' and 'name0' -static void tcl_name(const QString ns0, const QString name0, QString &ns, QString &name) +static void tcl_name(const QCString ns0, const QString name0, QCString &ns, QCString &name) { - QString myNm; + QCString myNm; int myStart; - if (strncmp(name0.ascii(),"::",2)==0) + if (strncmp(name0.data(),"::",2)==0) { myNm = name0.mid(2); } - else if (ns0.length()) + else if (ns0.length() && ns0 != " ") { - myNm = ns0 + "::" + name0; + myNm = ns0 + "::" + name0.data(); } else { @@ -530,18 +530,22 @@ static void tcl_name(const QString ns0, const QString name0, QString &ns, QStrin // Check and return namespace entry. // @return namespace entry -Entry* tcl_entry_namespace(const QString ns) +Entry* tcl_entry_namespace(const QCString ns) { Entry *myEntry; - QString myNs = " "; - if (strlen(ns.ascii())) {myNs = ns;} - - myEntry = tcl.ns.find(myNs); + if (ns.length()) + { + myEntry = tcl.ns.find(ns); + } + else + { + myEntry = tcl.ns.find("::"); + } if (myEntry == NULL) { myEntry = tcl_entry_new(); myEntry->section = Entry::NAMESPACE_SEC; - myEntry->name = ns.ascii(); + myEntry->name = ns; tcl.entry_main->addSubEntry(myEntry); tcl.ns.insert(ns,myEntry); } @@ -550,18 +554,17 @@ Entry* tcl_entry_namespace(const QString ns) // Check and return class entry. // @return class entry -Entry* tcl_entry_class(const QString cl) +Entry* tcl_entry_class(const QCString cl) { Entry *myEntry; - QString myCl = " "; - if (strlen(cl.ascii())) {myCl = cl;} + if (!cl.length()) return(NULL); - myEntry = tcl.cl.find(myCl); + myEntry = tcl.cl.find(cl); if (myEntry == NULL) { myEntry = tcl_entry_new(); myEntry->section = Entry::CLASS_SEC; - myEntry->name = cl.ascii(); + myEntry->name = cl; tcl.entry_main->addSubEntry(myEntry); tcl.cl.insert(cl,myEntry); } @@ -570,13 +573,13 @@ Entry* tcl_entry_class(const QString cl) //! Check for keywords. // @return 1 if keyword and 0 otherwise -static int tcl_keyword(QString str) +static int tcl_keyword(QCString str) { static QStringList myList; static int myInit=1; if (myInit) { - // tcl keywords TODO default, else, provide, require + // tcl keywords myList <<"append"<<"apply"<<"array"<<"auto_execok"<<"auto_import"<<"auto_load"<<"auto_mkindex"<<"auto_qualify"<<"auto_reset"; myList <<"binary"; myList <<"catch"<<"cd"<<"close"<<"clock"<<"concat"; @@ -633,7 +636,7 @@ static void tcl_font_end() static void tcl_codify(const char *s,char *str) { if (tcl.code==NULL||str==NULL) return; - if (s) + if (s && strcmp(s,"NULL")!=0) { tcl_font_end(); tcl.code->startFontClass(s); @@ -676,6 +679,7 @@ static void tcl_codify(const char *s,char *str) tcl_font_end(); } +#if 0 //! Codify 'str' with special font class 's'. static void tcl_codify(const char *s,const char *str) { @@ -685,6 +689,7 @@ static void tcl_codify(const char *s,const char *str) tcl_codify(s,tmp); free(tmp); } +#endif //! Codify 'str' with special font class 's'. static void tcl_codify(const char *s,QString str) @@ -727,10 +732,6 @@ ws ([ \t]|\\\n) %x COMMENT_VERB %x COMMENTLINE %x COMMENTLINE_NL -%x STRING -%x QUOTE -%x BRACE -%x BRACKET %% <ERROR>. { D @@ -777,13 +778,18 @@ D D tcl_codify("comment",yytext); } +<COMMENT>"###".*\n { +D + tcl_codify("comment",yytext); + tcl_comment(2,yytext+1); +} <COMMENT>"##".*\\\n { D tcl_codify("comment",yytext); - QString t=yytext; + QCString t=yytext; t = t.mid(2,t.length()-3); - t.append('\n'); - tcl_comment(1,t.ascii()); + t.append("\n"); + tcl_comment(1,t.data()); yy_push_state(COMMENT_NL); } <COMMENT>"##".*\n { @@ -793,7 +799,7 @@ D } <COMMENT>"#"[@\\]"code"\n[ \t]*[^#] { D - QString t=yytext; + QCString t=yytext; tcl_codify("comment",t.left(7)); tcl_comment(2,"\n@code\n"); yyless(7); @@ -801,7 +807,7 @@ D } <COMMENT>"#"[@\\]"verbatim"\n[ \t]*[^#] { D - QString t=yytext; + QCString t=yytext; tcl_codify("comment",t.left(11)); tcl_comment(2,"\n@verbatim\n"); yyless(11); @@ -810,10 +816,10 @@ D <COMMENT>"#".*\\\n { D tcl_codify("comment",yytext); - QString t=yytext; + QCString t=yytext; t = t.mid(1,t.length()-3); - t.append('\n'); - tcl_comment(2,t.ascii()); + t.append("\n"); + tcl_comment(2,t.data()); yy_push_state(COMMENT_NL); } <COMMENT>"#".*\n { @@ -823,11 +829,11 @@ D } <COMMENT>"#".*\x1A { D - QString t=yytext; + QCString t=yytext; t = t.mid(0,t.length()-1); - tcl_codify("comment",t.ascii()); + tcl_codify("comment",t.data()); t = t.mid(1,t.length()); - tcl_comment(-2,t.ascii()); + tcl_comment(-2,t.data()); unput(0x1A); } <COMMENT>\x1A { @@ -843,9 +849,9 @@ D <COMMENT_CODE>"#"[@\\]"endcode"\n { D - QString t=yytext; + QCString t=yytext; t = t.left(t.length()-10); - tcl_comment(2,t.ascii()); + tcl_comment(2,t.data()); tcl_comment(2,"\n@endcode\n"); yy_pop_state(); yyless(0); @@ -862,9 +868,9 @@ D <COMMENT_VERB>"#"[@\\]"endverbatim"\n { D - QString t=yytext; + QCString t=yytext; t = t.left(t.length()-14); - tcl_comment(2,t.ascii()); + tcl_comment(2,t.data()); tcl_comment(2,"\n@endverbatim\n"); yy_pop_state(); yyless(0); @@ -908,9 +914,9 @@ D <COMMENTLINE>"#<".*\\\n { D tcl.string_commentcodify += yytext; - QString t=yytext; + QCString t=yytext; t = t.mid(2,t.length()-4); - t.append('\n'); + t.append("\n"); tcl.string_commentline += t; yy_push_state(COMMENTLINE_NL); } @@ -929,7 +935,7 @@ D tcl.entry_current->briefFile = tcl.file_name; } yyless(0); - tcl_command(-1,tcl.string_commentcodify.ascii()); + tcl_command(-1,tcl.string_commentcodify.data()); tcl.string_commentline=""; tcl.string_commentcodify=""; } @@ -937,9 +943,9 @@ D <COMMENTLINE_NL>.*\\\n { D tcl.string_commentcodify += yytext; - QString t=yytext; + QCString t=yytext; t = t.left(t.length()-3); - t.append('\n'); + t.append("\n"); tcl.string_commentline += t; } <COMMENTLINE_NL>.*\n { @@ -950,7 +956,7 @@ D } <COMMENTLINE_NL>.*\x1A { D - QString t=yytext; + QCString t=yytext; t = t.left(t.length()-1); tcl.string_commentcodify += t; tcl.string_commentline += t; @@ -996,19 +1002,20 @@ D } <COMMAND>"{*}". { D - tcl.word_is = WORD; + tcl.word_is = ' '; tcl.string_last = "{*}"; tcl_word(0,&yytext[3]); } +<COMMAND>"\\"[\{\}\[\]\;\" \t] { +D + tcl.word_is=' '; + tcl.string_last = ""; + tcl_word(0,yytext); +} <COMMAND>. { D - switch (yytext[0]) - { - case '{': tcl.word_is = BRACE; break; - case '[': tcl.word_is = BRACKET; break; - case '"': tcl.word_is = QUOTE; break; - default: tcl.word_is = WORD; - } + tcl.word_is=' '; + if (yytext[0]=='{'||yytext[0]=='['||yytext[0]=='"') tcl.word_is = yytext[0]; tcl.string_last = ""; tcl_word(0,yytext); } @@ -1057,34 +1064,32 @@ D //! Start new scan context for given 'content'. // @return created new scan context. -static void tcl_scan_start(int type, QString content, const char *after, QString ns, Entry *entry_cl, Entry *entry_fn) +static tcl_scan *tcl_scan_start(char type, QString content, QCString ns, Entry *entry_cl, Entry *entry_fn) { tcl_scan *myScan=tcl.scan.at(0); - QString myName; - char c[2]=" "; + QCString myName; tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.ascii()); myScan->line1=yylineno; yy_push_state(TOP); myScan=new tcl_scan; - myScan->type = type; - myScan->string_after=after; - - switch (myScan->type) - { - case QUOTE: c[0]='"'; - break; - case BRACE: c[0]='{'; - break; - case BRACKET: c[0]='['; - break; - default: + myScan->type[0] =' '; + myScan->type[1] = '\0'; + switch (type) { + case '"': + case '{': + case '[': + myScan->type[0] = type; break; + case '?': + if (content[0]=='"'&&content[content.length()-1]=='"') myScan->type[0]='"'; + if (content[0]=='{'&&content[content.length()-1]=='}') myScan->type[0]='{'; + if (content[0]=='['&&content[content.length()-1]==']') myScan->type[0]='['; } - if (c[0]!=' ') + if (myScan->type[0]!=' ') { - tcl_codify(NULL,c); + tcl_codify(NULL,&myScan->type[0]); content = content.mid(1,content.length()-2); } content += (char)0x1A;// for detection end of scan context @@ -1095,6 +1100,7 @@ tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.ascii()); myScan->buffer_state=yy_scan_string(content.ascii()); myScan->line0=tcl.line_body0; myScan->line1=tcl.line_body1; + myScan->after.clear(); yylineno=myScan->line0; myScan->protection = tcl.protection; @@ -1102,34 +1108,47 @@ tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.ascii()); tcl.entry_current = tcl_entry_new(); tcl.scan.insert(0,myScan); yy_switch_to_buffer(myScan->buffer_state); + return (myScan); } //! Close current scan context. static void tcl_scan_end() { tcl_scan *myScan=tcl.scan.at(0); - char c[2]=" "; + tcl_scan *myScan1=tcl.scan.at(1); tcl_inf("line=%d\n",myScan->line1); - switch (myScan->type) - { - case QUOTE: c[0]='"'; break; - case BRACE: c[0]='}'; break; - case BRACKET: c[0]=']'; break; - } - if (c[0]!=' ') {tcl_codify(NULL,c);} - if (myScan->string_after.length()) + if (myScan->type[0]=='{') myScan->type[0]='}'; + if (myScan->type[0]=='[') myScan->type[0]=']'; + if (myScan->type[0]!=' ') tcl_codify(NULL,&myScan->type[0]); + int myStart=-1; + for (unsigned int i=0;i<myScan->after.count();i=i+2) { - tcl_codify("comment",myScan->string_after); + if (myScan->after[i]=="script") { + myStart=i; + break; + } + tcl_codify(myScan->after[i],myScan->after[i+1]); } yy_delete_buffer(myScan->buffer_state); - tcl.scan.removeFirst(); yy_pop_state(); - myScan=tcl.scan.at(0); - tcl.entry_inside = myScan->entry_scan; - yy_switch_to_buffer(myScan->buffer_state); - yylineno=myScan->line1; - tcl.protection = myScan->protection; + tcl.entry_inside = myScan1->entry_scan; + yy_switch_to_buffer(myScan1->buffer_state); + yylineno=myScan1->line1; + tcl.protection = myScan1->protection; + if (myStart>=0) + { + myScan1 = tcl_scan_start('?', myScan->after[myStart+1], myScan->ns, myScan->entry_cl, myScan->entry_fn); + for (unsigned int i=myStart+2;i<myScan->after.count();i++) + { + myScan1->after.append(myScan->after[i]); + } + tcl.scan.remove(1); + } + else + { + tcl.scan.removeFirst(); + } } //! Handling of word parsing. @@ -1174,7 +1193,7 @@ static void tcl_word(int what,const char *text) myWord=' '; yy_pop_state(); yyless(0); -tcl_inf("(\\\n) ?%s?\n",tcl.string_last.ascii()); +tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data()); return; } switch (myList[myLevel-1]) @@ -1189,7 +1208,7 @@ tcl_inf("(\\\n) ?%s?\n",tcl.string_last.ascii()); myWord=' '; yy_pop_state(); yyless(0); -tcl_inf("(\\\n) ?%s?\n",tcl.string_last.ascii()); +tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data()); return; } break; @@ -1300,7 +1319,7 @@ tcl_inf("(\\\n) ?%s?\n",tcl.string_last.ascii()); myWord=' '; yy_pop_state(); yyless(0); -tcl_inf("(%d) ?%s?\n",what,tcl.string_last.ascii()); +tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data()); return; } switch (myList[myLevel-1]) @@ -1315,7 +1334,7 @@ tcl_inf("(%d) ?%s?\n",what,tcl.string_last.ascii()); myWord=' '; yy_pop_state(); yyless(0); -tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.ascii()); +tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data()); return; } else @@ -1332,7 +1351,7 @@ tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.ascii()); myWord=' '; yy_pop_state(); yyless(0); -tcl_inf("(%d) ?%s?\n",what,tcl.string_last.ascii()); +tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data()); return; } if (myLevel!=1 || myList[0] != '.') @@ -1342,7 +1361,7 @@ tcl_inf("(%d) ?%s?\n",what,tcl.string_last.ascii()); myWord=' '; yy_pop_state(); yyless(0); -tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.ascii()); +tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data()); return; myWhite=0; break; @@ -1414,7 +1433,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment); // resolve ALIASES myI.addArray("/*!",3); - myI.addArray(tcl.string_comment.ascii(),tcl.string_comment.length()); + myI.addArray(tcl.string_comment.data(),tcl.string_comment.length()); myI.addArray("*/",2); convertCppComments(&myI,&myO,tcl.file_name); myO.dropFromStart(3); @@ -1564,11 +1583,11 @@ D } //! Create link. -static void tcl_codify_link(const char *name) +static void tcl_codify_link(QCString name) { - if (tcl.code == NULL || name == NULL) return; + if (tcl.code == NULL || name.isEmpty()) return; static int init=0; - static QDict<MemberDef> fn; + static QAsciiDict<MemberDef> fn; if (init==0) { init=1; @@ -1594,22 +1613,29 @@ static void tcl_codify_link(const char *name) } } MemberDef *myDef; - QString myName=name; - - if (strncmp(name,"::",2)==0) // fully qualified global command + QCString myName=name; + if (name.mid(0,2)=="::") // fully qualified global command { myName = myName.mid(2); myDef = fn.find(myName); } else // not qualified name { + QCString myName1=myName; myDef = NULL; - myName = tcl.scan.at(0)->ns; - myName = myName + "::" + myName; - myDef = fn.find(myName); // search namespace command + myName1 = tcl.scan.at(0)->ns; + if (myName1 == " " || myName1 == "") + { + myName1 = myName; + } + else + { + myName1 = myName1 + "::" + myName; + } + myDef = fn.find(myName1); // search namespace command if (myDef == NULL) { - myDef = fn.find(name); // search global command + myDef = fn.find(myName); // search global command } } if (myDef != NULL) // documented command @@ -1635,33 +1661,102 @@ static void tcl_codify_link(const char *name) } } + +//! Handle internal tcl commands. +// "if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN?" +static void tcl_command_IF(QStringList type) +{ +D + tcl_codify("keyword",*tcl.list_commandwords.at(0)); + tcl_codify(NULL,*tcl.list_commandwords.at(1)); + tcl_scan *myScan=tcl.scan.at(0); + myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2), + myScan->ns,myScan->entry_cl,myScan->entry_fn); + for (unsigned int i = 3;i<tcl.list_commandwords.count();i++) + { + myScan->after << type[i] << tcl.list_commandwords[i]; + } +} +//! Handle internal tcl commands. +// "for start test next body" +static void tcl_command_FOR() +{ +D + tcl_codify("keyword",*tcl.list_commandwords.at(0)); + tcl_codify(NULL,*tcl.list_commandwords.at(1)); + tcl_scan *myScan=tcl.scan.at(0); + myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2), + myScan->ns,myScan->entry_cl,myScan->entry_fn); + myScan->after << "NULL" << tcl.list_commandwords[3]; + myScan->after << "script" << tcl.list_commandwords[4]; + myScan->after << "NULL" << tcl.list_commandwords[5]; + myScan->after << "script" << tcl.list_commandwords[6]; + myScan->after << "NULL" << tcl.list_commandwords[7]; + myScan->after << "script" << tcl.list_commandwords[8]; +} + +///! Handle internal tcl commands. +// "foreach varname list body" and +// "foreach varlist1 list1 ?varlist2 list2 ...? body" +static void tcl_command_FOREACH() +{ +D + unsigned int i; + tcl_codify("keyword",*tcl.list_commandwords.at(0)); + for (i = 1;i<tcl.list_commandwords.count()-1;i++) + { + tcl_codify(NULL,*tcl.list_commandwords.at(i)); + } + tcl_scan *myScan=tcl.scan.at(0); + myScan = tcl_scan_start('?',*tcl.list_commandwords.at(tcl.list_commandwords.count()-1), + myScan->ns,myScan->entry_cl,myScan->entry_fn); +} + +///! Handle internal tcl commands. +// "while test body" +static void tcl_command_WHILE() +{ +D + tcl_codify("keyword",*tcl.list_commandwords.at(0)); + tcl_codify(NULL,*tcl.list_commandwords.at(1)); + tcl_scan *myScan=tcl.scan.at(0); + myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2), + myScan->ns,myScan->entry_cl,myScan->entry_fn); + myScan->after << "NULL" << tcl.list_commandwords[3]; + myScan->after << "script" << tcl.list_commandwords[4]; +} + //! Handle all other commands. // Create links of first command word or first command word inside []. -static void tcl_command_OTHER(const char *text) +static void tcl_command_OTHER() { if (tcl.code == NULL) return; D - QCString myName; - + QCString myName; for (unsigned int i=0; i< tcl.list_commandwords.count(); i++) { myName = *tcl.list_commandwords.at(i); if (i==0) { - tcl_codify_link(myName.data()); + tcl_codify_link(myName); } - else //TODO check on [... inside current string + else if (i%2 != 0) + { + tcl_codify(NULL,myName); + } + else { QCString myStr=""; int myCmd=0; - for (unsigned int i=0;i<myName.length();i++) + unsigned int i; + for (i=0;i<myName.length();i++) { - char c = myName.at(i); + QChar c = myName[i]; if (myCmd) { if (c==' '||c=='\t'||c=='\n'||c==']') {//end of command - tcl_codify_link(myStr.data()); + tcl_codify_link(myStr); myStr=""; myCmd=0; } @@ -1672,6 +1767,12 @@ D myStr+=c; if (c=='[') {//start of command + for (;i<myName.length();i++) + { + c = myName[i+1]; + if (c!=' ' && c!='\t' && c!='\n') break; + myStr+=c; + } tcl_codify(NULL,myStr); myStr=""; myCmd=1; @@ -1681,14 +1782,13 @@ D tcl_codify(NULL,myStr); } } - tcl_codify(NULL,text); } //! Handle \c proc statements. -static void tcl_command_PROC(const char *text) +static void tcl_command_PROC() { D - QString myNs, myName; + QCString myNs, myName; Entry *myEntryNs, *myEntry; tcl_scan *myScan = tcl.scan.at(0); @@ -1719,15 +1819,15 @@ D myEntryNs->addSubEntry(tcl.entry_current); myEntry = tcl.entry_current; tcl.fn.insert(myName,myEntry); - tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),text, + myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6), myEntryNs->name,NULL,myEntry); } //! Handle \c itcl::body statements and \c oo::define method and method inside \c itcl::class statements. -static void tcl_command_METHOD(const char *text) +static void tcl_command_METHOD() { D - QString myNs, myName; + QCString myNs, myName; Entry *myEntryCl, *myEntry; tcl_scan *myScan = tcl.scan.at(0); @@ -1761,15 +1861,15 @@ D myEntryCl->addSubEntry(tcl.entry_current); tcl.fn.insert(myName,tcl.entry_current); myEntry = tcl.entry_current; - tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),text, + myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6), myNs, myEntryCl, myEntry); } //! Handle \c constructor statements inside class definitions. -static void tcl_command_CONSTRUCTOR(const char *text) +static void tcl_command_CONSTRUCTOR() { D - QString myNs, myName; + QCString myNs, myName; Entry *myEntryCl, *myEntry; tcl_scan *myScan = tcl.scan.at(0); @@ -1798,15 +1898,15 @@ D myEntryCl->addSubEntry(tcl.entry_current); myEntry = tcl.entry_current; tcl.fn.insert(myName,myEntry); - tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),text, + myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4), myNs, myEntryCl, myEntry); } //! Handle \c destructor statements inside class definitions. -static void tcl_command_DESTRUCTOR(const char *text) +static void tcl_command_DESTRUCTOR() { D - QString myNs, myName; + QCString myNs, myName; Entry *myEntryCl, *myEntry; tcl_scan *myScan = tcl.scan.at(0); @@ -1832,15 +1932,15 @@ D myEntryCl->addSubEntry(tcl.entry_current); myEntry = tcl.entry_current; tcl.fn.insert(myName,myEntry); - tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(2),text, + myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(2), myNs, myEntryCl, myEntry); } //! Handle \c namespace statements. -static void tcl_command_NAMESPACE(const char *text) +static void tcl_command_NAMESPACE() { D - QString myNs, myName, myStr; + QCString myNs, myName, myStr; Entry *myEntryNs=NULL; tcl_scan *myScan = tcl.scan.at(0); @@ -1870,16 +1970,16 @@ D { myStr.append(*tcl.list_commandwords.at(i)); } - tcl.word_is=STRING; + tcl.word_is=' '; } - tcl_scan_start(tcl.word_is,myStr,text, myName, NULL, NULL); + myScan = tcl_scan_start(tcl.word_is,myStr, myName, NULL, NULL); } //! Handle \c itcl::class statements. -static void tcl_command_ITCL_CLASS(const char *text) +static void tcl_command_ITCL_CLASS() { D - QString myNs, myName, myStr; + QCString myNs, myName, myStr; Entry *myEntryCl; tcl_scan *myScan = tcl.scan.at(0); @@ -1900,15 +2000,15 @@ D tcl.entry_main->addSubEntry(tcl.entry_current); tcl.cl.insert(myName,tcl.entry_current); myEntryCl = tcl.entry_current; - tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),text, + myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4), myName, myEntryCl, NULL); } //! Handle \c oo::class statements. -static void tcl_command_OO_CLASS(const char *text) +static void tcl_command_OO_CLASS() { D - QString myNs, myName, myStr; + QCString myNs, myName, myStr; Entry *myEntryNs, *myEntryCl; tcl_scan *myScan = tcl.scan.at(0); @@ -1932,15 +2032,15 @@ D myEntryNs = tcl_entry_namespace(myName); tcl.cl.insert(myName,tcl.entry_current); myEntryCl = tcl.entry_current; - tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),text, + myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6), myName, myEntryCl, NULL); } //! Handle \c oo::define statements. -static void tcl_command_OO_DEFINE(const char *text) +static void tcl_command_OO_DEFINE() { D - QString myNs, myName, myStr; + QCString myNs, myName, myStr; Entry *myEntryCl; tcl_scan *myScan = tcl.scan.at(0); @@ -1961,16 +2061,16 @@ D { myStr.append(*tcl.list_commandwords.at(i)); } - tcl.word_is=STRING; + tcl.word_is=' '; } - tcl_scan_start(tcl.word_is,myStr,text,myName,myEntryCl,NULL); + myScan = tcl_scan_start(tcl.word_is,myStr,myName,myEntryCl,NULL); } //! Handle \c variable statements. -static void tcl_command_VARIABLE(const char *text, int inclass) +static void tcl_command_VARIABLE(int inclass) { D - QString myNs, myName; + QCString myNs, myName; Entry *myEntry; tcl_scan *myScan = tcl.scan.at(0); @@ -2006,7 +2106,6 @@ D tcl_protection(tcl.entry_current); myEntry->addSubEntry(tcl.entry_current); tcl.entry_current = tcl_entry_new(); - tcl_codify("comment",text); } //! Handling of command parsing. @@ -2043,6 +2142,7 @@ tcl_inf("<- %s\n",text); tcl_err("what %d\n",what); return; } + QCString myText = text; tcl_inf("->\n"); if (tcl.command==0) { @@ -2062,8 +2162,8 @@ tcl_inf("->\n"); if (tcl.list_commandwords.count() < 3) { - tcl_command_OTHER(text); - goto command_end; + tcl_command_OTHER(); + goto command_text; } // remove leading "::" and apply TCL_SUBST if (myStr.left(2)=="::") myStr = myStr.mid(2); @@ -2095,7 +2195,7 @@ tcl_inf("->\n"); if (tcl.list_commandwords.count()==1) { tcl_scan *myScan = tcl.scan.at(0); - tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(0),text, + myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(0), myScan->ns,myScan->entry_cl,myScan->entry_fn); myProt = tcl.protection; goto command_end; @@ -2116,7 +2216,7 @@ tcl_inf("->\n"); tcl.list_commandwords.append(""); } if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;} - tcl_command_PROC(text); + tcl_command_PROC(); goto command_end; } if (strcmp("method",myStr)==0) @@ -2127,19 +2227,19 @@ tcl_inf("->\n"); tcl.list_commandwords.append(""); } if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;} - tcl_command_METHOD(text); + tcl_command_METHOD(); goto command_end; } if (strcmp("constructor",myStr)==0) { if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;} - tcl_command_CONSTRUCTOR(text); + tcl_command_CONSTRUCTOR(); goto command_end; } if (strcmp("destructor",myStr)==0) { if (tcl.list_commandwords.count() != 3) {myLine=__LINE__;goto command_warn;} - tcl_command_DESTRUCTOR(text); + tcl_command_DESTRUCTOR(); goto command_end; } if (strcmp("namespace",myStr)==0) @@ -2147,22 +2247,22 @@ tcl_inf("->\n"); if (strcmp("eval",*tcl.list_commandwords.at(2))==0) { if (tcl.list_commandwords.count() < 7) {myLine=__LINE__;goto command_warn;} - tcl_command_NAMESPACE(text); + tcl_command_NAMESPACE(); goto command_end; } - tcl_command_OTHER(text); - goto command_end; + tcl_command_OTHER(); + goto command_text; } if (strcmp("itcl::class",myStr)==0) { if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;} - tcl_command_ITCL_CLASS(text); + tcl_command_ITCL_CLASS(); goto command_end; } if (strcmp("itcl::body",myStr)==0) { if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;} - tcl_command_METHOD(text); + tcl_command_METHOD(); goto command_end; } if (strcmp("oo::class",myStr)==0) @@ -2170,16 +2270,16 @@ tcl_inf("->\n"); if (strcmp("create",*tcl.list_commandwords.at(2))==0) { if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;} - tcl_command_OO_CLASS(text); + tcl_command_OO_CLASS(); goto command_end; } - tcl_command_OTHER(text); - goto command_end; + tcl_command_OTHER(); + goto command_text; } if (strcmp("oo::define",myStr)==0) { if (tcl.list_commandwords.count() < 5) {myLine=__LINE__;goto command_warn;} - tcl_command_OO_DEFINE(text); + tcl_command_OO_DEFINE(); goto command_end; } if (strcmp("variable",myStr)==0) @@ -2187,8 +2287,8 @@ tcl_inf("->\n"); if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;} if (tcl.scan.at(0)->entry_fn == NULL) {// only parsed outside functions - tcl_command_VARIABLE(text,tcl.scan.at(0)->entry_cl!=NULL&&tcl.scan.at(0)->entry_cl->name!=""); - goto command_end; + tcl_command_VARIABLE(tcl.scan.at(0)->entry_cl!=NULL&&tcl.scan.at(0)->entry_cl->name!=""); + goto command_text; } } if (strcmp("common",myStr)==0) @@ -2196,8 +2296,8 @@ tcl_inf("->\n"); if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;} if (tcl.scan.at(0)->entry_fn == NULL) {// only parsed outside functions - tcl_command_VARIABLE(text,0); - goto command_end; + tcl_command_VARIABLE(0); + goto command_text; } } if (strcmp("inherit",myStr)==0 || strcmp("superclass",myStr)==0) @@ -2205,18 +2305,107 @@ tcl_inf("->\n"); if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;} if (tcl.scan.at(0)->entry_cl!=NULL&&tcl.scan.at(0)->entry_cl->name!="") { - for (unsigned int i = 2; i < tcl.list_commandwords.count(); i++) + for (unsigned int i = 2; i < tcl.list_commandwords.count(); i = i + 2) { tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo(*tcl.list_commandwords.at(i),Public,Normal)); } } + goto command_end; + } + /* + * Start of internal tcl keywords + * Ready: if, for, foreach, while + * TODO: switch, eval, ? + */ + if (strcmp("for",myStr)==0) + { + if (tcl.list_commandwords.count() != 9) {myLine=__LINE__;goto command_warn;} + tcl_command_FOR(); + goto command_end; } - tcl_command_OTHER(text); - goto command_end; - command_warn: + if (strcmp("foreach",myStr)==0) + { + if (tcl.list_commandwords.count() < 7 || tcl.list_commandwords.count()%2==0) {myLine=__LINE__;goto command_warn;} + tcl_command_FOREACH(); + goto command_end; + } + /* +if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN? + */ + if (strcmp("if",myStr)==0 && tcl.list_commandwords.count() > 4) + { + QStringList myType; + myType << "keyword" << "NULL" << "script" << "NULL"; + char myState='x';// last word: e'x'pr 't'hen 'b'ody 'e'lse else'i'f.. + for (unsigned int i = 4; i < tcl.list_commandwords.count(); i = i + 2) + { + const char *myStr=*tcl.list_commandwords.at(i); + if (myState=='x') + { + if (strcmp("then",myStr)==0) { + myState='t'; + myType << "keyword" << "NULL"; + } + else + { + myState='b'; + myType << "script" << "NULL"; + } + } + else if (myState=='t') + { + myState='b'; + myType << "script" << "NULL"; + } + else if (myState=='b') + { + if (strcmp("elseif",myStr)==0) { + myState='i'; + myType << "keyword" << "NULL"; + } + else if (strcmp("else",myStr)==0 && i==tcl.list_commandwords.count()-3) + { + myState = 'b'; + myType << "keyword" << "NULL" << "script"; + i = tcl.list_commandwords.count(); + } + else if (i==tcl.list_commandwords.count()-1) + { + myState = 'b'; + myType << "script"; + i = tcl.list_commandwords.count(); + } + else + { + myLine=__LINE__;goto command_warn; + } + } + else if (myState=='i') + { + myState='x'; + myType << "script" << "NULL"; + } + } + if (myState != 'b') {myLine=__LINE__;goto command_warn;} + tcl_command_IF(myType); + goto command_end; + } + if (strcmp("while",myStr)==0) + { + if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;} + tcl_command_WHILE(); + goto command_end; + } + tcl_command_OTHER(); + goto command_text; + command_warn:// print warning message because of wrong used syntax tcl_war("%d count=%d: %s\n",myLine,tcl.list_commandwords.count(),tcl.list_commandwords.join(" ").ascii()); - tcl_command_OTHER(text); - command_end: + tcl_command_OTHER(); + command_text:// print remaining text as comment + if (!myText.isEmpty()) tcl_codify("comment",myText); + myText = ""; + command_end:// add remaining text to current context + if (!myText.isEmpty()) tcl.scan.at(0)->after << "comment" << myText; tcl.list_commandwords.clear(); tcl.command = 0; tcl.protection = myProt; @@ -2250,7 +2439,7 @@ tcl_inf("TCL_SUBST: use '%s'\n",s); if (tcl.input_string.at(tcl.input_string.length()-1) == '\n') { - tcl.input_string.at(tcl.input_string.length()-1) = 0x1A; + tcl.input_string[tcl.input_string.length()-1] = 0x1A; } else { @@ -2269,7 +2458,7 @@ tcl_inf("TCL_SUBST: use '%s'\n",s); tcl.brace_level=0; tcl.bracket_level=0; tcl.bracket_quote=0; - tcl.word_is=WORD; + tcl.word_is=' '; tcl.string_command=""; tcl.string_commentline=""; tcl.string_commentcodify=""; @@ -2290,7 +2479,7 @@ tcl_inf("TCL_SUBST: use '%s'\n",s); } //! Start parsing. -static void tcl_parse(const QString ns, const QString cls) +static void tcl_parse(const QCString ns, const QCString cls) { tcl_scan *myScan; @@ -2299,14 +2488,18 @@ static void tcl_parse(const QString ns, const QString cls) tcl.entry_file->section = Entry::SOURCE_SEC; tcl.entry_file->protection = Public; tcl.entry_main->addSubEntry(tcl.entry_file); + Entry *myEntry=tcl_entry_new(); + myEntry->name=""; + tcl.entry_main->addSubEntry(myEntry); + tcl.ns.insert("::",myEntry); tcl.entry_current = tcl_entry_new(); tclscanYYrestart( tclscanYYin ); BEGIN( TOP ); yylineno=1; myScan = new tcl_scan; - myScan->type=STRING; - myScan->string_after=""; + myScan->type[0]=' ';myScan->type[1]='\n'; + myScan->after.clear(); myScan->line0=yylineno; myScan->line1=yylineno; myScan->buffer_state=YY_CURRENT_BUFFER; @@ -2316,7 +2509,6 @@ static void tcl_parse(const QString ns, const QString cls) tcl.entry_inside = tcl.entry_file; myScan->entry_scan = tcl.entry_inside; tcl.scan.insert(0,myScan); - tclscanYYlex(); tcl.scan.clear(); tcl.ns.clear(); @@ -2346,7 +2538,6 @@ tcl_inf("%s\n",fileName); tcl.this_parser = this; tcl.entry_main = root; /* toplevel entry */ tcl_parse("",""); - groupLeaveFile(tcl.file_name,yylineno); root->program.resize(0); myFile.close(); @@ -2375,8 +2566,8 @@ void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, if (input.length()<1) return; tcl.input_string = input; - QString myNs=""; - QString myCls=""; + QCString myNs=""; + QCString myCls=""; if (memberDef) { if (memberDef->getClassDef()) @@ -2415,7 +2606,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); diff --git a/src/textdocvisitor.h b/src/textdocvisitor.h index 40fa612..5646064 100644 --- a/src/textdocvisitor.h +++ b/src/textdocvisitor.h @@ -126,6 +126,8 @@ class TextDocVisitor : public DocVisitor void visitPost(DocCopy *) {} void visitPre(DocText *) {} void visitPost(DocText *) {} + void visitPre(DocHtmlBlockQuote *) {} + void visitPost(DocHtmlBlockQuote *) {} private: diff --git a/src/util.cpp b/src/util.cpp index 1f54503..6addbc7 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -52,6 +52,7 @@ #include "parserintf.h" #include "bufstr.h" #include "image.h" +#include "growbuf.h" #define ENABLE_TRACINGSUPPORT 0 @@ -1539,43 +1540,18 @@ static bool findOperator2(const QCString &s,int i) static const char constScope[] = { 'c', 'o', 'n', 's', 't', ':' }; static const char virtualScope[] = { 'v', 'i', 'r', 't', 'u', 'a', 'l', ':' }; - -class StrBuf -{ - public: - StrBuf() : str(0), pos(0), len(0) {} - ~StrBuf() { free(str); str=0; pos=0; len=0; } - void clear() { pos=0; } - void addChar(char c) { if (pos>=len) { len+=1024; str = (char*)realloc(str,len); } - str[pos++]=c; - } - void addStr(const char *s) { - int l=strlen(s); - if (pos+l>=len) { len+=l+1024; str = (char*)realloc(str,len); } - strcpy(&str[pos],s); - pos+=l; - } - const char *get() { return str; } - int getPos() const { return pos; } - char at(int i) const { return str[i]; } - private: - char *str; - int pos; - int len; -}; - // Note: this function is not reentrant due to the use of static buffer! QCString removeRedundantWhiteSpace(const QCString &s) { static bool cliSupport = Config_getBool("CPP_CLI_SUPPORT"); if (s.isEmpty()) return s; - static StrBuf strBuf; + static GrowBuf growBuf; //int resultLen = 1024; //int resultPos = 0; //QCString result(resultLen); - // we use strBuf.addChar(c) instead of result+=c to + // we use growBuf.addChar(c) instead of result+=c to // improve the performance of this function - strBuf.clear(); + growBuf.clear(); uint i; uint l=s.length(); uint csp=0; @@ -1610,14 +1586,14 @@ nextChar: if (c=='"') // quoted string { i++; - strBuf.addChar(c); + growBuf.addChar(c); while (i<l) { char cc=s.at(i); - strBuf.addChar(cc); + growBuf.addChar(cc); if (cc=='\\') // escaped character { - strBuf.addChar(s.at(i+1)); + growBuf.addChar(s.at(i+1)); i+=2; } else if (cc=='"') // end of string @@ -1631,24 +1607,24 @@ nextChar: (i<8 || !findOperator(s,i)) // string in front is not "operator" ) { - strBuf.addChar('<'); - strBuf.addChar(' '); + growBuf.addChar('<'); + growBuf.addChar(' '); } else if (i>0 && c=='>' && // current char is a > (isId(s.at(i-1)) || isspace((uchar)s.at(i-1)) || s.at(i-1)=='*' || s.at(i-1)=='&') && // prev char is an id char or space (i<8 || !findOperator(s,i)) // string in front is not "operator" ) { - strBuf.addChar(' '); - strBuf.addChar('>'); + growBuf.addChar(' '); + growBuf.addChar('>'); } else if (i>0 && c==',' && !isspace((uchar)s.at(i-1)) && ((i<l-1 && isId(s.at(i+1))) || (i<l-2 && s.at(i+1)=='$' && isId(s.at(i+2))) // for PHP || (i<l-3 && s.at(i+1)=='&' && s.at(i+2)=='$' && isId(s.at(i+3))))) // for PHP { - strBuf.addChar(','); - strBuf.addChar(' '); + growBuf.addChar(','); + growBuf.addChar(' '); } else if (i>0 && ((isId(s.at(i)) && s.at(i-1)==')') || @@ -1656,8 +1632,8 @@ nextChar: ) ) { - strBuf.addChar(' '); - strBuf.addChar(s.at(i)); + growBuf.addChar(' '); + growBuf.addChar(s.at(i)); } else if (c=='t' && csp==5 /*&& (i<5 || !isId(s.at(i-5)))*/ && !(isId(s.at(i+1)) /*|| s.at(i+1)==' '*/ || @@ -1668,16 +1644,16 @@ nextChar: ) // prevent const ::A from being converted to const::A { - strBuf.addChar('t'); - strBuf.addChar(' '); + growBuf.addChar('t'); + growBuf.addChar(' '); if (s.at(i+1)==' ') i++; csp=0; } else if (c==':' && csp==6 /*&& (i<6 || !isId(s.at(i-6)))*/) // replace const::A by const ::A { - strBuf.addChar(' '); - strBuf.addChar(':'); + growBuf.addChar(' '); + growBuf.addChar(':'); csp=0; } else if (c=='l' && vsp==7 /*&& (i<7 || !isId(s.at(i-7)))*/ && @@ -1689,16 +1665,16 @@ nextChar: ) // prevent virtual ::A from being converted to virtual::A { - strBuf.addChar('l'); - strBuf.addChar(' '); + growBuf.addChar('l'); + growBuf.addChar(' '); if (s.at(i+1)==' ') i++; vsp=0; } else if (c==':' && vsp==8 /*&& (i<8 || !isId(s.at(i-8)))*/) // replace virtual::A by virtual ::A { - strBuf.addChar(' '); - strBuf.addChar(':'); + growBuf.addChar(' '); + growBuf.addChar(':'); vsp=0; } else if (!isspace((uchar)c) || // not a space @@ -1712,28 +1688,28 @@ nextChar: if (c=='*' || c=='&' || c=='@' || c=='$') { //uint rl=result.length(); - uint rl=strBuf.getPos(); - if ((rl>0 && (isId(strBuf.at(rl-1)) || strBuf.at(rl-1)=='>')) && + uint rl=growBuf.getPos(); + if ((rl>0 && (isId(growBuf.at(rl-1)) || growBuf.at(rl-1)=='>')) && ((c!='*' && c!='&') || !findOperator2(s,i)) // avoid splitting operator* and operator->* and operator& ) { - strBuf.addChar(' '); + growBuf.addChar(' '); } } - strBuf.addChar(c); + growBuf.addChar(c); if (cliSupport && (c=='^' || c=='%') && i>1 && isId(s.at(i-1)) && !findOperator(s,i) ) { - strBuf.addChar(' '); // C++/CLI: Type^ name and Type% name + growBuf.addChar(' '); // C++/CLI: Type^ name and Type% name } } } //printf("removeRedundantWhiteSpace(`%s')=`%s'\n",s.data(),result.data()); - strBuf.addChar(0); + growBuf.addChar(0); //result.resize(resultPos); - return strBuf.get(); + return growBuf.get(); } bool rightScopeMatch(const QCString &scope, const QCString &name) @@ -4080,17 +4056,17 @@ bool getDefs(const QCString &scName,const QCString &memberName, /*! * Searches for a scope definition given its name as a string via parameter - * `scope'. + * `scope`. * - * The parameter `docScope' is a string representing the name of the scope in - * which the `scope' string was found. + * The parameter `docScope` is a string representing the name of the scope in + * which the `scope` string was found. * * The function returns TRUE if the scope is known and documented or * FALSE if it is not. - * If TRUE is returned exactly one of the parameter `cd', `nd' + * If TRUE is returned exactly one of the parameter `cd`, `nd` * will be non-zero: - * - if `cd' is non zero, the scope was a class pointed to by cd. - * - if `nd' is non zero, the scope was a namespace pointed to by nd. + * - if `cd` is non zero, the scope was a class pointed to by cd. + * - if `nd` is non zero, the scope was a namespace pointed to by nd. */ static bool getScopeDefs(const char *docScope,const char *scope, ClassDef *&cd, NamespaceDef *&nd) @@ -4818,41 +4794,41 @@ bool hasVisibleRoot(BaseClassList *bcl) //---------------------------------------------------------------------- -// note that this function is not reentrant due to the use of static strBuf! +// note that this function is not reentrant due to the use of static growBuf! QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscore) { static bool caseSenseNames = Config_getBool("CASE_SENSE_NAMES"); - static StrBuf strBuf; - strBuf.clear(); + static GrowBuf growBuf; + growBuf.clear(); char c; const char *p=name; while ((c=*p++)!=0) { switch(c) { - case '_': if (allowUnderscore) strBuf.addChar('_'); else strBuf.addStr("__"); break; - case '-': strBuf.addChar('-'); break; - case ':': strBuf.addStr("_1"); break; - case '/': strBuf.addStr("_2"); break; - case '<': strBuf.addStr("_3"); break; - case '>': strBuf.addStr("_4"); break; - case '*': strBuf.addStr("_5"); break; - case '&': strBuf.addStr("_6"); break; - case '|': strBuf.addStr("_7"); break; - case '.': if (allowDots) strBuf.addChar('.'); else strBuf.addStr("_8"); break; - case '!': strBuf.addStr("_9"); break; - case ',': strBuf.addStr("_00"); break; - case ' ': strBuf.addStr("_01"); break; - case '{': strBuf.addStr("_02"); break; - case '}': strBuf.addStr("_03"); break; - case '?': strBuf.addStr("_04"); break; - case '^': strBuf.addStr("_05"); break; - case '%': strBuf.addStr("_06"); break; - case '(': strBuf.addStr("_07"); break; - case ')': strBuf.addStr("_08"); break; - case '+': strBuf.addStr("_09"); break; - case '=': strBuf.addStr("_0A"); break; - case '$': strBuf.addStr("_0B"); break; + case '_': if (allowUnderscore) growBuf.addChar('_'); else growBuf.addStr("__"); break; + case '-': growBuf.addChar('-'); break; + case ':': growBuf.addStr("_1"); break; + case '/': growBuf.addStr("_2"); break; + case '<': growBuf.addStr("_3"); break; + case '>': growBuf.addStr("_4"); break; + case '*': growBuf.addStr("_5"); break; + case '&': growBuf.addStr("_6"); break; + case '|': growBuf.addStr("_7"); break; + case '.': if (allowDots) growBuf.addChar('.'); else growBuf.addStr("_8"); break; + case '!': growBuf.addStr("_9"); break; + case ',': growBuf.addStr("_00"); break; + case ' ': growBuf.addStr("_01"); break; + case '{': growBuf.addStr("_02"); break; + case '}': growBuf.addStr("_03"); break; + case '?': growBuf.addStr("_04"); break; + case '^': growBuf.addStr("_05"); break; + case '%': growBuf.addStr("_06"); break; + case '(': growBuf.addStr("_07"); break; + case ')': growBuf.addStr("_08"); break; + case '+': growBuf.addStr("_09"); break; + case '=': growBuf.addStr("_0A"); break; + case '$': growBuf.addStr("_0B"); break; default: if (c<0) { @@ -4864,22 +4840,22 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor ids[2]=map[id>>4]; ids[3]=map[id&0xF]; ids[4]=0; - strBuf.addStr(ids); + growBuf.addStr(ids); } else if (caseSenseNames || !isupper(c)) { - strBuf.addChar(c); + growBuf.addChar(c); } else { - strBuf.addChar('_'); - strBuf.addChar(tolower(c)); + growBuf.addChar('_'); + growBuf.addChar(tolower(c)); } break; } } - strBuf.addChar(0); - return strBuf.get(); + growBuf.addChar(0); + return growBuf.get(); } /*! This function determines the file name on disk of an item @@ -5216,8 +5192,8 @@ QCString stripScope(const char *name) /*! Converts a string to an XML-encoded string */ QCString convertToXML(const char *s) { - static StrBuf strBuf; - strBuf.clear(); + static GrowBuf growBuf; + growBuf.clear(); if (s==0) return ""; const char *p=s; char c; @@ -5225,23 +5201,23 @@ QCString convertToXML(const char *s) { switch (c) { - case '<': strBuf.addStr("<"); break; - case '>': strBuf.addStr(">"); break; - case '&': strBuf.addStr("&"); break; - case '\'': strBuf.addStr("'"); break; - case '"': strBuf.addStr("""); break; - default: strBuf.addChar(c); break; + case '<': growBuf.addStr("<"); break; + case '>': growBuf.addStr(">"); break; + case '&': growBuf.addStr("&"); break; + case '\'': growBuf.addStr("'"); break; + case '"': growBuf.addStr("""); break; + default: growBuf.addChar(c); break; } } - strBuf.addChar(0); - return strBuf.get(); + growBuf.addChar(0); + return growBuf.get(); } /*! Converts a string to a HTML-encoded string */ QCString convertToHtml(const char *s,bool keepEntities) { - static StrBuf strBuf; - strBuf.clear(); + static GrowBuf growBuf; + growBuf.clear(); if (s==0) return ""; const char *p=s; char c; @@ -5249,8 +5225,8 @@ QCString convertToHtml(const char *s,bool keepEntities) { switch (c) { - case '<': strBuf.addStr("<"); break; - case '>': strBuf.addStr(">"); break; + case '<': growBuf.addStr("<"); break; + case '>': growBuf.addStr(">"); break; case '&': if (keepEntities) { const char *e=p; @@ -5262,32 +5238,32 @@ QCString convertToHtml(const char *s,bool keepEntities) if (ce==';') // found end of an entity { // copy entry verbatim - strBuf.addChar(c); - while (p<e) strBuf.addChar(*p++); + growBuf.addChar(c); + while (p<e) growBuf.addChar(*p++); } else { - strBuf.addStr("&"); + growBuf.addStr("&"); } } else { - strBuf.addStr("&"); + growBuf.addStr("&"); } break; - case '\'': strBuf.addStr("'"); break; - case '"': strBuf.addStr("""); break; - default: strBuf.addChar(c); break; + case '\'': growBuf.addStr("'"); break; + case '"': growBuf.addStr("""); break; + default: growBuf.addChar(c); break; } } - strBuf.addChar(0); - return strBuf.get(); + growBuf.addChar(0); + return growBuf.get(); } QCString convertToJSString(const char *s) { - static StrBuf strBuf; - strBuf.clear(); + static GrowBuf growBuf; + growBuf.clear(); if (s==0) return ""; const char *p=s; char c; @@ -5295,13 +5271,13 @@ QCString convertToJSString(const char *s) { switch (c) { - case '"': strBuf.addStr("\\\""); break; - case '\\': strBuf.addStr("\\\\"); break; - default: strBuf.addChar(c); break; + case '"': growBuf.addStr("\\\""); break; + case '\\': growBuf.addStr("\\\\"); break; + default: growBuf.addChar(c); break; } } - strBuf.addChar(0); - return strBuf.get(); + growBuf.addChar(0); + return growBuf.get(); } @@ -5879,7 +5855,8 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, const char *fileName,int startLine, const QList<ListItemInfo> *sli, GroupDef *gd, - TagInfo *tagInfo + TagInfo *tagInfo, + SrcLangExt lang ) { PageDef *pd=0; @@ -5902,6 +5879,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, pd=new PageDef(fileName,startLine,baseName,doc,title); pd->setRefItems(sli); + pd->setLanguage(lang); if (tagInfo) { @@ -6269,25 +6247,22 @@ static struct Lang2ExtMap g_lang2extMap[] = { // language parser parser option - { "idl", "c", SrcLangExt_IDL }, - { "java", "c", SrcLangExt_Java }, - { "javascript", "c", SrcLangExt_JS }, - { "csharp", "c", SrcLangExt_CSharp }, - { "d", "c", SrcLangExt_D }, - { "php", "c", SrcLangExt_PHP }, - { "objective-c", "c", SrcLangExt_ObjC }, - { "c", "c", SrcLangExt_Cpp }, - { "c++", "c", SrcLangExt_Cpp }, - { "python", "python", SrcLangExt_Python }, - { "fortran", "fortran", SrcLangExt_Fortran }, - { "vhdl", "vhdl", SrcLangExt_VHDL }, - { "vhd", "vhd", SrcLangExt_VHDL }, - { "ucf", "vhd", SrcLangExt_VHDL }, - { "qsf", "vhd", SrcLangExt_VHDL }, - - { "dbusxml", "dbusxml", SrcLangExt_XML }, - { "tcl", "tcl", SrcLangExt_Tcl }, - { 0, 0, (SrcLangExt)0 } + { "idl", "c", SrcLangExt_IDL }, + { "java", "c", SrcLangExt_Java }, + { "javascript", "c", SrcLangExt_JS }, + { "csharp", "c", SrcLangExt_CSharp }, + { "d", "c", SrcLangExt_D }, + { "php", "c", SrcLangExt_PHP }, + { "objective-c", "c", SrcLangExt_ObjC }, + { "c", "c", SrcLangExt_Cpp }, + { "c++", "c", SrcLangExt_Cpp }, + { "python", "python", SrcLangExt_Python }, + { "fortran", "fortran", SrcLangExt_Fortran }, + { "vhdl", "vhdl", SrcLangExt_VHDL }, + { "dbusxml", "dbusxml", SrcLangExt_XML }, + { "tcl", "tcl", SrcLangExt_Tcl }, + { "md", "md", SrcLangExt_Markdown }, + { 0, 0, (SrcLangExt)0 } }; bool updateLanguageMapping(const QCString &extension,const QCString &language) @@ -6328,31 +6303,33 @@ bool updateLanguageMapping(const QCString &extension,const QCString &language) void initDefaultExtensionMapping() { g_extLookup.setAutoDelete(TRUE); - updateLanguageMapping(".idl", "idl"); - updateLanguageMapping(".ddl", "idl"); - updateLanguageMapping(".odl", "idl"); - updateLanguageMapping(".java", "java"); - updateLanguageMapping(".as", "javascript"); - updateLanguageMapping(".js", "javascript"); - updateLanguageMapping(".cs", "csharp"); - updateLanguageMapping(".d", "d"); - updateLanguageMapping(".php", "php"); - updateLanguageMapping(".php4", "php"); - updateLanguageMapping(".php5", "php"); - updateLanguageMapping(".inc", "php"); - updateLanguageMapping(".phtml", "php"); - updateLanguageMapping(".m", "objective-c"); - updateLanguageMapping(".M", "objective-c"); - updateLanguageMapping(".mm", "objective-c"); - updateLanguageMapping(".py", "python"); - updateLanguageMapping(".f", "fortran"); - updateLanguageMapping(".for", "fortran"); - updateLanguageMapping(".f90", "fortran"); - updateLanguageMapping(".vhd", "vhdl"); - updateLanguageMapping(".vhdl", "vhdl"); - updateLanguageMapping(".tcl", "tcl"); - updateLanguageMapping(".ucf", "vhdl"); - updateLanguageMapping(".qsf", "vhdl"); + updateLanguageMapping(".idl", "idl"); + updateLanguageMapping(".ddl", "idl"); + updateLanguageMapping(".odl", "idl"); + updateLanguageMapping(".java", "java"); + updateLanguageMapping(".as", "javascript"); + updateLanguageMapping(".js", "javascript"); + updateLanguageMapping(".cs", "csharp"); + updateLanguageMapping(".d", "d"); + updateLanguageMapping(".php", "php"); + updateLanguageMapping(".php4", "php"); + updateLanguageMapping(".php5", "php"); + updateLanguageMapping(".inc", "php"); + updateLanguageMapping(".phtml", "php"); + updateLanguageMapping(".m", "objective-c"); + updateLanguageMapping(".M", "objective-c"); + updateLanguageMapping(".mm", "objective-c"); + updateLanguageMapping(".py", "python"); + updateLanguageMapping(".f", "fortran"); + updateLanguageMapping(".for", "fortran"); + updateLanguageMapping(".f90", "fortran"); + updateLanguageMapping(".vhd", "vhdl"); + updateLanguageMapping(".vhdl", "vhdl"); + updateLanguageMapping(".tcl", "tcl"); + updateLanguageMapping(".ucf", "vhdl"); + updateLanguageMapping(".qsf", "vhdl"); + updateLanguageMapping(".md", "md"); + updateLanguageMapping(".markdown", "md"); //updateLanguageMapping(".xml", "dbusxml"); } @@ -7239,3 +7216,4 @@ QCString correctURL(const QCString &url,const QCString &relPath) return result; } +//--------------------------------------------------------------------------- @@ -89,20 +89,21 @@ class TextGeneratorOLImpl : public TextGeneratorIntf enum SrcLangExt { - SrcLangExt_Unknown = 0x0000, - SrcLangExt_IDL = 0x0008, - SrcLangExt_Java = 0x0010, - SrcLangExt_CSharp = 0x0020, - SrcLangExt_D = 0x0040, - SrcLangExt_PHP = 0x0080, - SrcLangExt_ObjC = 0x0100, - SrcLangExt_Cpp = 0x0200, - SrcLangExt_JS = 0x0400, - SrcLangExt_Python = 0x0800, - SrcLangExt_Fortran = 0x1000, - SrcLangExt_VHDL = 0x2000, - SrcLangExt_XML = 0x4000, - SrcLangExt_Tcl = 0x8000 + SrcLangExt_Unknown = 0x00000, + SrcLangExt_IDL = 0x00008, + SrcLangExt_Java = 0x00010, + SrcLangExt_CSharp = 0x00020, + SrcLangExt_D = 0x00040, + SrcLangExt_PHP = 0x00080, + SrcLangExt_ObjC = 0x00100, + SrcLangExt_Cpp = 0x00200, + SrcLangExt_JS = 0x00400, + SrcLangExt_Python = 0x00800, + SrcLangExt_Fortran = 0x01000, + SrcLangExt_VHDL = 0x02000, + SrcLangExt_XML = 0x04000, + SrcLangExt_Tcl = 0x08000, + SrcLangExt_Markdown = 0x10000 }; QCString langToString(SrcLangExt lang); @@ -306,7 +307,8 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, const char *fileName,int startLine, const QList<ListItemInfo> *sli, GroupDef *gd=0, - TagInfo *tagInfo=0 + TagInfo *tagInfo=0, + SrcLangExt lang=SrcLangExt_Unknown ); QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscore=FALSE); @@ -415,5 +417,7 @@ QCString extractBlock(const QCString text,const QCString marker); QCString correctURL(const QCString &url,const QCString &relPath); +QCString processMarkup(const QCString &s); + #endif diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 4500140..9aaeb02 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -451,7 +451,14 @@ static void generateFuncLink(CodeOutputInterface &ol,MemberDef* mdef) static void generateMemLink(CodeOutputInterface &ol,QCString &clName,QCString& memberName) { - if (clName.isEmpty() || memberName.isEmpty()) return; + if (memberName.isEmpty()) return; + if (clName.isEmpty()) + { + codifyLines(memberName.data()); + + return; + } + QCString className=clName; MemberDef *md=0; @@ -826,7 +833,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI cc=t1.at(index); } - QCString s1=(QCString)ql[0]; + QCString s1=t1; s1=s1.stripWhiteSpace(); // if (!g_PortMapComp.isEmpty()) diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 06a5c8c..43f8054 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2010 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -16,7 +16,7 @@ * Parser for VHDL subset * written by M. Kreis * supports VHDL-87/93/2002 - * does not support VHDL-AMS + * does not support VHDL-AMS ******************************************************************************/ // global includes @@ -49,21 +49,21 @@ #define theTranslator_vhdlType VhdlDocGen::trVhdlType -static QDict<QCString> g_vhdlKeyDict0(17,FALSE); -static QDict<QCString> g_vhdlKeyDict1(17,FALSE); +static QDict<QCString> g_vhdlKeyDict0(17,FALSE); +static QDict<QCString> g_vhdlKeyDict1(17,FALSE); static QDict<QCString> g_vhdlKeyDict2(17,FALSE); static QDict<QCString> g_xilinxUcfDict(17,FALSE); static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCString & fileName,QCString & brief); static void writeUCFLink(const MemberDef* mdef,OutputList &ol); -static void assignConfiguration(ConfNode* ,QCString); +static void assignConfiguration(ConfNode* ,QCString); static void assignBinding(ConfNode* conf,QCString label); static void addInstance(ClassDef* entity, ClassDef* arch, ClassDef *inst,Entry *cur,ClassDef* archBind=NULL); #if 0 static ConfNode* findConfiguration(QCString config) -{ +{ QList<ConfNode> confList= getVhdlConfiguration(); uint size=confList.count(); if (size==0) return NULL; @@ -72,7 +72,7 @@ static ConfNode* findConfiguration(QCString config) { ConfNode* conf= (ConfNode *)confList.at(i); QCString entity=VhdlDocGen::getIndexWord(conf->confVhdl.data(),1); - if (entity==config) + if (entity==config) { return conf; } @@ -92,10 +92,10 @@ VhdlDocGen::~VhdlDocGen() void VhdlDocGen::init() { - + // vhdl keywords inlcuded VHDL 2008 -const char* g_vhdlKeyWordMap0[] = -{ +const char* g_vhdlKeyWordMap0[] = +{ "abs","access","after","alias","all","and","architecture","array","assert","assume","assume_guarantee","attribute", "begin","block","body","buffer","bus", "case","component","configuration","constant","context","cover", @@ -116,19 +116,19 @@ const char* g_vhdlKeyWordMap0[] = "variable","vmode","vprop","vunit", "wait","when","while","with", "xor","xnor", - 0 + 0 }; - + // type -const char* g_vhdlKeyWordMap1[] = -{ +const char* g_vhdlKeyWordMap1[] = +{ "natural","unsigned","signed","string","boolean", "bit","bit_vector","character", "std_ulogic","std_ulogic_vector","std_logic","std_logic_vector","integer", "real","float","ufixed","sfixed","time",0 }; // logic -const char* g_vhdlKeyWordMap2[] = +const char* g_vhdlKeyWordMap2[] = { "abs","and","or","not","mod", "xor","rem","xnor","ror","rol","sla", "sll",0 @@ -166,8 +166,8 @@ const char* g_vhdlKeyWordMap2[] = }// buildKeyMap /*! - * returns the color of a keyword - */ + * returns the color of a keyword + */ QCString* VhdlDocGen::findKeyWord(const QCString& word) { @@ -203,7 +203,7 @@ ClassDef *VhdlDocGen::getClass(const char *name) { if (name==0 || name[0]=='\0') return 0; - ClassDef *cd=0; + ClassDef *cd=0; QCString temp(name); //temp=temp.lower(); temp=temp.stripWhiteSpace(); @@ -225,7 +225,7 @@ ClassDef* VhdlDocGen::getPackageName(const QCString & name) MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& memName) { - QDict<QCString> packages(17,FALSE); + QDict<QCString> packages(17,FALSE); packages.setAutoDelete(TRUE); ClassDef* cd; MemberDef *mdef=0; @@ -239,16 +239,16 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::pubMethods); if (mdef) return mdef; - // nothing found so far + // nothing found so far // if we are an architecture or package body search in entitiy - if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS || + if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS || (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) { Definition *d = cd->getOuterScope(); // searching upper/lower case names - QCString tt=d->name(); + QCString tt=d->name(); ClassDef *ecd =getClass(tt); if (!ecd) { @@ -258,7 +258,7 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem if (!ecd) { tt=tt.lower(); - ecd =getClass(tt); + ecd =getClass(tt); } if (ecd) //d && d->definitionType()==Definition::TypeClass) @@ -272,10 +272,10 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem //cd=getClass(getClassName(cd)); //if (!cd) return 0; } - // nothing found , so we are now searching all included packages + // nothing found , so we are now searching all included packages VhdlDocGen::findAllPackages(className,packages); //cd=getClass(className.data()); - if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS || + if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS || (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) { Definition *d = cd->getOuterScope(); @@ -290,12 +290,12 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem if (!ecd) { tt=tt.lower(); - ecd =getClass(tt); + ecd =getClass(tt); } if (ecd) //d && d->definitionType()==Definition::TypeClass) { - VhdlDocGen::findAllPackages(ecd->className(),packages); + VhdlDocGen::findAllPackages(ecd->className(),packages); } } @@ -314,11 +314,11 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem if (!cd) { *curString=curString->lower(); - cd=VhdlDocGen::getPackageName(*curString); + cd=VhdlDocGen::getPackageName(*curString); } } if (cd) - { + { mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::variableMembers); if (mdef) return mdef; mdef=VhdlDocGen::findMemberDef(cd,memName,MemberList::pubMethods); @@ -335,7 +335,7 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList::ListType type) { - // return cd->getMemberByName(key);//does not work + // return cd->getMemberByName(key);//does not work MemberDef *md=0; MemberList *ml= cd->getMemberList(type); @@ -349,7 +349,7 @@ MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList { return md; } - } + } return 0; }//findMemberDef @@ -362,7 +362,7 @@ void VhdlDocGen::findAllPackages(const QCString& className,QDict<QCString>& qdic ClassDef *cdef=getClass(className); if (cdef) { - MemberList *mem=cdef->getMemberList(MemberList::variableMembers); + MemberList *mem=cdef->getMemberList(MemberList::variableMembers); MemberDef *md; if (mem) @@ -377,8 +377,8 @@ void VhdlDocGen::findAllPackages(const QCString& className,QDict<QCString>& qdic QCString p(md->name().data()); //p=p.lower(); ClassDef* cd=VhdlDocGen::getPackageName(*temp1); - if (cd) - { + if (cd) + { QCString *ss=qdict.find(*temp1); if (ss==0) { @@ -414,7 +414,7 @@ MemberDef* VhdlDocGen::findFunction(const QList<Argument> &ql, else funcType=VhdlDocGen::FUNCTION; - MemberList *mem=cdef->getMemberList(MemberList::pubMethods); + MemberList *mem=cdef->getMemberList(MemberList::pubMethods); if (mem) { @@ -456,15 +456,15 @@ MemberDef* VhdlDocGen::findFunction(const QList<Argument> &ql, } // for if (equ==0) return mdef; }//if - }//for - }//if + }//for + }//if return mdef; } //findFunction -/*! +/*! * returns the class title+ref */ @@ -489,13 +489,13 @@ QCString VhdlDocGen::getClassName(const ClassDef* cd) if (cd==0) return ""; if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS) - { + { temp=cd->name(); temp.stripPrefix("_"); return temp; - } + } //if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::ARCHITECTURECLASS) - //{ + //{ // QStringList qlist=QStringList::split("-",cd->className(),FALSE); // if (qlist.count()>1) // return (QCString)qlist[1]; @@ -504,7 +504,7 @@ QCString VhdlDocGen::getClassName(const ClassDef* cd) return substitute(cd->className(),"::","."); } -/*! +/*! * writes an inline link form entity|package to architecture|package body and vice verca */ @@ -524,22 +524,22 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) type+=theTranslator_vhdlType(VhdlDocGen::PACKAGE,TRUE); else if (ii==VhdlDocGen::PACKAGE) type+=theTranslator_vhdlType(VhdlDocGen::PACKAGE_BODY,TRUE); - else + else type+=""; - //type=type.lower(); + //type=type.lower(); type+=" >> "; - ol.disable(OutputGenerator::RTF); + ol.disable(OutputGenerator::RTF); ol.disable(OutputGenerator::Man); ol.lineBreak(); ol.lineBreak(); - if (ii==VhdlDocGen::PACKAGE_BODY) + if (ii==VhdlDocGen::PACKAGE_BODY) { nn.stripPrefix("_"); cd=getClass(nn.data()); } - else if (ii==VhdlDocGen::PACKAGE) + else if (ii==VhdlDocGen::PACKAGE) { nn.prepend("_"); cd=getClass(nn.data()); @@ -549,11 +549,11 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) QStringList qlist=QStringList::split("-",nn,FALSE); nn=qlist[1]; cd=VhdlDocGen::getClass(nn.data()); - } + } QCString opp; if (ii==VhdlDocGen::ENTITY) - { + { VhdlDocGen::findAllArchitectures(ql,cd); int j=ql.count(); for (int i=0;i<j;i++) @@ -567,10 +567,10 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol) ClassDef*cc = getClass(temp->data()); if (cc) { - VhdlDocGen::writeVhdlLink(cc,ol,type,s2,s1); + VhdlDocGen::writeVhdlLink(cc,ol,type,s2,s1); } - } - } + } + } else { VhdlDocGen::writeVhdlLink(cd,ol,type,nn,opp); @@ -595,12 +595,12 @@ void VhdlDocGen::findAllArchitectures(QList<QCString>& qll,const ClassDef *cd) { QStringList ql=QStringList::split("-",jj,FALSE); QCString temp=(QCString)ql[1]; - if (stricmp(cd->className().data(),temp.data())==0) + if (stricmp(cd->className().data(),temp.data())==0) { QCString *cl=new QCString(jj.data()); qll.insert(0,cl); } - } + } }// for }//findAllArchitectures @@ -617,7 +617,7 @@ ClassDef* VhdlDocGen::findArchitecture(const ClassDef *cd) if (ql.count()>1) { if ((QCString)ql[0]==nn ) - { + { return citer; } } @@ -625,7 +625,7 @@ ClassDef* VhdlDocGen::findArchitecture(const ClassDef *cd) return 0; } /* - * writes the link entity >> .... or architecture >> ... + * writes the link entity >> .... or architecture >> ... */ void VhdlDocGen::writeVhdlLink(const ClassDef* ccd ,OutputList& ol,QCString& type,QCString& nn,QCString& behav) @@ -638,7 +638,7 @@ void VhdlDocGen::writeVhdlLink(const ClassDef* ccd ,OutputList& ol,QCString& typ nn.stripPrefix("_"); ol.writeObjectLink(ccd->getReference(),ccd->getOutputFileBase(),0,nn.data()); - if (!behav.isEmpty()) + if (!behav.isEmpty()) { behav.prepend(" "); ol.startBold(); @@ -659,7 +659,7 @@ bool VhdlDocGen::compareString(const QCString& s1,const QCString& s2) /*! - * strips the "--" prefixes of vhdl comments + * strips the "--" prefixes of vhdl comments */ void VhdlDocGen::prepareComment(QCString& qcs) { @@ -667,7 +667,7 @@ void VhdlDocGen::prepareComment(QCString& qcs) const char* s="--!"; //const char *start="--!{"; //const char *end="--!}"; - int index=0; + int index=0; while (TRUE) { @@ -699,24 +699,24 @@ void VhdlDocGen::parseFuncProto(const char* text,QList<Argument>& qlist, index=s1.find("("); end=s1.findRev(")"); - if ((end-index)>0) + if ((end-index)>0) { QCString tt=s1.mid(index,(end-index+1)); temp=s1.mid(index+1,(end-index-1)); //getFuncParams(qlist,temp); - } + } if (doc) { name=s1.left(index); name=name.stripWhiteSpace(); - if ((end-index)>0) - { + if ((end-index)>0) + { ret="function"; - } + } return; } else - { + { QCString s1(text); s1=s1.stripWhiteSpace(); int i=s1.find("(",0,FALSE); @@ -776,7 +776,7 @@ QCString VhdlDocGen::trTypeString(int type) { switch(type) { - case VhdlDocGen::LIBRARY: return "Library"; + case VhdlDocGen::LIBRARY: return "Library"; case VhdlDocGen::ENTITY: return "Entity"; case VhdlDocGen::PACKAGE_BODY: return "Package Body"; case VhdlDocGen::ATTRIBUTE: return "Attribute"; @@ -794,22 +794,22 @@ QCString VhdlDocGen::trTypeString(int type) case VhdlDocGen::PROCESS: return "Process"; case VhdlDocGen::PORT: return "Port"; case VhdlDocGen::GENERIC: return "Generic"; - case VhdlDocGen::UNITS: return "Units"; - //case VhdlDocGen::PORTMAP: return "Port Map"; - case VhdlDocGen::SHAREDVARIABLE: return "Shared Variable"; - case VhdlDocGen::GROUP: return "Group"; - case VhdlDocGen::VFILE: return "File"; - case VhdlDocGen::COMPONENT_INST: return "Component Instantiation"; + case VhdlDocGen::UNITS: return "Units"; + //case VhdlDocGen::PORTMAP: return "Port Map"; + case VhdlDocGen::SHAREDVARIABLE: return "Shared Variable"; + case VhdlDocGen::GROUP: return "Group"; + case VhdlDocGen::VFILE: return "File"; + case VhdlDocGen::INSTANTIATION: return "Instantiation"; case VhdlDocGen::ALIAS: return "Alias"; - case VhdlDocGen::CONFIG: return "Configuration"; - case VhdlDocGen::MISCELLANEOUS: return "Miscellaneous"; - case VhdlDocGen::UCF_CONST: return "Constraints"; + case VhdlDocGen::CONFIG: return "Configuration"; + case VhdlDocGen::MISCELLANEOUS: return "Miscellaneous"; + case VhdlDocGen::UCF_CONST: return "Constraints"; default: return ""; } } // convertType /*! - * deletes a char backwards in a string + * deletes a char backwards in a string */ bool VhdlDocGen::deleteCharRev(QCString &s,char c) @@ -829,14 +829,14 @@ void VhdlDocGen::deleteAllChars(QCString &s,char c) int index=s.findRev(c,-1,FALSE); while (index > -1) { - QString qcs=s.remove(index,1); + QString qcs=s.remove(index,1); s=qcs; index=s.findRev(c,-1,FALSE); - } + } } -static int recordCounter=0; +static int recordCounter=0; /*! * returns the next number of a record|unit member @@ -865,12 +865,13 @@ QCString VhdlDocGen::getProcessNumber() } /*! - * writes a colored and formatted string + * writes a colored and formatted string */ -void VhdlDocGen::writeFormatString(QCString& qcs,OutputList&ol,const MemberDef* mdef) +void VhdlDocGen::writeFormatString(const QCString& s,OutputList&ol,const MemberDef* mdef) { QRegExp reg("[\\[\\]\\.\\/\\:\\<\\>\\:\\s\\,\\;\\'\\+\\-\\*\\|\\&\\=\\(\\)\"]"); + QCString qcs = s; qcs+=QCString(" ");// parsing the last sign QCString *ss; QCString find=qcs; @@ -917,9 +918,9 @@ void VhdlDocGen::writeFormatString(QCString& qcs,OutputList&ol,const MemberDef* int ii=find.find('"',2); if (ii>1) { - QCString com=find.left(ii+1); + QCString com=find.left(ii+1); VhdlDocGen::startFonts(com,"keyword",ol); - temp=find.remove(0,ii+1); + temp=find.remove(0,ii+1); } } else @@ -931,7 +932,7 @@ void VhdlDocGen::writeFormatString(QCString& qcs,OutputList&ol,const MemberDef* }//if else { - VhdlDocGen::startFonts(find,"vhdlchar",ol); + VhdlDocGen::startFonts(find,"vhdlchar",ol); } ol.endBold(); }// writeFormatString @@ -947,7 +948,7 @@ bool VhdlDocGen::isNumber(const QCString& s) if (s.isEmpty()) return FALSE; int j,len; j = regg.match(s.data(),0,&len); - if ((j==0) && (len==(int)s.length())) return TRUE; + if ((j==0) && (len==(int)s.length())) return TRUE; return FALSE; }// isNumber @@ -960,13 +961,14 @@ void VhdlDocGen::startFonts(const QCString& q, const char *keyword,OutputList& o } /*! - * inserts white spaces for better readings + * inserts white spaces for better readings * and writes a colored string to the output */ -void VhdlDocGen::formatString(QCString & qcs, OutputList& ol,const MemberDef* mdef) -{ - QCString temp(qcs.length()); +void VhdlDocGen::formatString(const QCString &s, OutputList& ol,const MemberDef* mdef) +{ + QCString qcs = s; + QCString temp(qcs.length()); qcs.stripPrefix(":"); qcs.stripPrefix("is"); qcs.stripPrefix("IS"); @@ -983,30 +985,30 @@ void VhdlDocGen::formatString(QCString & qcs, OutputList& ol,const MemberDef* md char c=qcs[j]; char b=c; if (j>0) b=qcs[j-1]; - if (c=='"' || c==',' || c=='\''|| c=='(' || c==')' || c==':' || c=='[' || c==']' ) // || (c==':' && b!='=')) // || (c=='=' && b!='>')) + if (c=='"' || c==',' || c=='\''|| c=='(' || c==')' || c==':' || c=='[' || c==']' ) // || (c==':' && b!='=')) // || (c=='=' && b!='>')) { if (temp.at(index-1) != ' ') { temp+=" "; } temp+=c; - temp+=" "; + temp+=" "; } - else if (c=='=') + else if (c=='=') { if (b==':') // := operator - { + { temp.replace(index-1,1,"="); - temp+=" "; + temp+=" "; } else // = operator { - temp+=" "; + temp+=" "; temp+=c; - temp+=" "; + temp+=" "; } } - else + else { temp+=c; } @@ -1028,7 +1030,7 @@ void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList* al,const Argument *arg; bool sem=FALSE; int len=al->count(); - ol.docify("( "); + ol.docify("( "); if (len > 2) { ol.lineBreak(); @@ -1044,7 +1046,7 @@ void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList* al,const QCString *str=VhdlDocGen::findKeyWord(arg->defval); arg->defval+=" "; - if (str) + if (str) { VhdlDocGen::startFonts(arg->defval,str->data(),ol); } @@ -1053,7 +1055,7 @@ void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList* al,const VhdlDocGen::startFonts(arg->defval,"vhdlchar",ol); // write type (variable,constant etc.) } - VhdlDocGen::startFonts(nn,"vhdlchar",ol); // write name + VhdlDocGen::startFonts(nn,"vhdlchar",ol); // write name if (stricmp(arg->attrib.data(),arg->type.data()) != 0) VhdlDocGen::startFonts(arg->attrib.lower(),"stringliteral",ol); // write in|out ol.docify(" "); @@ -1061,13 +1063,13 @@ void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList* al,const sem=TRUE; ol.endBold(); if (len > 2) - { + { ol.lineBreak(); ol.docify(" "); } }//for - ol.docify(" )"); + ol.docify(" )"); } @@ -1084,7 +1086,7 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList* al,const bool sem=FALSE; int len=al->count(); ol.startBold(); - ol.docify(" ( "); + ol.docify(" ( "); ol.endBold(); if (len>2) { @@ -1093,20 +1095,26 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList* al,const for (;(arg=ali.current());++ali) { ol.startBold(); + QCString att=arg->defval; + bool bGen=att.stripPrefix("gen!"); + if (sem && len < 3) { ol.docify(" , "); } - QCString att=arg->defval; - if (!att.isEmpty()) - { + + if (bGen) { + VhdlDocGen::formatString(QCString("generic "),ol,mdef); + } + if (!att.isEmpty()) + { QCString *str=VhdlDocGen::findKeyWord(att); att+=" "; if (str) VhdlDocGen::formatString(att,ol,mdef); else - VhdlDocGen::startFonts(att,"vhdlchar",ol); - } + VhdlDocGen::startFonts(att,"vhdlchar",ol); + } QCString nn=arg->name; nn+=": "; @@ -1118,30 +1126,32 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList* al,const if (str) VhdlDocGen::formatString(w,ol,mdef); else - VhdlDocGen::startFonts(w,"vhdlchar",ol); + VhdlDocGen::startFonts(w,"vhdlchar",ol); if (arg->attrib) VhdlDocGen::startFonts(arg->attrib,"vhdlchar",ol); - sem=TRUE; + sem=TRUE; ol.endBold(); - if (len > 2) + if (len > 2) { ol.lineBreak(); } } - ol.startBold(); - ol.docify(" )"); + ol.startBold(); + ol.docify(" )"); const char *exp=mdef->excpString(); if (exp) { ol.insertMemberAlign(); + ol.startBold(); ol.docify("[ "); ol.docify(exp); ol.docify(" ]"); + ol.endBold(); } - ol.endBold(); + ol.endBold(); } /*! @@ -1155,17 +1165,19 @@ void VhdlDocGen::writeProcessProto(OutputList& ol,const ArgumentList* al,const M Argument *arg; bool sem=FALSE; ol.startBold(); - ol.docify(" ( "); + ol.docify(" ( "); for (;(arg=ali.current());++ali) { if (sem) + { ol.docify(" , "); + } QCString nn=arg->name; // VhdlDocGen::startFonts(nn,"vhdlchar",ol); VhdlDocGen::writeFormatString(nn,ol,mdef); - sem=TRUE; - } - ol.docify(" )"); + sem=TRUE; + } + ol.docify(" )"); ol.endBold(); } @@ -1175,13 +1187,13 @@ void VhdlDocGen::writeProcessProto(OutputList& ol,const ArgumentList* al,const M */ void VhdlDocGen::writeFuncProcDocu( - const MemberDef *md, + const MemberDef *md, OutputList& ol, const ArgumentList* al, bool /*type*/) { if (al==0) return; - bool sem=FALSE; + bool sem=FALSE; ol.enableAll(); ArgumentListIterator ali(*al); @@ -1191,24 +1203,30 @@ void VhdlDocGen::writeFuncProcDocu( ol.docify(" ( ) "); return; } - ol.startParameterList(TRUE); + ol.startParameterList(TRUE); //ol.startParameterName(FALSE); Argument *arg; bool first=TRUE; for (;(arg=ali.current());++ali) - { - ol.startParameterType(first,""); + { + ol.startParameterType(first,""); // if (first) ol.writeChar('('); + QCString attl=arg->defval; + bool bGen=attl.stripPrefix("gen!"); + if (bGen) + VhdlDocGen::writeFormatString(QCString("generic "),ol,md); + + if (VhdlDocGen::isProcedure(md)) { startFonts(arg->defval,"keywordtype",ol); ol.docify(" "); - } + } ol.endParameterType(); ol.startParameterName(TRUE); VhdlDocGen::writeFormatString(arg->name,ol,md); - ol.docify(" "); + ol.docify(" : "); if (VhdlDocGen::isProcedure(md)) { @@ -1225,15 +1243,16 @@ void VhdlDocGen::writeFuncProcDocu( ol.enable(OutputGenerator::Man); if (!VhdlDocGen::isProcess(md)) { - startFonts(arg->type,"vhdlkeyword",ol); + // startFonts(arg->type,"vhdlkeyword",ol); + VhdlDocGen::writeFormatString(arg->type,ol,md); } ol.disable(OutputGenerator::Man); ol.endEmphasis(); ol.enable(OutputGenerator::Man); - if (--index) + if (--index) { - ol.docify(" , "); + ol.docify(" , "); } else { @@ -1243,10 +1262,10 @@ void VhdlDocGen::writeFuncProcDocu( } ol.endParameterName(FALSE,FALSE,FALSE); - sem=TRUE; + sem=TRUE; first=FALSE; } - //ol.endParameterList(); + //ol.endParameterList(); } // writeDocFunProc @@ -1267,7 +1286,7 @@ QCString VhdlDocGen::convertArgumentListToString(const ArgumentList* al,bool fun { argString+=arg->name; argString+=":"; - argString+=arg->type; + argString+=arg->type; } else { @@ -1275,7 +1294,7 @@ QCString VhdlDocGen::convertArgumentListToString(const ArgumentList* al,bool fun argString+=arg->name+" :"; argString+=arg->attrib+" "; argString+=arg->type; - } + } sem=TRUE; } return argString; @@ -1318,11 +1337,11 @@ void VhdlDocGen::writeVhdlDeclarations(MemberList* ml, VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::SHAREDVARIABLE,FALSE),0,FALSE,VhdlDocGen::SHAREDVARIABLE); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::VFILE,FALSE),0,FALSE,VhdlDocGen::VFILE); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::GROUP,FALSE),0,FALSE,VhdlDocGen::GROUP); - VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::COMPONENT_INST,FALSE),0,FALSE,VhdlDocGen::COMPONENT_INST); + VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::INSTANTIATION,FALSE),0,FALSE,VhdlDocGen::INSTANTIATION); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::ALIAS,FALSE),0,FALSE,VhdlDocGen::ALIAS); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::MISCELLANEOUS),0,FALSE,VhdlDocGen::MISCELLANEOUS); - // configurations must be added to global file definitions. + // configurations must be added to global file definitions. VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::CONFIG,FALSE),0,FALSE,VhdlDocGen::CONFIG); VhdlDocGen::writeVHDLDeclarations(ml,ol,cd,nd,fd,gd,theTranslator_vhdlType(VhdlDocGen::UCF_CONST,FALSE),0,FALSE,VhdlDocGen::UCF_CONST); @@ -1337,26 +1356,30 @@ static void setGlobalType(MemberList *ml) { QCString l=mdd->typeString(); - if (strcmp(mdd->argsString(),"configuration")==0) + if (strcmp(mdd->argsString(),"package")==0) { - mdd->setMemberSpecifiers(VhdlDocGen::CONFIG); + mdd->setMemberSpecifiers(VhdlDocGen::INSTANTIATION); + } + else if (strcmp(mdd->argsString(),"configuration")==0) + { + mdd->setMemberSpecifiers(VhdlDocGen::CONFIG); } else if (strcmp(mdd->typeString(),"library")==0) { - mdd->setMemberSpecifiers(VhdlDocGen::LIBRARY); + mdd->setMemberSpecifiers(VhdlDocGen::LIBRARY); } - else if (strcmp(mdd->typeString(),"package")==0) + else if (strcmp(mdd->typeString(),"use")==0) { - mdd->setMemberSpecifiers(VhdlDocGen::USE); - } + mdd->setMemberSpecifiers(VhdlDocGen::USE); + } else if (stricmp(mdd->typeString(),"misc")==0) { - mdd->setMemberSpecifiers(VhdlDocGen::MISCELLANEOUS); - } + mdd->setMemberSpecifiers(VhdlDocGen::MISCELLANEOUS); + } else if (stricmp(mdd->typeString(),"ucf_const")==0) { - mdd->setMemberSpecifiers(VhdlDocGen::UCF_CONST); - } + mdd->setMemberSpecifiers(VhdlDocGen::UCF_CONST); + } } } @@ -1368,7 +1391,7 @@ void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit if (cd==0) return; QCString ttype=mdef->typeString(); - QCString largs=mdef->argsString(); + QCString largs=mdef->argsString(); if ((VhdlDocGen::isVhdlFunction(mdef) || VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isProcess(mdef))) { @@ -1376,12 +1399,12 @@ void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit nn=nn.stripWhiteSpace(); QCString na=cd->name(); MemberDef* memdef=VhdlDocGen::findMember(na,nn); - if (memdef && memdef->isLinkable()) - { + if (memdef && memdef->isLinkable()) + { ol.docify(" "); ol.startBold(); - //ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,mdef->typeString()); + //ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,mdef->typeString()); writeLink(memdef,ol); ol.endBold(); ol.docify(" "); @@ -1390,7 +1413,7 @@ void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit { ol.docify(" "); VhdlDocGen::formatString(ttype,ol,mdef); - ol.docify(" "); + ol.docify(" "); } ol.docify(mdef->name()); VhdlDocGen::writeFuncProcDocu(mdef,ol, mdef->argumentList().pointer()); @@ -1412,24 +1435,26 @@ void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit return; } else - { + { writeLink(mdef,ol); ol.docify(" "); // ttype=mdef->typeString(); } - // QCString largs=mdef->argsString(); + // QCString largs=mdef->argsString(); + bool c=largs=="context"; + bool brec=largs.stripPrefix("record") ; - bool brec=largs.stripPrefix("record"); - - if (!brec) + if (!brec && !c) VhdlDocGen::formatString(ttype,ol,mdef); - if (brec || largs.stripPrefix("units")) - { + if (c || brec || largs.stripPrefix("units")) + { + if (c) + largs=ttype; VhdlDocGen::writeRecUnitDocu(mdef,ol,largs); - return; + return; } ol.docify(" "); @@ -1446,7 +1471,7 @@ void VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definit void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, - bool /*inGroup*/) + bool /*inGroup*/) { static QRegExp reg("[%]"); LockingPtr<MemberDef> lock(mdef,mdef); @@ -1465,14 +1490,14 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, */ - ASSERT(cd!=0 || nd!=0 || fd!=0 || gd!=0 || - mdef->getMemberSpecifiers()==VhdlDocGen::LIBRARY || - mdef->getMemberSpecifiers()==VhdlDocGen::USE + ASSERT(cd!=0 || nd!=0 || fd!=0 || gd!=0 || + mdef->getMemberSpecifiers()==VhdlDocGen::LIBRARY || + mdef->getMemberSpecifiers()==VhdlDocGen::USE ); // member should belong to something - if (cd) d=cd; - else if (nd) d=nd; - else if (fd) d=fd; - else if (gd) d=gd; + if (cd) d=cd; + else if (nd) d=nd; + else if (fd) d=fd; + else if (gd) d=gd; else d=(Definition*)mdef; // write tag file information of this member @@ -1497,7 +1522,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, if (VhdlDocGen::isVariable(mdef)) Doxygen::tagFile << "shared variable"; if (VhdlDocGen::isFile(mdef)) Doxygen::tagFile << "file"; if (VhdlDocGen::isGroup(mdef)) Doxygen::tagFile << "group"; - if (VhdlDocGen::isCompInst(mdef)) Doxygen::tagFile << "component instantiation"; + if (VhdlDocGen::isCompInst(mdef)) Doxygen::tagFile << " instantiation"; if (VhdlDocGen::isAlias(mdef)) Doxygen::tagFile << "alias"; if (VhdlDocGen::isCompInst(mdef)) Doxygen::tagFile << "configuration"; @@ -1561,7 +1586,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, // *** write type /*VHDL CHANGE */ bool bRec,bUnit; - QCString ltype(mdef->typeString()); + QCString ltype(mdef->typeString()); ltype=ltype.replace(reg," "); QCString largs(mdef->argsString()); largs=largs.replace(reg," "); @@ -1572,7 +1597,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, ClassDef *kl=0; LockingPtr<ArgumentList> alp = mdef->argumentList(); QCString nn; - + VhdlDocGen::adjustRecordMember(mdef) ; if (gd) gd=0; switch(mm) { @@ -1580,7 +1605,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, VhdlDocGen::writeCodeFragment(mdef,ol); break; case VhdlDocGen::PROCEDURE: - case VhdlDocGen::FUNCTION: + case VhdlDocGen::FUNCTION: ol.startBold(); VhdlDocGen::formatString(ltype,ol,mdef); ol.endBold(); @@ -1598,7 +1623,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, case VhdlDocGen::USE: kl=VhdlDocGen::getClass(mdef->name()); if (kl && ((VhdlDocGen::VhdlClasses)kl->protection()==VhdlDocGen::ENTITYCLASS)) break; - writeLink(mdef,ol); + writeLink(mdef,ol); ol.insertMemberAlign(); ol.docify(" "); @@ -1610,7 +1635,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, ol.docify(" "); QCString name=theTranslator_vhdlType(VhdlDocGen::PACKAGE,TRUE); ol.startBold(); - ol.docify(name.data()); + ol.docify(name.data()); name.resize(0); ol.endBold(); name+=" <"+mdef->name()+">"; @@ -1622,11 +1647,16 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, case VhdlDocGen::LIBRARY: writeLink(mdef,ol); ol.insertMemberAlign(); - break; + if (largs=="context") + { + VhdlDocGen::writeRecorUnit(ltype,ol,mdef); + } + + break; case VhdlDocGen::GENERIC: case VhdlDocGen::PORT: - case VhdlDocGen::ALIAS: + case VhdlDocGen::ALIAS: writeLink(mdef,ol); ol.docify(" "); @@ -1648,17 +1678,28 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, } break; case VhdlDocGen::PROCESS: - writeLink(mdef,ol); + writeLink(mdef,ol); ol.insertMemberAlign(); VhdlDocGen::writeProcessProto(ol,alp.pointer(),mdef); break; case VhdlDocGen::PACKAGE: case VhdlDocGen::ENTITY: case VhdlDocGen::COMPONENT: - case VhdlDocGen::COMPONENT_INST: + case VhdlDocGen::INSTANTIATION: case VhdlDocGen::CONFIG: if (VhdlDocGen::isCompInst(mdef) ) { + nn=largs; + if(nn.stripPrefix("function") || nn.stripPrefix("package")) + { + VhdlDocGen::formatString(largs,ol,mdef); + ol.insertMemberAlign(); + writeLink(mdef,ol); + ol.docify(" "); + VhdlDocGen::formatString(ltype,ol,mdef); + break; + } + largs.prepend("::"); largs.prepend(mdef->name().data()); ol.writeObjectLink(mdef->getReference(), @@ -1676,7 +1717,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, ol.docify(ltype); ol.endBold(); ol.docify(" "); - if (VhdlDocGen::isComponent(mdef) || + if (VhdlDocGen::isComponent(mdef) || VhdlDocGen::isConfig(mdef) || VhdlDocGen::isCompInst(mdef)) { @@ -1690,7 +1731,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, nn=mdef->name(); } kl=getClass(nn.data()); - if (kl) + if (kl) { nn=kl->getOutputFileBase(); ol.pushGeneratorState(); @@ -1709,27 +1750,29 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, ol.endEmphasis(); ol.popGeneratorState(); } - } + } break; - case VhdlDocGen::UCF_CONST: + case VhdlDocGen::UCF_CONST: mm=mdef->name().findRev('_'); - if (mm>0) + if (mm>0) + { mdef->setName(mdef->name().left(mm)); + } writeUCFLink(mdef,ol); break; case VhdlDocGen::SIGNAL: case VhdlDocGen::ATTRIBUTE: case VhdlDocGen::SUBTYPE: - case VhdlDocGen::CONSTANT: - case VhdlDocGen::SHAREDVARIABLE: + case VhdlDocGen::CONSTANT: + case VhdlDocGen::SHAREDVARIABLE: case VhdlDocGen::VFILE: - case VhdlDocGen::GROUP: + case VhdlDocGen::GROUP: writeLink(mdef,ol); ol.docify(" "); ol.insertMemberAlign(); VhdlDocGen::formatString(ltype,ol,mdef); break; - case VhdlDocGen::TYPE: + case VhdlDocGen::TYPE: bRec=largs.stripPrefix("record") ; bUnit=largs.stripPrefix("units") ; ol.startBold(); @@ -1739,12 +1782,12 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, ol.docify("units: "); writeLink(mdef,ol); ol.insertMemberAlign(); - if (!bRec) + if (!bRec) VhdlDocGen::formatString(ltype,ol,mdef); if (bUnit) ol.lineBreak(); if (bRec || bUnit) writeRecorUnit(largs,ol,mdef); - ol.endBold(); + ol.endBold(); break; default: break; @@ -1757,7 +1800,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, } if (!ltype.isEmpty()) ol.docify(" "); - if (htmlOn) + if (htmlOn) { ol.enable(OutputGenerator::Html); } @@ -1776,7 +1819,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, ol.parseDoc(mdef->briefFile(),mdef->briefLine(), mdef->getOuterScope()?mdef->getOuterScope():d, mdef,mdef->briefDescription(),TRUE,FALSE,0,TRUE,FALSE); - if (detailsVisible) + if (detailsVisible) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1802,7 +1845,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, }// end writeVhdlDeclaration -void VhdlDocGen::writeLink(const MemberDef* mdef,OutputList &ol) +void VhdlDocGen::writeLink(const MemberDef* mdef,OutputList &ol) { ol.writeObjectLink(mdef->getReference(), mdef->getOutputFileBase(), @@ -1823,7 +1866,7 @@ void VhdlDocGen::writePlainVHDLDeclarations( MemberDef *md; MemberListIterator mli(*mlist); for ( ; (md=mli.current()); ++mli ) - { + { int mems=md->getMemberSpecifiers(); if (md->isBriefSectionVisible() && (mems==specifier) && (mems!=VhdlDocGen::LIBRARY) ) { @@ -1840,7 +1883,7 @@ void VhdlDocGen::writePlainVHDLDeclarations( } } //if } //for - if (!first) ol.endMemberList(); + if (!first) ol.endMemberList(); pack.clear(); }//plainDeclaration @@ -1874,19 +1917,19 @@ bool VhdlDocGen::membersHaveSpecificType(MemberList *ml,int type) void VhdlDocGen::writeVHDLDeclarations(MemberList* ml,OutputList &ol, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, - const char *title,const char *subtitle,bool /*showEnumValues*/,int type) + const char *title,const char *subtitle,bool /*showEnumValues*/,int type) { setGlobalType(ml); if (!membersHaveSpecificType(ml,type)) return; - if (title) + if (title) { ol.startMemberHeader(title); ol.parseText(title); ol.endMemberHeader(); ol.docify(" "); } - if (subtitle && subtitle[0]!=0) + if (subtitle && subtitle[0]!=0) { ol.startMemberSubtitle(); ol.parseDoc("[generated]",-1,0,0,subtitle,FALSE,FALSE,0,TRUE,FALSE); @@ -1929,9 +1972,9 @@ void VhdlDocGen::writeVHDLDeclarations(MemberList* ml,OutputList &ol, }// writeVHDLDeclarations /* strips the prefix for record and unit members*/ -void VhdlDocGen::adjustRecordMember(MemberDef *mdef) +void VhdlDocGen::adjustRecordMember(MemberDef *mdef) { //,OutputList & ol) { - QRegExp regg("[_a-zA-Z]"); + QRegExp regg("[_a-zA-Z\"]"); QCString nn=mdef->name(); int j=nn.find(regg,0); if (j>0) @@ -1965,84 +2008,84 @@ QCString VhdlDocGen::trVhdlType(int type,bool sing) { switch(type) { - case VhdlDocGen::LIBRARY: + case VhdlDocGen::LIBRARY: if (sing) return "Library"; - else return "Libraries"; - case VhdlDocGen::PACKAGE: - if (sing) return "Package"; + else return "Libraries"; + case VhdlDocGen::PACKAGE: + if (sing) return "Package"; else return "Packages"; - case VhdlDocGen::SIGNAL: - if (sing) return "Signal"; + case VhdlDocGen::SIGNAL: + if (sing) return "Signal"; else return "Signals"; - case VhdlDocGen::COMPONENT: - if (sing) return "Component"; - else return "Components"; - case VhdlDocGen::CONSTANT: - if (sing) return "Constant"; + case VhdlDocGen::COMPONENT: + if (sing) return "Component"; + else return "Components"; + case VhdlDocGen::CONSTANT: + if (sing) return "Constant"; else return "Constants"; - case VhdlDocGen::ENTITY: - if (sing) return "Entity"; + case VhdlDocGen::ENTITY: + if (sing) return "Entity"; else return "Entities"; - case VhdlDocGen::TYPE: - if (sing) return "Type"; + case VhdlDocGen::TYPE: + if (sing) return "Type"; else return "Types"; - case VhdlDocGen::SUBTYPE: - if (sing) return "Subtype"; + case VhdlDocGen::SUBTYPE: + if (sing) return "Subtype"; else return "Subtypes"; - case VhdlDocGen::FUNCTION: - if (sing) return "Function"; + case VhdlDocGen::FUNCTION: + if (sing) return "Function"; else return "Functions"; - case VhdlDocGen::RECORD: - if (sing) return "Record"; + case VhdlDocGen::RECORD: + if (sing) return "Record"; else return "Records"; - case VhdlDocGen::PROCEDURE: - if (sing) return "Procedure"; - else return "Procedures"; - case VhdlDocGen::ARCHITECTURE: - if (sing) return "Architecture"; + case VhdlDocGen::PROCEDURE: + if (sing) return "Procedure"; + else return "Procedures"; + case VhdlDocGen::ARCHITECTURE: + if (sing) return "Architecture"; else return "Architectures"; - case VhdlDocGen::ATTRIBUTE: - if (sing) return "Attribute"; + case VhdlDocGen::ATTRIBUTE: + if (sing) return "Attribute"; else return "Attributes"; - case VhdlDocGen::PROCESS: - if (sing) return "Process"; + case VhdlDocGen::PROCESS: + if (sing) return "Process"; else return "Processes"; - case VhdlDocGen::PORT: - if (sing) return "Port"; + case VhdlDocGen::PORT: + if (sing) return "Port"; else return "Ports"; - case VhdlDocGen::USE: - if (sing) return "use clause"; + case VhdlDocGen::USE: + if (sing) return "use clause"; else return "Use Clauses"; - case VhdlDocGen::GENERIC: - if (sing) return "Generic"; + case VhdlDocGen::GENERIC: + if (sing) return "Generic"; else return "Generics"; - case VhdlDocGen::PACKAGE_BODY: + case VhdlDocGen::PACKAGE_BODY: return "Package Body"; - case VhdlDocGen::UNITS: - return "Units"; - case VhdlDocGen::SHAREDVARIABLE: - if (sing) return "Shared Variable"; - return "Shared Variables"; - case VhdlDocGen::VFILE: - if (sing) return "File"; - return "Files"; - case VhdlDocGen::GROUP: - if (sing) return "Group"; + case VhdlDocGen::UNITS: + return "Units"; + case VhdlDocGen::SHAREDVARIABLE: + if (sing) return "Shared Variable"; + return "Shared Variables"; + case VhdlDocGen::VFILE: + if (sing) return "File"; + return "Files"; + case VhdlDocGen::GROUP: + if (sing) return "Group"; return "Groups"; - case VhdlDocGen::COMPONENT_INST: - if (sing) return "Component Instantiation"; - else return "Component Instantiations"; - case VhdlDocGen::ALIAS: - if (sing) return "Alias"; + case VhdlDocGen::INSTANTIATION: + if (sing) return "Instantiation"; + else return "Instantiations"; + case VhdlDocGen::ALIAS: + if (sing) return "Alias"; return "Aliases"; - case VhdlDocGen::CONFIG: - if (sing) return "Configuration"; + case VhdlDocGen::CONFIG: + if (sing) return "Configuration"; return "Configurations"; case VhdlDocGen::MISCELLANEOUS: - return "Miscellaneous"; - case VhdlDocGen::UCF_CONST: + return "Miscellaneous"; + case VhdlDocGen::UCF_CONST: return "Constraints"; - default: + default: return "Class"; } } @@ -2065,7 +2108,7 @@ QCString VhdlDocGen::trDesignUnitMembers() QCString VhdlDocGen::trDesignUnitListDescription() { return "Here is a list of all design unit members with links to " - "the Entities they belong to:"; + "the Entities they belong to:"; } QCString VhdlDocGen::trDesignUnitIndex() @@ -2093,11 +2136,11 @@ bool VhdlDocGen::foundInsertedComponent(const QCString & name,Entry* root) { QListIterator<BaseInfo> bii(*root->extends); BaseInfo *bi=0; - for (bii.toFirst();(bi=bii.current());++bii) + for (bii.toFirst();(bi=bii.current());++bii) { if (bi->name==name) { - return TRUE; // + return TRUE; // } } @@ -2108,24 +2151,24 @@ bool VhdlDocGen::foundInsertedComponent(const QCString & name,Entry* root) void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList& ol) { - if (mdef) + if (mdef) { ClassDef *cd=mdef->getClassDef(); if (cd) - { - QCString n=cd->name(); + { + QCString n=cd->name(); MemberDef* memdef=VhdlDocGen::findMember(n,mem); - if (memdef && memdef->isLinkable()) - { + if (memdef && memdef->isLinkable()) + { ol.startBold(); - writeLink(memdef,ol); + writeLink(memdef,ol); ol.endBold(); ol.docify(" "); return; } } } - VhdlDocGen::startFonts(mem,"vhdlchar",ol); + VhdlDocGen::startFonts(mem,"vhdlchar",ol); }// found component void VhdlDocGen::writeCodeFragment( MemberDef *mdef,OutputList& ol) @@ -2142,12 +2185,12 @@ void VhdlDocGen::writeCodeFragment( MemberDef *mdef,OutputList& ol) writeLink(mdef,ol); ol.docify(" "); ol.insertMemberAlign(); - int len= qsl.count(); + int len= qsl.count(); for(int j=0;j<len;j++) { QCString q=(QCString)qsl[j]; VhdlDocGen::writeFormatString(q,ol,mdef); - ol.lineBreak(); + ol.lineBreak(); if (j==2) // only the first three lines are shown { q = "..."; @@ -2163,7 +2206,7 @@ void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname) int start=mdef->getStartBodyLine(); QStringList qsl=QStringList::split("\n",codeFragment); ol.startCodeFragment(); - int len = qsl.count(); + int len = qsl.count(); QCString lineNumber; int j; for (j=0;j<len;j++) @@ -2176,7 +2219,7 @@ void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname) ol.insertMemberAlign(); QCString q=(QCString)qsl[j]; VhdlDocGen::writeFormatString(q,ol,mdef); - ol.docify("\n"); + ol.docify("\n"); } ol.endCodeFragment(); @@ -2217,7 +2260,7 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b while(!ucFile.isEmpty()) { - int i=ucFile.find("\n"); + int i=ucFile.find("\n"); if (i<0) break; lineNo++; QCString temp=ucFile.left(i); @@ -2232,7 +2275,7 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b brief.append("\\n"); } else if (!temp.stripPrefix("#") && !bb) - { + { if (altera) { int i=temp.find("-name"); @@ -2247,9 +2290,9 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b { QRegExp ee("[\\s=]"); int i=temp.find(ee); - QCString ff=temp.left(i); + QCString ff=temp.left(i); temp.stripPrefix(ff.data()); - ff.append("#"); + ff.append("#"); if (!temp.isEmpty()) { initUCF(entity,ff.data(),temp,lineNo,fileName,brief); @@ -2259,28 +2302,28 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b }//temp ucFile=ucFile.remove(0,i+1); - }// while + }// while } static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCString & fileName,QCString & brief) { - if (qcs.isEmpty())return; + if (qcs.isEmpty())return; QRegExp sp("\\s"); QRegExp reg("[\\s=]"); QCString n; // bool bo=(stricmp(type,qcs.data())==0); VhdlDocGen::deleteAllChars(qcs,';'); - qcs=qcs.stripWhiteSpace(); + qcs=qcs.stripWhiteSpace(); - int i= qcs.find(reg); + int i= qcs.find(reg); if (i<0) return; if (i==0) - { + { n=type; VhdlDocGen::deleteAllChars(n,'#'); type=""; - } + } else { n=qcs.left(i); @@ -2296,12 +2339,12 @@ static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCStr current->bodyLine=line; current->fileName=fileName; current->type="ucf_const"; - //if (!bo) + //if (!bo) //current->args=type; current->args+=qcs; current->lang= SrcLangExt_VHDL ; - // adding dummy name for constraints like VOLTAGE=5,TEMPERATURE=20 C + // adding dummy name for constraints like VOLTAGE=5,TEMPERATURE=20 C if (n.isEmpty()) { n="dummy"; @@ -2350,7 +2393,7 @@ QCString VhdlDocGen::splitString(QCString& str, char c) { QCString n=str; int i=str.find(c); - if (i>0) + if (i>0) { n=str.left(i); str=str.remove(0,i+1); @@ -2366,15 +2409,15 @@ bool VhdlDocGen::findConstraintFile(LayoutNavEntry *lne) LayoutNavEntry *kk = lne->parent();// find(LayoutNavEntry::Files); // LayoutNavEntry *kks = kk->parent();// find(LayoutNavEntry::Files); QCString file; - QCString co("Constraint File"); + QCString co("Constraints"); while (fn) { FileDef *fd=fn->first(); if (fd->name().contains(".ucf") || fd->name().contains(".qsf")) { file = convertNameToFile(fd->name().data(),FALSE,FALSE); - LayoutNavEntry *ucf=new LayoutNavEntry(lne,LayoutNavEntry::MainPage,TRUE,file,co,""); - kk->addChild(ucf); + LayoutNavEntry *ucf=new LayoutNavEntry(lne,LayoutNavEntry::MainPage,TRUE,file,co,""); + kk->addChild(ucf); break; } fn=Doxygen::inputNameList->next(); @@ -2383,9 +2426,9 @@ bool VhdlDocGen::findConstraintFile(LayoutNavEntry *lne) } void VhdlDocGen::writeAlphbeticalClass(OutputList& ol,const ClassDef* cd,const QCString & cname) -{ +{ if (cname.contains("::")==0) - { + { ClassDef*oo= VhdlDocGen::findArchitecture(cd); ol.writeObjectLink(cd->getReference(), cd->getOutputFileBase(),0,cname); @@ -2407,7 +2450,7 @@ QCString VhdlDocGen::parseForConfig(QCString & entity,QCString & arch) { int index; QCString label; - QCString ent("entity"); + QCString ent("entity"); if (!entity.contains(":")) return ""; QRegExp exp("[:()\\s]"); @@ -2469,13 +2512,13 @@ ClassDef* VhdlDocGen::findArchitecture(QCString identifier, QCString entity_nam //@param arch bit0:flipflop -//@param binding e.g entity work.foo(bar) -//@param label |label0|label1 -// label0:architecture name -//@param confVhdl of configuration file (identifier::entity_name) or +//@param binding e.g entity work.foo(bar) +//@param label |label0|label1 +// label0:architecture name +//@param confVhdl of configuration file (identifier::entity_name) or // the architecture if isInlineConf TRUE -//@param isInlineConf -//@param confN List of configurations +//@param isInlineConf +//@param confN List of configurations void assignBinding(ConfNode * conf,QCString label) { @@ -2518,7 +2561,7 @@ void assignBinding(ConfNode * conf,QCString label) if (!conf->isInlineConf && (archName!=cur->args)) continue; - if (cur->exception==label || conf->isInlineConf) + if (cur->exception==label || conf->isInlineConf) { QCString sign,archy; @@ -2543,10 +2586,10 @@ void assignBinding(ConfNode * conf,QCString label) arch1=ent1+"::"+arch1; //ClassDef *archBind=Doxygen::classSDict->find(arch1.data()); ClassDef *ent=Doxygen::classSDict->find(ent1.data()); - QCString inst=VhdlDocGen::getIndexWord(cur->args.data(),0); + QCString inst=VhdlDocGen::getIndexWord(cur->args.data(),0); ClassDef *cd=Doxygen::classSDict->find(inst.data()); - if (cd==0 || ent==0) + if (cd==0 || ent==0) continue; addInstance(ent,archClass,cd,cur); @@ -2582,19 +2625,19 @@ void assignConfiguration(ConfNode* rootNode,QCString label) /* // file foo.vhd -// enitity foo +// enitity foo // ..... // end entity -// file foo_arch.vhd +// file foo_arch.vhd // architecture xxx of foo is -// ........ +// ........ // end architecture */ void VhdlDocGen::computeVhdlComponentRelations() { - + QCString entity,inst,arch,vhd; QList<ConfNode> confList = getVhdlConfiguration(); @@ -2623,11 +2666,11 @@ void VhdlDocGen::computeVhdlComponentRelations() entity=cur->type; } ClassDef *classEntity=Doxygen::classSDict->find(entity); - inst=VhdlDocGen::getIndexWord(cur->args.data(),0); + inst=VhdlDocGen::getIndexWord(cur->args.data(),0); ClassDef *cd=Doxygen::classSDict->find(inst); ClassDef *ar=Doxygen::classSDict->find(cur->args); - if (cd==0 || classEntity==0 ) + if (cd==0 || classEntity==0 ) continue; addInstance(classEntity,ar,cd,cur); @@ -2635,7 +2678,7 @@ void VhdlDocGen::computeVhdlComponentRelations() } } -static void addInstance(ClassDef* classEntity, ClassDef* ar, +static void addInstance(ClassDef* classEntity, ClassDef* ar, ClassDef *cd , Entry *cur,ClassDef* /*archBind*/) { @@ -2658,18 +2701,18 @@ static void addInstance(ClassDef* classEntity, ClassDef* ar, if (ar==0) return; QCString uu=cur->name; MemberDef *md=new MemberDef( - ar->getDefFileName(), cur->startLine, + ar->getDefFileName(), cur->startLine, cur->type,uu,uu, 0, Public, Normal, cur->stat,Member, MemberDef::Variable, 0, 0); md->setLanguage(SrcLangExt_VHDL); - md->setMemberSpecifiers(VhdlDocGen::COMPONENT_INST); + md->setMemberSpecifiers(VhdlDocGen::INSTANTIATION); md->setBriefDescription(cur->brief,cur->briefFile,cur->briefLine); md->setBodySegment(cur->startLine,-1) ; FileDef *fd=ar->getFileDef(); - md->setBodyDef(fd); + md->setBodyDef(fd); ar->insertMember(md); // printf("\nMemberreference [%p]",md); } @@ -2688,7 +2731,7 @@ void VhdlDocGen::writeRecorUnit(QCString & largs,OutputList& ol ,const MemberDe void VhdlDocGen::writeRecUnitDocu( - const MemberDef *md, + const MemberDef *md, OutputList& ol, QCString largs ) @@ -2696,14 +2739,14 @@ void VhdlDocGen::writeRecUnitDocu( QStringList ql=QStringList::split("#",largs,FALSE); uint len=ql.count(); - ol.startParameterList(TRUE); + ol.startParameterList(TRUE); bool first=TRUE; for(uint i=0;i<len;i++) { QCString n=(QCString)ql[i]; - ol.startParameterType(first,""); + ol.startParameterType(first,""); VhdlDocGen::formatString(n,ol,md); - if ((len-i)>1) + if ((len-i)>1) { ol.endParameterName(FALSE,FALSE,FALSE); } @@ -2720,7 +2763,7 @@ void VhdlDocGen::writeCodeFragment(OutputList& ol,int start, QCString & codeFrag { QStringList qsl=QStringList::split("\n",codeFragment); ol.startCodeFragment(); - int len = qsl.count(); + int len = qsl.count(); QCString lineNumber; int j; for (j=0;j<len;j++) @@ -2733,7 +2776,7 @@ void VhdlDocGen::writeCodeFragment(OutputList& ol,int start, QCString & codeFrag ol.insertMemberAlign(); QCString q=(QCString)qsl[j]; VhdlDocGen::writeFormatString(q,ol,mdef); - ol.docify("\n"); + ol.docify("\n"); } ol.endCodeFragment(); } diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h index 02f1353..8850d47 100644 --- a/src/vhdldocgen.h +++ b/src/vhdldocgen.h @@ -82,23 +82,20 @@ class VhdlDocGen PORT, UNITS, GENERIC, - COMPONENT_INST, + INSTANTIATION, GROUP, VFILE, SHAREDVARIABLE, CONFIG, ALIAS, - MISCELLANEOUS, - UCF_CONST + MISCELLANEOUS, + UCF_CONST }; - - - VhdlDocGen(); virtual ~VhdlDocGen(); static void init(); - static QCString convertFileNameToClassName(QCString name); + static QCString convertFileNameToClassName(QCString name); // --- used by vhdlscanner.l ----------- static QCString getIndexWord(const char* ,int index); @@ -112,13 +109,10 @@ class VhdlDocGen bool doc=false); // ----------------------------------- - static void computeVhdlComponentRelations(); - static QCString* findKeyWord(const QCString& word); - static ClassDef* getPackageName(const QCString& name); static MemberDef* findMember(const QCString& className, const QCString& memName); @@ -137,7 +131,6 @@ class VhdlDocGen static void writeInlineClassLink(const ClassDef*, OutputList &ol); - static bool isConstraint(const MemberDef *mdef) { return mdef->getMemberSpecifiers()==VhdlDocGen::UCF_CONST; } static bool isConfig(const MemberDef *mdef) @@ -189,9 +182,9 @@ class VhdlDocGen static bool isGroup(const MemberDef *mdef) { return mdef->getMemberSpecifiers()==VhdlDocGen::GROUP; } static bool isCompInst(const MemberDef *mdef) - { return mdef->getMemberSpecifiers()==VhdlDocGen::COMPONENT_INST; } -static bool isMisc(const MemberDef *mdef) -{ return mdef->getMemberSpecifiers()==VhdlDocGen::MISCELLANEOUS; } + { return mdef->getMemberSpecifiers()==VhdlDocGen::INSTANTIATION; } + static bool isMisc(const MemberDef *mdef) + { return mdef->getMemberSpecifiers()==VhdlDocGen::MISCELLANEOUS; } //----------------------------------------------------- // translatable items @@ -220,24 +213,18 @@ static bool isMisc(const MemberDef *mdef) // trFunctions static QCString trFunctionAndProc(); - //----------------------------------------------------- static void prepareComment(QCString&); - - - - static void formatString(QCString&,OutputList& ol,const MemberDef*); + static void formatString(const QCString&,OutputList& ol,const MemberDef*); - static void writeFormatString(QCString&,OutputList& ol,const MemberDef*); + static void writeFormatString(const QCString&,OutputList& ol,const MemberDef*); static void writeFunctionProto(OutputList& ol,const ArgumentList *al,const MemberDef*); static void writeProcessProto(OutputList& ol,const ArgumentList *al,const MemberDef*); static void writeProcedureProto(OutputList& ol, const ArgumentList *al,const MemberDef*); static void writeFuncProcDocu(const MemberDef *mdef, OutputList& ol,const ArgumentList* al,bool type=false); static void writeRecordProto(const MemberDef *mdef, OutputList& ol,const ArgumentList *al); - - static void writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition* d, OutputList &ol); static void writeVhdlDeclarations(MemberList*,OutputList&,GroupDef*,ClassDef*,FileDef*,NamespaceDef*); @@ -272,7 +259,6 @@ static bool isMisc(const MemberDef *mdef) static QCString splitString(QCString & str, char c); static void parseUCF(const char* input,Entry* entity,QCString f,bool vendor); - static bool findConstraintFile( LayoutNavEntry *lne); static ClassDef* findArchitecture(const ClassDef *cd); @@ -284,16 +270,16 @@ static bool isMisc(const MemberDef *mdef) static void writeSource(MemberDef *mdef,OutputList& ol,QCString & cname); static void writeAlphbeticalClass(OutputList& ol,const ClassDef* cd,const QCString &); + static QCString parseForConfig(QCString & entity,QCString & arch); + static QCString parseForBinding(QCString & entity,QCString & arch); - static QCString parseForConfig(QCString & entity,QCString & arch); - static QCString parseForBinding(QCString & entity,QCString & arch); private: static void findAllArchitectures(QList<QCString>& ql,const ClassDef *cd); static bool compareArgList(ArgumentList*,ArgumentList*); static void writeVhdlLink(const ClassDef* cdd ,OutputList& ol,QCString& type,QCString& name,QCString& beh); static void writeStringLink(const MemberDef *mdef,QCString mem,OutputList& ol); - static void writeRecUnitDocu( const MemberDef *md, OutputList& ol,QCString largs); - static void writeRecorUnit(QCString & largs,OutputList& ol ,const MemberDef *mdef); + static void writeRecUnitDocu( const MemberDef *md, OutputList& ol,QCString largs); + static void writeRecorUnit(QCString & largs,OutputList& ol ,const MemberDef *mdef); }; #endif diff --git a/src/vhdlparser.y b/src/vhdlparser.y index d86bbff..1389f23 100644 --- a/src/vhdlparser.y +++ b/src/vhdlparser.y @@ -1,5 +1,5 @@ -/********************************************************************************************* +/********************************************************************************************* * The original was a VHDL parser description to be used with GMD Compiler * Tool Box * written from: @@ -14,13 +14,13 @@ * author of YACC transformation: * Thomas Dettmer * Dortmund University - * Dept. of Computer Scienc, LS1 + * Dept. of Computer Scienc, LS1 * PB 500 500 * D-44221 Dortmund (Germany) * Phone: +49-231-755-6464 * e-mail: dettmer@ls1.informatik.uni-dortmund.de ***************************************************************** - * + * * This file is intended not to be used for commercial purposes * without permission of the University of Twente and permission * of the University of Dortmund @@ -29,9 +29,9 @@ * OR ANYTHING ELSE. * *******************************************************/ -/****************************************************************************** +/****************************************************************************** * modified for doxygen by M. Kreis - * extended to VHDL 93/2002/2008 + * extended to VHDL 93/2002/2008 ******************************************************************************/ @@ -43,12 +43,12 @@ #ifndef YYSTYPE typedef int YYSTYPE; #endif - + struct YYMM { - int itype; + int itype; QCString qstr; -}; +}; // define struct instead of union #define YYSTYPE YYMM @@ -84,6 +84,12 @@ static ConfNode* currNode; static int currP=0; +enum { GEN_SEC=0x1, PARAM_SEC,CONTEXT_SEC,PROTECTED_SEC } ; + +static int param_sec = 0; +static int parse_sec=0; + + //---------------------------- function -------------------------------------------------------------------------------- int vhdlScanYYlex (); @@ -101,9 +107,9 @@ static bool isFuncProcProced(); static void popConfig(); static void pushLabel(QCString label); static void popLabel(); -static void addConfigureNode(const char* a,const char*b, +static void addConfigureNode(const char* a,const char*b, bool isRoot,bool isLeave,bool inlineConf=FALSE); -static bool addLibUseClause(const QCString &type); +//static bool addLibUseClause(const QCString &type); static bool isFuncProcProced(); static void initEntry(Entry *e); static void addProto(const char *s1,const char *s2,const char *s3, @@ -232,11 +238,11 @@ t_GROUP t_POSTPONED t_SHARED t_XNOR -t_SLL -t_SRA -t_SLA +t_SLL +t_SRA +t_SLA t_SRL -t_ROR +t_ROR t_ROL t_UNAFFECTED /*============== VHDL 2008 keywords ======================= */ @@ -279,13 +285,13 @@ t_QNEQU %nonassoc t_EQSym t_NESym t_LTSym t_LESym t_GTSym t_GESym t_QNEQU t_QEQU t_QL t_QG t_QLT t_QGT %left t_Plus t_Minus t_Ampersand %left MED_PRECEDENCE -%left t_Star t_Slash t_MOD t_REM -%nonassoc t_DoubleStar t_ABS t_NOT MAX_PRECEDENCE +%left t_Star t_Slash t_MOD t_REM +%nonassoc t_DoubleStar t_ABS t_NOT MAX_PRECEDENCE /* misc syms */ /*t_Space */ -%token +%token t_Apostrophe t_LeftParen t_RightParen @@ -303,28 +309,34 @@ t_Neg t_LEFTBR t_RIGHTBR t_ToolDir - + %type<qstr> designator literal enumeration_literal physical_literal physical_literal_no_default physical_literal_1 -%type<qstr> lib_clause use_clause sel_list entity_decl entity_start entity_decl_2 entity_decl_1 arch_body arch_start arch_body_1 -%type<qstr> config_decl config_start config_decl_2 config_decl_1 config_decl_3 package_decl package_start package_body pack_body_start package_body_2 package_body_1 common_decltve_item +%type<qstr> lib_clause use_clause sel_list entity_decl entity_start entity_decl_2 entity_decl_1 arch_body arch_start arch_body_1 +%type<qstr> config_decl config_start config_decl_2 config_decl_1 config_decl_3 package_decl package_start package_body pack_body_start package_body_2 package_body_1 common_decltve_item %type<qstr> config_decltve_item subprog_decl subprog_body interf_list interf_element interf_element_4 interf_element_3 interf_element_2 interf_element_1 mode -%type<qstr> association_list association_list_1 association_list_2 gen_association_list gen_association_list_1 gen_association_list_2 association_element gen_association_element formal_part actual_part mark expr and_relation relation primary name name2 sel_name suffix ifts_name -%type<qstr> attribute_name aggregate element_association_list2 qualified_expr element_association choices choices_1 choices_2 choice type_decl type_decl_1 type_definition enumeration_type_definition enumeration_type_definition_1 enumeration_type_definition_2 physical_type_definition physical_type_definition_1 physical_type_definition_2 base_unit_decl secondary_unit_decl unconstrained_array_definition unconstrained_array_definition_1 unconstrained_array_definition_2 index_subtype_definition constrained_array_definition record_type_definition record_type_definition_1 record_type_definition_2 element_decl -%type<qstr> access_type_definition file_type_definition subtype_decl subtype_indic subtype_indic_1 subtype_indic1 subtype_indic1_1 range_constraint index_constraint index_constraint_1 index_constraint_2 discrete_range discrete_range1 range_spec direction constant_decl constant_decl_1 signal_decl signal_decl_2 signal_decl_1 variable_decl variable_decl_1 object_class signal_kind alias_decl file_decl file_decl_1 attribute_decl attribute_spec entity_spec entity_name_list entity_name_list_1 -%type<qstr> entity_name_list_2 entity_class block_stat -%type<qstr> generate_stat generate_stat_1 procs_stat procs_stat1 procs_stat1_1 sensitivity_list sensitivity_list_1 sensitivity_list_2 -%type<qstr> procedure_call_stat comp_decl comp_decl_2 comp_decl_1 block_config block_config_2 block_config_3 block_config_1 block_config_4 block_spec config_item comp_config comp_config_2 comp_config_1 config_spec binding_indic comp_spec -%type<qstr> inst_list entity_aspect idf_list procs_stat1_6 +%type<qstr> association_list association_list_1 association_list_2 gen_association_list gen_association_list_1 gen_association_list_2 association_element gen_association_element formal_part actual_part mark expr and_relation relation primary name name2 sel_name suffix ifts_name +%type<qstr> attribute_name aggregate element_association_list2 qualified_expr element_association choices choices_1 choices_2 choice type_decl type_decl_1 type_definition enumeration_type_definition enumeration_type_definition_1 enumeration_type_definition_2 physical_type_definition physical_type_definition_1 physical_type_definition_2 base_unit_decl secondary_unit_decl unconstrained_array_definition unconstrained_array_definition_1 unconstrained_array_definition_2 index_subtype_definition constrained_array_definition record_type_definition record_type_definition_1 record_type_definition_2 element_decl +%type<qstr> access_type_definition file_type_definition subtype_decl subtype_indic subtype_indic_1 subtype_indic1 subtype_indic1_1 range_constraint index_constraint index_constraint_1 index_constraint_2 discrete_range discrete_range1 range_spec direction constant_decl constant_decl_1 signal_decl signal_decl_2 signal_decl_1 variable_decl variable_decl_1 object_class signal_kind alias_decl file_decl file_decl_1 attribute_decl attribute_spec entity_spec entity_name_list entity_name_list_1 +%type<qstr> entity_name_list_2 entity_class block_stat +%type<qstr> generate_stat generate_stat_1 procs_stat procs_stat1 procs_stat1_1 sensitivity_list sensitivity_list_1 sensitivity_list_2 +%type<qstr> procedure_call_stat comp_decl comp_decl_2 comp_decl_1 block_config block_config_2 block_config_3 block_config_1 block_config_4 block_spec config_item comp_config comp_config_2 comp_config_1 config_spec binding_indic comp_spec +%type<qstr> inst_list entity_aspect idf_list procs_stat1_6 %type<qstr> t_Identifier t_StringLit t_BitStringLit t_AbstractLit t_CharacterLit tbox group_name record_type_simple_name %type<qstr> entity_class_entry_list entity_class_entry group_constituent_list group_constituent group_declaration group_template_declaration %type<qstr> procs_stat1_5 comp_1 mark_comp dot_name fi_dec multiplying_operator factor term adding_op -%type<qstr> simple_exp alias_spec sigma signature1 mark_stats mark_stats_1 signature -%type<qstr> protected_type_body protected_type_declaration alias_name_stat vcomp_stat comp_spec_stat +%type<qstr> simple_exp alias_spec sigma signature1 mark_stats mark_stats_1 signature +%type<qstr> protected_type_body protected_type_declaration alias_name_stat vcomp_stat comp_spec_stat +%type<qstr> sig_stat external_name absolute_pathname relative_pathname package_path_name external_pathname pathname_element_list neg_list pathname_element + +%type<qstr> func_name return_is param func_prec iproc ifunc interface_subprogram_decl interface_package_decl package_instantiation_decl +%type<qstr> subprogram_instantiation_decl +%type<qstr> context_ref libustcont_stats libustcont_stat context_decl + %debug // for debugging set yydebug=1 -%initial-action { yydebug=0; } +%initial-action { yydebug=0; } %expect 2 @@ -336,78 +348,84 @@ start: design_file design_file : design_unit_list - + design_unit_list: design_unit - | design_unit_list design_unit - ; - -designator : t_Identifier {$$=$1;} - | t_StringLit {$$=$1;} - ; - -literal : t_AbstractLit {$$=$1;} - | t_CharacterLit {$$=$1;} - | t_BitStringLit {$$=$1;} - | physical_literal_no_default {$$=$1;} - | t_NULL {$$="null";} - ; + | design_unit_list design_unit + ; -enumeration_literal : t_CharacterLit {$$=$1;} - | t_Identifier {$$=$1;} +designator : t_Identifier { $$=$1; } + | t_StringLit { $$=$1; } + ; -physical_literal : physical_literal_1 t_Identifier {$$=$1+" "+$2;} +literal : t_AbstractLit { $$=$1; } + | t_CharacterLit { $$=$1; } + | t_BitStringLit { $$=$1; } + | physical_literal_no_default { $$=$1; } + | t_NULL { $$="null"; } + ; -physical_literal_1 : /* empty */ {$$="";} - | t_AbstractLit {$$=$1;} +enumeration_literal : t_CharacterLit { $$=$1; } + | t_Identifier { $$=$1; } -physical_literal_no_default : t_AbstractLit t_Identifier {$$=$1+" "+$2;} +physical_literal : physical_literal_1 t_Identifier { $$=$1+" "+$2; } -idf_list : t_Identifier {$$=$1;} - | idf_list t_Comma t_Identifier {$$=$1+","+$3} - ; +physical_literal_1 : /* empty */ { $$=""; } + | t_AbstractLit { $$=$1; } + +physical_literal_no_default : t_AbstractLit t_Identifier { $$=$1+" "+$2; } + +idf_list : t_Identifier { $$=$1; } + | idf_list t_Comma t_Identifier { $$=$1+","+$3} + ; /*------------------------------------------ -- Desing Unit --------------------------------------------*/ - design_unit : context_list lib_unit - - context_list : /* empty */ - | context_list context_item +design_unit : context_list lib_unit - lib_unit : entity_decl - | config_decl - | package_decl - | arch_body - | package_body +context_list : /* empty */ + | context_list context_item + +lib_unit : entity_decl + | config_decl + | package_decl + | arch_body + | package_body | context_decl | package_instantiation_decl ; - -context_item : lib_clause - | use_clause - ; - -lib_clause : t_LIBRARY idf_list t_Semicolon -{ - if (addLibUseClause($2)) - addVhdlType($2,getParsedLine(t_LIBRARY),Entry::VARIABLE_SEC,VhdlDocGen::LIBRARY,$2.data(),0); -} -use_clause : t_USE sel_list t_Semicolon - { - QStringList ql1=QStringList::split(",",$2,FALSE); - for (uint j=0;j<ql1.count();j++) +context_item : lib_clause + | use_clause + ; + +lib_clause : t_LIBRARY idf_list t_Semicolon + { + if ( parse_sec == 0) + { + addVhdlType($2,getParsedLine(t_LIBRARY),Entry::VARIABLE_SEC,VhdlDocGen::LIBRARY,$2.data(),"_library_"); + } + $$="library "+$2; + } + +use_clause : t_USE sel_list t_Semicolon { - QStringList ql=QStringList::split(".",ql1[j],FALSE); - QCString it=(QCString)ql[1];; - if (addLibUseClause(it)) - addVhdlType(it,getParsedLine(t_USE),Entry::VARIABLE_SEC,VhdlDocGen::USE,it.data(),0); + QStringList ql1=QStringList::split(",",$2,FALSE); + for (uint j=0;j<ql1.count();j++) + { + QStringList ql=QStringList::split(".",ql1[j],FALSE); + QCString it=(QCString)ql[1];; + if ( parse_sec == 0 ) + { + addVhdlType(it,getParsedLine(t_USE),Entry::VARIABLE_SEC,VhdlDocGen::USE,it.data(),"_use_"); + } + } + $$="use "+$2; } - } -sel_list : sel_name {$$=$1;} - | sel_list t_Comma sel_name { $$=$1+","+$3;} +sel_list : sel_name { $$=$1; } + | sel_list t_Comma sel_name { $$=$1+","+$3; } ; /*------------------------------------------ -- Library Units @@ -419,136 +437,136 @@ entity_decl : entity_start entity_decl_1 entity_decl_2 entity_decl_3 entity_decl_4 comp_end_dec t_Semicolon entity_start: t_ENTITY t_Identifier t_IS - { - $$=$2; - lastEntity=current; - addVhdlType($$,getParsedLine(t_ENTITY),Entry::CLASS_SEC,VhdlDocGen::ENTITY,0,0,Public); - //fprintf(stderr,"\n entiy %s : at line %d",$$.data(),s_str.yyLineNr); - } - ; - + { + $$=$2; + lastEntity=current; + lastCompound=0; + /*int k=*/ getParsedLine(t_ENTITY); + addVhdlType($$,getParsedLine(t_ENTITY),Entry::CLASS_SEC,VhdlDocGen::ENTITY,0,0,Public); + //fprintf(stderr,"\n entiy %s : at line %d",$$.data(),s_str.yyLineNr); + } + ; entity_decl_5 : /* empty */ - | t_Identifier - - ; + | t_Identifier + ; entity_decl_4 : /* empty */ - | t_BEGIN concurrent_stats - ; + | t_BEGIN concurrent_stats + ; entity_decl_3 : /* empty */ - | entity_decl_3 entity_decl_6 - ; - -entity_decl_6 : entity_decltve_item - -entity_decl_2 : /* empty */ {$$="";} - | t_PORT {currP=VhdlDocGen::PORT;} interf_list t_Semicolon {currP=0;} - ; -entity_decl_1 : /* empty */ {$$="";} - | t_GENERIC {currP=VhdlDocGen::GENERIC;} interf_list t_Semicolon{currP=0;} - | t_GENERIC error t_Semicolon{currP=0;} - - ; - - -arch_body : arch_start arch_body_1 t_BEGIN concurrent_stats t_END arch_body_2 t_Semicolon -arch_body : arch_start error t_END arch_body_2 t_Semicolon - -arch_start : t_ARCHITECTURE t_Identifier t_OF t_Identifier t_IS - { - $$=$4; - $$+="::"; - $$+=$2; - pushLabel($2); - lastCompound=current; - addVhdlType($$,getParsedLine(t_ARCHITECTURE),Entry::CLASS_SEC,VhdlDocGen::ARCHITECTURE,0,0,Private); - } -arch_body_2 : /* empty */ -arch_body_2 : t_Identifier -arch_body_2 : t_ARCHITECTURE t_Identifier -arch_body_2 : t_ARCHITECTURE - -arch_body_1 : /* empty */ {$$="";} - arch_body_1 : arch_body_1 arch_body_3 + | entity_decl_3 entity_decl_6 + ; -arch_body_3 : block_decltve_item +entity_decl_6 : entity_decltve_item -config_decl : config_start error t_END config_decl_2 t_Semicolon {genLabels.resize(0);} -config_decl : config_start config_decl_1 block_config t_END config_decl_2 t_Semicolon {genLabels.resize(0);} - { - confName=""; - } +entity_decl_2 : /* empty */ { $$=""; } + | t_PORT { currP=VhdlDocGen::PORT; } interf_list t_Semicolon { currP=0; } + ; +entity_decl_1 : /* empty */ { $$=""; } + | t_GENERIC { currP=VhdlDocGen::GENERIC;parse_sec=GEN_SEC} interf_list t_Semicolon{ currP=0;parse_sec=0; } + | t_GENERIC error t_Semicolon{ currP=0; } + ; - -config_start : t_CONFIGURATION t_Identifier t_OF t_Identifier t_IS - { - confName=$2+"::"+$4; - addVhdlType($2.data(),getParsedLine(t_CONFIGURATION),Entry::VARIABLE_SEC,VhdlDocGen::CONFIG,"configuration",$4.data()); - } -config_decl_2 : /* empty */ {$$="";} -config_decl_2 : t_Identifier { $$=$1;} -config_decl_2 : t_CONFIGURATION { $$="configuration";} -config_decl_2 : t_CONFIGURATION t_Identifier { $$=$2;} -config_decl_1 : /* empty */ {$$="";} -config_decl_1 : config_decl_1 config_decl_3 { $$=$1+" "+$2;} -config_decl_3 : config_decltve_item { $$=$1;} - -package_decl : package_start error t_END package_decl_2 t_Semicolon -package_decl : package_start package_decl_1 t_END package_decl_2 t_Semicolon -package_start : t_PACKAGE t_Identifier t_IS +arch_body : arch_start arch_body_1 t_BEGIN concurrent_stats t_END arch_body_2 t_Semicolon +arch_body : arch_start error t_END arch_body_2 t_Semicolon + +arch_start : t_ARCHITECTURE t_Identifier t_OF t_Identifier t_IS + { + $$=$4; + $$+="::"; + $$+=$2; + pushLabel($2); + lastCompound=current; + addVhdlType($$,getParsedLine(t_ARCHITECTURE),Entry::CLASS_SEC,VhdlDocGen::ARCHITECTURE,0,0,Private); + } +arch_body_2 : /* empty */ +arch_body_2 : t_Identifier +arch_body_2 : t_ARCHITECTURE t_Identifier +arch_body_2 : t_ARCHITECTURE + +arch_body_1 : /* empty */ { $$=""; } +arch_body_1 : arch_body_1 arch_body_3 + +arch_body_3 : block_decltve_item + +config_decl : config_start error t_END config_decl_2 t_Semicolon { genLabels.resize(0); } +config_decl : config_start config_decl_1 block_config t_END config_decl_2 t_Semicolon { genLabels.resize(0); } + { + confName=""; + } + + +config_start : t_CONFIGURATION t_Identifier t_OF t_Identifier t_IS + { + confName=$2+"::"+$4; + addVhdlType($2.data(),getParsedLine(t_CONFIGURATION),Entry::VARIABLE_SEC,VhdlDocGen::CONFIG,"configuration",$4.data()); + } + +config_decl_2 : /* empty */ { $$=""; } +config_decl_2 : t_Identifier { $$=$1; } +config_decl_2 : t_CONFIGURATION { $$="configuration"; } +config_decl_2 : t_CONFIGURATION t_Identifier { $$=$2; } +config_decl_1 : /* empty */ { $$=""; } +config_decl_1 : config_decl_1 config_decl_3 { $$=$1+" "+$2; } +config_decl_3 : config_decltve_item { $$=$1; } + +package_decl : package_start error t_END package_decl_2 t_Semicolon +package_decl : package_start package_decl_1 t_END package_decl_2 t_Semicolon +package_start : t_PACKAGE t_Identifier t_IS { lastCompound=current; - - + + Entry *clone=new Entry(*current); clone->section=Entry::NAMESPACE_SEC; clone->spec=VhdlDocGen::PACKAGE; clone->name=$2; - clone->startLine= getParsedLine(t_PACKAGE); - clone->bodyLine= getParsedLine(t_PACKAGE); - + int line=s_str.iLine; + clone->startLine=line; + clone->bodyLine=line; + clone->protection=Package; current_root->addSubEntry(clone); - - - addVhdlType($2,getParsedLine(t_PACKAGE),Entry::CLASS_SEC,VhdlDocGen::PACKAGE,0,0,Package); + + + addVhdlType($2,line,Entry::CLASS_SEC,VhdlDocGen::PACKAGE,0,0,Package); //fprintf(stderr,"\n entiy %s : at line %d",$$.data(),s_str.yyLineNr); } -package_decl_2 : /* empty */ -package_decl_2 : t_Identifier {lastCompound=0;} -package_decl_2 : t_PACKAGE t_Identifier {lastCompound=0;} -package_decl_2 : t_PACKAGE {lastCompound=0;} - -package_decl_1 : /* empty */ +package_decl_2 : /* empty */ +package_decl_2 : t_Identifier { lastCompound=0; } +package_decl_2 : t_PACKAGE t_Identifier { lastCompound=0; } +package_decl_2 : t_PACKAGE { lastCompound=0; } + +package_decl_1 : /* empty */ package_decl_1 : package_decl_22 -package_decl_1 : package_decl_1 package_decl_3 -package_decl_3 : package_decltve_item +package_decl_1 : package_decl_1 package_decl_3 +package_decl_3 : package_decltve_item package_decl_22: gen_interface_list t_Semicolon package_decl_22: gen_interface_list package_decl_22: gen_interface_list gen_assoc_list package_decl_22: gen_interface_list gen_assoc_list t_Semicolon -package_body : pack_body_start error t_END package_body_2 t_Semicolon -package_body : pack_body_start package_body_1 t_END package_body_2 t_Semicolon -pack_body_start : t_PACKAGE t_BODY t_Identifier t_IS +package_body : pack_body_start error t_END package_body_2 t_Semicolon +package_body : pack_body_start package_body_1 t_END package_body_2 t_Semicolon +pack_body_start : t_PACKAGE t_BODY t_Identifier t_IS { $$=$3; lastCompound=current; $$.prepend("_"); addVhdlType($$,getParsedLine(t_PACKAGE) ,Entry::CLASS_SEC,VhdlDocGen::PACKAGE_BODY,0,0,Protected); } -package_body_2 : /* empty */ {$$="";lastCompound=0;} -package_body_2 : t_Identifier {lastCompound=0;} -package_body_2 : t_PACKAGE t_BODY {lastCompound=0;} -package_body_2 : t_PACKAGE t_BODY t_Identifier {lastCompound=0;} +package_body_2 : /* empty */ { $$="";lastCompound=0; } +package_body_2 : t_Identifier { lastCompound=0; } +package_body_2 : t_PACKAGE t_BODY { lastCompound=0; } +package_body_2 : t_PACKAGE t_BODY t_Identifier { lastCompound=0; } -package_body_1 : /* empty */ {$$="";} -package_body_1 : package_body_1 package_body_3 -package_body_3 : package_body_decltve_item +package_body_1 : /* empty */ { $$=""; } +package_body_1 : package_body_1 package_body_3 +package_body_3 : package_body_decltve_item @@ -556,229 +574,280 @@ package_body_3 : package_body_decltve_item -- Declarative Item --------------------------------------------*/ -common_decltve_item_1 : package_decl -common_decltve_item_1 : package_instantiation_decl -common_decltve_item_1 : package_body -common_decltve_item_1 : subprogram_instantiation_decl - - -common_decltve_item : type_decl -common_decltve_item : subtype_decl -common_decltve_item : constant_decl -common_decltve_item : file_decl -common_decltve_item : alias_decl -common_decltve_item : subprog_decl -common_decltve_item : use_clause - -entity_decltve_item : common_decltve_item -entity_decltve_item : subprog_body -entity_decltve_item : attribute_decl -entity_decltve_item : attribute_spec -entity_decltve_item : disconnection_spec -entity_decltve_item : signal_decl -entity_decltve_item : variable_decl -entity_decltve_item : group_template_declaration -entity_decltve_item : group_declaration -entity_decltve_item : common_decltve_item_1 - - -block_decltve_item : common_decltve_item -block_decltve_item : subprog_body -block_decltve_item : comp_decl -block_decltve_item : attribute_decl -block_decltve_item : attribute_spec -block_decltve_item : config_spec -block_decltve_item : disconnection_spec -block_decltve_item : signal_decl -block_decltve_item : variable_decl -block_decltve_item : group_template_declaration -block_decltve_item : group_declaration -block_decltve_item : common_decltve_item_1 -block_decltve_item : tool_directive -block_declarative_part : block_decltve_item - | block_declarative_part block_decltve_item - - -package_decltve_item : common_decltve_item -package_decltve_item : comp_decl -package_decltve_item : attribute_decl -package_decltve_item : attribute_spec -package_decltve_item : disconnection_spec -package_decltve_item : signal_decl -package_decltve_item : variable_decl -package_decltve_item : group_template_declaration - package_decltve_item : group_declaration - package_decltve_item : package_decl - package_decltve_item : package_instantiation_decl - package_decltve_item : subprogram_instantiation_decl - -package_body_decltve_item : common_decltve_item -package_body_decltve_item : subprog_body -package_body_decltve_item : variable_decl -package_body_decltve_item : group_template_declaration -package_body_decltve_item : group_declaration -package_body_decltve_item :attribute_decl -package_body_decltve_item :attribute_spec -package_body_decltve_item : common_decltve_item_1 - -subprog_decltve_item : common_decltve_item -subprog_decltve_item : subprog_body -subprog_decltve_item : attribute_decl -subprog_decltve_item : attribute_spec -subprog_decltve_item : variable_decl -subprog_decltve_item : group_template_declaration -subprog_decltve_item : group_declaration -subprog_decltve_item : common_decltve_item_1 - -procs_decltve_item : common_decltve_item -procs_decltve_item : subprog_body -procs_decltve_item : attribute_decl -procs_decltve_item : attribute_spec -procs_decltve_item : variable_decl -procs_decltve_item : group_template_declaration -procs_decltve_item : group_declaration -procs_decltve_item : common_decltve_item_1 - -config_decltve_item : attribute_spec { $$=$1;} -config_decltve_item : use_clause { $$=$1;} -config_decltve_item : group_declaration { $$=$1;} -config_decltve_item: t_USE t_VUNIT idf_list t_Semicolon { $$=$3;} +common_decltve_item_1: package_decl +common_decltve_item_1: package_instantiation_decl +common_decltve_item_1: package_body +common_decltve_item_1: subprogram_instantiation_decl + + +common_decltve_item: type_decl +common_decltve_item: subtype_decl +common_decltve_item: constant_decl +common_decltve_item: file_decl +common_decltve_item: alias_decl +common_decltve_item: subprog_decl +common_decltve_item: use_clause + +entity_decltve_item: common_decltve_item +entity_decltve_item: subprog_body +entity_decltve_item: attribute_decl +entity_decltve_item: attribute_spec +entity_decltve_item: disconnection_spec +entity_decltve_item: signal_decl +entity_decltve_item: variable_decl +entity_decltve_item: group_template_declaration +entity_decltve_item: group_declaration +entity_decltve_item: common_decltve_item_1 + + +block_decltve_item: common_decltve_item +block_decltve_item: subprog_body +block_decltve_item: comp_decl +block_decltve_item: attribute_decl +block_decltve_item: attribute_spec +block_decltve_item: config_spec +block_decltve_item: disconnection_spec +block_decltve_item: signal_decl +block_decltve_item: variable_decl +block_decltve_item: group_template_declaration +block_decltve_item: group_declaration +block_decltve_item: common_decltve_item_1 +block_decltve_item: tool_directive + +block_declarative_part: block_decltve_item + | block_declarative_part block_decltve_item + + +package_decltve_item: common_decltve_item +package_decltve_item: comp_decl +package_decltve_item: attribute_decl +package_decltve_item: attribute_spec +package_decltve_item: disconnection_spec +package_decltve_item: signal_decl +package_decltve_item: variable_decl +package_decltve_item: group_template_declaration +package_decltve_item: group_declaration +package_decltve_item: package_decl +package_decltve_item: package_instantiation_decl +package_decltve_item: subprogram_instantiation_decl + +package_body_decltve_item: common_decltve_item +package_body_decltve_item: subprog_body +package_body_decltve_item: variable_decl +package_body_decltve_item: group_template_declaration +package_body_decltve_item: group_declaration +package_body_decltve_item: attribute_decl +package_body_decltve_item: attribute_spec +package_body_decltve_item: common_decltve_item_1 + +subprog_decltve_item: common_decltve_item +subprog_decltve_item: subprog_body +subprog_decltve_item: attribute_decl +subprog_decltve_item: attribute_spec +subprog_decltve_item: variable_decl +subprog_decltve_item: group_template_declaration +subprog_decltve_item: group_declaration +subprog_decltve_item: common_decltve_item_1 + +procs_decltve_item: common_decltve_item +procs_decltve_item: subprog_body +procs_decltve_item: attribute_decl +procs_decltve_item: attribute_spec +procs_decltve_item: variable_decl +procs_decltve_item: group_template_declaration +procs_decltve_item: group_declaration +procs_decltve_item: common_decltve_item_1 + +config_decltve_item: attribute_spec { $$=$1; } +config_decltve_item: use_clause { $$=$1; } +config_decltve_item: group_declaration { $$=$1; } +config_decltve_item: t_USE t_VUNIT idf_list t_Semicolon { $$=$3; } /*------------------------------------------ -- Subprograms --------------------------------------------*/ -func_prec: t_PURE -func_prec: t_IMPURE - -subprog_decl : subprog_spec t_Semicolon {currP=0;} - -subprog_spec : t_PROCEDURE t_Identifier {currP=VhdlDocGen::PROCEDURE; createFunction($2,currP,0); } subprog_spec_1 { newEntry(); } -subprog_spec : func_prec t_FUNCTION designator subprog_spec_2 t_RETURN mark -subprog_spec : t_FUNCTION designator -{ - currP=VhdlDocGen::FUNCTION; - createFunction(0,currP,$2.data()); -} subprog_spec_2 t_RETURN mark -{ - tempEntry=current; - current->type=$6; - newEntry(); -} +func_prec: t_PURE { $$="pure"; } +func_prec: t_IMPURE { $$="impure"; } + +subprog_decl: subprog_spec t_Semicolon { currP=0; } + +subprog_spec: t_PROCEDURE t_Identifier + { currP=VhdlDocGen::PROCEDURE; createFunction($2,currP,0); } + subprog_spec_1 { newEntry(); } +subprog_spec: func_prec t_FUNCTION designator + { + currP=VhdlDocGen::FUNCTION; + createFunction($1,currP,$3.data()); + } + subprog_spec_2 t_RETURN mark + { + tempEntry=current; + current->type=$7; + newEntry(); + } + +subprog_spec : t_FUNCTION designator + { + currP=VhdlDocGen::FUNCTION; + createFunction(0,currP,$2.data()); + } + subprog_spec_2 t_RETURN mark + { + tempEntry=current; + current->type=$6; + newEntry(); + } subprog_spec_22: gen_interface_list subprog_spec_22: gen_interface_list gen_assoc_list -subprog_spec_33: t_PARAMETER interf_list -subprog_spec_33: interf_list +subprog_spec_33: t_PARAMETER + { param_sec=PARAM_SEC; } + interf_list + { param_sec= 0; } +subprog_spec_33: { param_sec=PARAM_SEC; } + interf_list + { param_sec= 0; } -subprog_spec_2 : /* empty */ -subprog_spec_2 : subprog_spec_22 subprog_spec_33 -subprog_spec_2 : subprog_spec_33 -subprog_spec_2 : subprog_spec_22 - -subprog_spec_1 : subprog_spec_2 +subprog_spec_2: /* empty */ +subprog_spec_2: subprog_spec_22 subprog_spec_33 +subprog_spec_2: subprog_spec_33 +subprog_spec_2: subprog_spec_22 -subprog_body : subprog_spec t_IS subprog_body_1 t_BEGIN seq_stats t_END subprog_body_2 t_Semicolon -{ - currP=0; -} -subprog_body : subprog_spec t_IS error t_END subprog_body_2 t_Semicolon -{ - currP=0; -} -subprog_body_2 : /* empty */ -subprog_body_2 : designator -subprog_body_2 : t_FUNCTION -subprog_body_2 : t_PROCEDURE -subprog_body_2 : t_PROCEDURE t_Identifier -subprog_body_2 : t_FUNCTION t_Identifier -subprog_body_2 : t_FUNCTION t_STRING - - -subprog_body_1 : /* empty */ +subprog_spec_1: subprog_spec_2 + +subprog_body: subprog_spec t_IS subprog_body_1 t_BEGIN seq_stats t_END subprog_body_2 t_Semicolon + { + currP=0; + } +subprog_body: subprog_spec t_IS error t_END subprog_body_2 t_Semicolon + { + currP=0; + } +subprog_body_2: /* empty */ +subprog_body_2: designator +subprog_body_2: t_FUNCTION +subprog_body_2: t_PROCEDURE +subprog_body_2: t_PROCEDURE t_Identifier +subprog_body_2: t_FUNCTION t_Identifier +subprog_body_2: t_FUNCTION t_STRING + + +subprog_body_1: /* empty */ //subprog_body_1 : subprogram_instantiation_decl -subprog_body_1 : subprog_body_1 subprog_body_3 -subprog_body_3 : subprog_decltve_item +subprog_body_1: subprog_body_1 subprog_body_3 +subprog_body_3: subprog_decltve_item /*-------------------------------------------------- -- Interface Lists and Associaton Lists ----------------------------------------------------*/ -interf_list : t_LeftParen interf_element interf_list_1 t_RightParen {$$="";} -interf_list : t_LeftParen error t_RightParen {$$="";} -interf_list_1 : /* empty */ -interf_list_1 : interf_list_1 interf_list_2 -interf_list_2 : t_Semicolon interf_element - - -interf_element : interface_package_decl {$$="";} -interf_element : interface_subprogram_decl {$$="";} -interf_element : interf_element_1 t_Identifier {$$="";} -interf_element : interf_element_1 idf_list t_Colon interf_element_2 subtype_indic interf_element_3 interf_element_4 - { - if (currP!=VhdlDocGen::COMPONENT) - { - if (currP==VhdlDocGen::FUNCTION || currP==VhdlDocGen::PROCEDURE) - { - addProto($1.data(),$2.data(),$4.data(),$5.data(),$6.data(),$7.data()); - } - else - { - QCString i=$5+$6+$7; - addVhdlType($2,s_str.iLine,Entry::VARIABLE_SEC,currP,i.data(),$4.data()); - } - // fprintf(stderr,"\n\n <<port %s >>\n",$$.data()); - } // if component - } -interf_element_4 : /* empty :=*/ {$$="";} -interf_element_4 : t_VarAsgn expr {$$=":="+$2;} -interf_element_3 : /* empty */ {$$="";} -interf_element_3 : t_BUFFER {$$="buffer";} -interf_element_3 : t_BUS {$$="bus";} -interf_element_2 : /* empty */ {$$="";} -interf_element_2 : mode {$$=$1;} -interf_element_1 : /* empty */ {$$="";} -interf_element_1 : object_class {$$=$1;} - -mode : t_IN {$$="in";} -mode : t_OUT {$$="out";} -mode : t_INOUT {$$="inout";} -mode : t_BUFFER {$$="buffer";} -mode : t_LINKAGE {$$="link";} - -association_list : t_LeftParen association_element association_list_1 t_RightParen {$$="("+$2+")";} -association_list_1 : /* empty */ {$$="";} -association_list_1 : association_list_1 association_list_2 {$$=$1+" "+$2; } -association_list_2 : t_Comma association_element {$$=", "+$2; } - -gen_association_list : t_LeftParen gen_association_element gen_association_list_1 t_RightParen -{ - QCString str="( "+$2; - str.append(" )"); - $$=str; -} -gen_association_list : t_LeftParen error t_RightParen {$$="";} -gen_association_list :t_LeftParen t_OPEN t_RightParen {$$=" ( open ) ";} - -gen_association_list_1 : /* empty */ {$$="";} -gen_association_list_1 : gen_association_list_1 gen_association_list_2 {$$=$1+"?? "+$2; } -gen_association_list_2 : t_Comma gen_association_element {$$=","+$2;} - -association_element : formal_part t_Arrow actual_part {$$=$1+"=>"+$3;} -association_element : actual_part {$$=$1;} -association_element : t_Box {$$="<>";} -association_element : t_DEFAULT {$$="default";} +interf_list: t_LeftParen interf_element interf_list_1 t_RightParen { $$=""; } +interf_list: t_LeftParen error t_RightParen { $$=""; } +interf_list_1: /* empty */ +interf_list_1: interf_list_1 interf_list_2 +interf_list_2: t_Semicolon interf_element + +interf_element: interface_package_decl + { + // adding generic : [ package foo is new bar] + if (parse_sec==GEN_SEC) + { + QCString n=current->name; + addVhdlType(n.data(),getParsedLine(t_PACKAGE),Entry::VARIABLE_SEC,VhdlDocGen::GENERIC,$1.data(),0); + } + } +interf_element: interface_subprogram_decl + { + if (parse_sec==GEN_SEC) + { + int a=getParsedLine(t_FUNCTION); + int b=getParsedLine(t_PROCEDURE); + + if (a>b) b=a; + + QCString n=current->name; + addVhdlType(n.data(),b,Entry::VARIABLE_SEC,VhdlDocGen::GENERIC,$1.data(),0); + } + } +interf_element: interf_element_1 t_Identifier + { + if (parse_sec==GEN_SEC) + { + QCString v= $1; + addVhdlType($2,s_str.iLine,Entry::VARIABLE_SEC,currP,$1.data(),0); + } + } +interf_element: interf_element_1 idf_list t_Colon interf_element_2 subtype_indic interf_element_3 interf_element_4 + { + QCString b=$2; + $$=$2+":"+$4+$5+$6+$7; + if (currP!=VhdlDocGen::COMPONENT) + { + if (currP==VhdlDocGen::FUNCTION || currP==VhdlDocGen::PROCEDURE) + { + addProto($1.data(),$2.data(),$4.data(),$5.data(),$6.data(),$7.data()); + } + else + { + QCString i=$5+$6+$7; + if (currP==VhdlDocGen::GENERIC) + addVhdlType($2,s_str.iLine,Entry::VARIABLE_SEC,currP,i.data(),$4.data()); + else if(parse_sec != GEN_SEC) + addVhdlType($2,s_str.iLine,Entry::VARIABLE_SEC,currP,i.data(),$4.data()); + } + // fprintf(stderr,"\n\n <<port %s >>\n",$$.data()); + } // if component + } +interf_element_4: /* empty :=*/ { $$=""; } +interf_element_4: t_VarAsgn expr { $$=":="+$2; } +interf_element_3: /* empty */ { $$=""; } +interf_element_3: t_BUFFER { $$="buffer"; } +interf_element_3: t_BUS { $$="bus"; } +interf_element_2: /* empty */ { $$=""; } +interf_element_2: mode { $$=$1; } +interf_element_1: /* empty */ { $$=""; } +interf_element_1: object_class { $$=$1; } + +mode: t_IN { $$="in"; } +mode: t_OUT { $$="out"; } +mode: t_INOUT { $$="inout"; } +mode: t_BUFFER { $$="buffer"; } +mode: t_LINKAGE { $$="link"; } + +association_list: t_LeftParen association_element association_list_1 t_RightParen { $$="("+$2+")"; } +association_list_1: /* empty */ { $$=""; } +association_list_1: association_list_1 association_list_2 { $$=$1+" "+$2; } +association_list_2: t_Comma association_element { $$=", "+$2; } + +gen_association_list : t_LeftParen gen_association_element gen_association_list_1 t_RightParen + { + QCString str="( "+$2; + str.append(" )"); + $$=str; + } +gen_association_list: t_LeftParen error t_RightParen { $$=""; } +gen_association_list: t_LeftParen t_OPEN t_RightParen { $$=" ( open ) "; } + +gen_association_list_1: /* empty */ { $$=""; } +gen_association_list_1: gen_association_list_1 gen_association_list_2 { $$=$1+"?? "+$2; } +gen_association_list_2: t_Comma gen_association_element { $$=","+$2; } + +association_element: formal_part t_Arrow actual_part { $$=$1+"=>"+$3; } +association_element: actual_part { $$=$1; } +association_element: t_Box { $$="<>"; } +association_element: t_DEFAULT { $$="default"; } /* changed ;gen_association_element : association_element */ -gen_association_element : expr { $$=$1; } -gen_association_element : choice t_Arrow expr -gen_association_element :discrete_range1 { $$=$1 ;} +gen_association_element: expr { $$=$1; } +gen_association_element: choice t_Arrow expr +gen_association_element: discrete_range1 { $$=$1 ; } -formal_part : name {$$=$1;} +formal_part: name { $$=$1; } -actual_part : expr {$$=$1;} -actual_part : t_OPEN {$$="open";} -actual_part : t_INERTIAL expr {$$="inertial";} +actual_part: expr { $$=$1; } +actual_part: t_OPEN { $$="open"; } +actual_part: t_INERTIAL expr { $$="inertial"; } /*-------------------------------------------------- -- Names and Expressions @@ -786,442 +855,424 @@ actual_part : t_INERTIAL expr {$$="inertial";} -expr : and_relation {$$=$1;} -expr : relation {$$=$1;} +expr: and_relation { $$=$1; } +expr: relation { $$=$1; } -shift_op: t_SLL - | t_SRA - | t_SLA - |t_SRL - |t_ROR - |t_ROL - ; -and_relation : relation shift_op relation -and_relation : relation t_AND relation -and_relation : relation t_XOR relation -and_relation : relation t_OR relation -and_relation : relation t_NOR relation -and_relation : relation t_XNOR relation -and_relation : relation t_NAND relation -and_relation : and_relation t_NAND relation -and_relation : and_relation t_NOR relation -and_relation : and_relation t_XNOR relation -and_relation : and_relation t_AND relation -and_relation : and_relation t_OR relation -and_relation : and_relation t_XOR relation - - - -/* ;relation : unary_operator primary */ - - -relation : t_QQ primary {$$=" ?? "+$2;} -relation : primary {$$=$1;} -relation : t_Plus primary %prec MED_PRECEDENCE {$$="+"+$2;} -relation : t_Minus primary %prec MED_PRECEDENCE {$$="-"+$2 ;} -relation : t_ABS primary {$$="abs"+$2;} -relation : t_NOT primary {$$="not "+$2;} -relation : primary t_DoubleStar primary {$$=$1+" ** "+$3;} -relation : t_Minus primary t_DoubleStar primary {$$=$2+" ** "+$4;} - -/* ; relation : relation binary_operator primary */ - -relation : relation t_MOD relation {$$=$1+" mod "+$3;} -relation : relation t_REM relation {$$=$1+" rem "+$3;} -relation : relation t_Ampersand relation {$$=$1+" & "+$3;} -relation : relation t_Star relation {$$=$1+" * "+$3;} -relation : relation t_Plus relation {$$=$1+" + "+$3;} -relation : relation t_Minus relation {$$=$1+" - "+$3;} -relation : relation t_LESym relation {$$=$1+" <= "+$3;} -relation : relation t_GESym relation {$$=$1+" >= "+$3;} -relation : relation t_LTSym relation {$$=$1+" < "+$3;} -relation : relation t_GTSym relation {$$=$1+" > "+$3;} -relation : relation t_EQSym relation {$$=$1+" == "+$3;} -relation : relation t_NESym relation {$$=$1+" != "+$3;} -relation : relation t_Slash relation {$$=$1+" /"+$3;} -relation : relation t_QNEQU relation {$$=$1+" ?/="+$3;} -relation : relation t_QEQU relation {$$=$1+" ?="+$3;} -relation : relation t_QL relation {$$=$1+" ?<"+$3;} -relation : relation t_QG relation {$$=$1+" ?>"+$3;} -relation : relation t_QLT relation {$$=$1+" ?<="+$3;} -relation : relation t_QGT relation {$$=$1+" ?>="+$3;} - - - -simple_exp: t_Minus term { $$ = "-"+$2;} - | t_Plus term { $$ = "+"+$2;} - | term { $$ = $1;} - | simple_exp adding_op term { $$ = $1+" "+$2+" "+$3;} - -adding_op: t_Ampersand { $$ = "&";} - | t_Minus { $$ = "-";} - | t_Plus { $$ = "+";} - ; - -term : factor { $$=$1; } - | factor multiplying_operator factor { $$ = $1+" "+$2+" "+$3;} +shift_op: t_SLL + | t_SRA + | t_SLA + | t_SRL + | t_ROR + | t_ROL ; - -multiplying_operator: t_Star { $$ = "*";} - | t_REM { $$ = "rem";} - | t_MOD { $$ = "mod";} - | t_Slash { $$ = "/";} - -factor : primary { $$=$1; } - | t_ABS primary { $$="abs "+$2; } - | t_NOT primary { $$="not "+$2; } - | primary t_DoubleStar primary { $$ = $1+" ** "+$3;} - - -primary : name {$$=$1;} -primary : literal {$$=$1;} -primary : aggregate {$$=$1;} -primary : qualified_expr {$$=$1;} -primary : allocator {$$="";} -primary : t_LeftParen expr t_RightParen {$$="("+$2+")";} - +and_relation: relation shift_op relation +and_relation: relation t_AND relation +and_relation: relation t_XOR relation +and_relation: relation t_OR relation +and_relation: relation t_NOR relation +and_relation: relation t_XNOR relation +and_relation: relation t_NAND relation +and_relation: and_relation t_NAND relation +and_relation: and_relation t_NOR relation +and_relation: and_relation t_XNOR relation +and_relation: and_relation t_AND relation +and_relation: and_relation t_OR relation +and_relation: and_relation t_XOR relation -name : mark {$$=$1;} -name : name2 {$$=$1;} -name : external_name {$$="";} -name2 : t_StringLit {$$=$1;} -name2 : attribute_name {$$=$1;} -name2 : ifts_name {$$=$1;} - -mark : t_Identifier {$$=$1;} -mark : sel_name {$$=$1;} - -sel_name : name t_Dot suffix {$$=$1+"."+$3;} - -suffix : designator {$$=$1;} -suffix : t_CharacterLit {$$=$1;} -suffix : t_ALL {$$="all";} - -ifts_name : mark gen_association_list {$$=$1+" "+$2;} -ifts_name : name2 gen_association_list {$$=$1+" "+$2;} - - -sigma: t_Apostrophe {$$="'";} -//sigma : t_LEFTBR signature1 t_RIGHTBR t_Apostrophe {$$="("+$2;;$$.append(")");$$.append("'");} - -attribute_name : mark sigma t_Identifier {$$=$1+"' "+$3;} -attribute_name :attribute_name t_LeftParen expr t_RightParen -attribute_name : name2 sigma t_Identifier {$$=$1+" '"+$3;} -attribute_name : mark sigma t_RANGE {$$=$1+"' range ";} -attribute_name : name2 sigma t_RANGE {$$=$1+"' range ";} - -aggregate : element_association_list2 t_RightParen {$$=$1+" ) ";} -aggregate : t_LeftParen choices t_Arrow expr t_RightParen {$$="( "+$2+ "=>"+$4+" ) ";} - - -element_association_list2 : t_LeftParen element_association t_Comma element_association {$$=" ( "+$2+","+$4;} -element_association_list2 : element_association_list2 t_Comma element_association {$$=$1+","+$3;} - +/* ;relation : unary_operator primary */ -qualified_expr : mark t_Apostrophe t_LeftParen expr t_RightParen {$$=$1+"'("+$4+" ) ";} -qualified_expr : mark t_Apostrophe aggregate {$$=$1+"'"+$3;} +relation: t_QQ primary { $$=" ?? "+$2; } +relation: primary { $$=$1; } +relation: t_Plus primary %prec MED_PRECEDENCE { $$="+"+$2; } +relation: t_Minus primary %prec MED_PRECEDENCE { $$="-"+$2; } +relation: t_ABS primary { $$="abs"+$2; } +relation: t_NOT primary { $$="not "+$2; } +relation: primary t_DoubleStar primary { $$=$1+" ** "+$3; } +relation: t_Minus primary t_DoubleStar primary { $$=$2+" ** "+$4; } +/* ; relation : relation binary_operator primary */ -allocator : t_NEW mark mark allocator_1 -allocator : t_NEW mark allocator_2 -allocator : t_NEW qualified_expr -allocator_2 : /* empty */ -allocator_2 : gen_association_list -allocator_1 : /* empty */ -allocator_1 : gen_association_list +relation: relation t_MOD relation { $$=$1+" mod "+$3; } +relation: relation t_REM relation { $$=$1+" rem "+$3; } +relation: relation t_Ampersand relation { $$=$1+" & "+$3; } +relation: relation t_Star relation { $$=$1+" * "+$3; } +relation: relation t_Plus relation { $$=$1+" + "+$3; } +relation: relation t_Minus relation { $$=$1+" - "+$3; } +relation: relation t_LESym relation { $$=$1+" <= "+$3; } +relation: relation t_GESym relation { $$=$1+" >= "+$3; } +relation: relation t_LTSym relation { $$=$1+" < "+$3; } +relation: relation t_GTSym relation { $$=$1+" > "+$3; } +relation: relation t_EQSym relation { $$=$1+" == "+$3; } +relation: relation t_NESym relation { $$=$1+" != "+$3; } +relation: relation t_Slash relation { $$=$1+" /"+$3; } +relation: relation t_QNEQU relation { $$=$1+" ?/="+$3; } +relation: relation t_QEQU relation { $$=$1+" ?="+$3; } +relation: relation t_QL relation { $$=$1+" ?<"+$3; } +relation: relation t_QG relation { $$=$1+" ?>"+$3; } +relation: relation t_QLT relation { $$=$1+" ?<="+$3; } +relation: relation t_QGT relation { $$=$1+" ?>="+$3; } + +simple_exp: t_Minus term { $$ = "-"+$2; } + | t_Plus term { $$ = "+"+$2; } + | term { $$ = $1; } + | simple_exp + adding_op term { $$ = $1+" "+$2+" "+$3; } + +adding_op: t_Ampersand { $$ = "&"; } + | t_Minus { $$ = "-"; } + | t_Plus { $$ = "+"; } + ; + +term: factor { $$=$1; } + | factor multiplying_operator factor { $$ = $1+" "+$2+" "+$3; } + ; + +multiplying_operator: t_Star { $$ = "*"; } + | t_REM { $$ = "rem"; } + | t_MOD { $$ = "mod"; } + | t_Slash { $$ = "/"; } + +factor: primary { $$=$1; } + | t_ABS primary { $$="abs "+$2; } + | t_NOT primary { $$="not "+$2; } + | primary t_DoubleStar primary { $$ = $1+" ** "+$3; } + +primary: name { $$=$1; } +primary: literal { $$=$1; } +primary: aggregate { $$=$1; } +primary: qualified_expr { $$=$1; } +primary: allocator { $$=""; } +primary: t_LeftParen expr t_RightParen { $$="("+$2+")"; } + +name: mark { $$=$1; } +name: name2 { $$=$1; } +name: external_name { $$=$1; } +name2: t_StringLit { $$=$1; } +name2: attribute_name { $$=$1; } +name2: ifts_name { $$=$1; } + +mark: t_Identifier { $$=$1; } +mark: sel_name { $$=$1; } + +sel_name: name t_Dot suffix { $$=$1+"."+$3; } + +suffix: designator { $$=$1; } +suffix: t_CharacterLit { $$=$1; } +suffix: t_ALL { $$="all"; } + +ifts_name: mark gen_association_list { $$=$1+" "+$2; } +ifts_name: name2 gen_association_list { $$=$1+" "+$2; } + +sigma: t_Apostrophe { $$="'"; } +//sigma : t_LEFTBR signature1 t_RIGHTBR t_Apostrophe { $$="("+$2;;$$.append(")");$$.append("'"); } + +attribute_name: mark sigma t_Identifier { $$=$1+"' "+$3; } +attribute_name: attribute_name t_LeftParen expr t_RightParen +attribute_name: name2 sigma t_Identifier { $$=$1+" '"+$3; } +attribute_name: mark sigma t_RANGE { $$=$1+"' range "; } +attribute_name: name2 sigma t_RANGE { $$=$1+"' range "; } + +aggregate : element_association_list2 t_RightParen { $$=$1+" ) "; } +aggregate : t_LeftParen choices t_Arrow expr t_RightParen { $$="( "+$2+ "=>"+$4+" ) "; } + +element_association_list2 : t_LeftParen element_association t_Comma element_association { $$=" ( "+$2+","+$4; } +element_association_list2 : element_association_list2 t_Comma element_association { $$=$1+","+$3; } + +qualified_expr : mark t_Apostrophe t_LeftParen expr t_RightParen { $$=$1+"'("+$4+" ) "; } +qualified_expr : mark t_Apostrophe aggregate { $$=$1+"'"+$3; } + +allocator: t_NEW mark mark allocator_1 +allocator: t_NEW mark allocator_2 +allocator: t_NEW qualified_expr +allocator_2: /* empty */ +allocator_2: gen_association_list +allocator_1: /* empty */ +allocator_1: gen_association_list /*-------------------------------------------------- -- Element Association and Choices ----------------------------------------------------*/ -element_association : choices t_Arrow expr {$$=$1+"=> "+$3;} - -element_association : expr {$$=$1;} +element_association: choices t_Arrow expr { $$=$1+"=> "+$3; } +element_association: expr { $$=$1; } -choices : choice choices_1 {$$=$1+" "+$2;} -choices_1 : /* empty */ {$$="";} -choices_1 : choices_1 choices_2 {$$=$1+" "+$2;} -choices_2 : t_Bar choice {$$=" | "+$2;} +choices: choice choices_1 { $$=$1+" "+$2; } +choices_1: /* empty */ { $$=""; } +choices_1: choices_1 choices_2 { $$=$1+" "+$2; } +choices_2: t_Bar choice { $$=" | "+$2; } -choice : expr {$$=$1;} -choice : discrete_range1 {$$=$1;} -choice : t_OTHERS {$$="others";} +choice: expr { $$=$1; } +choice: discrete_range1 { $$=$1; } +choice: t_OTHERS { $$="others"; } /*-------------------------------------------------- -- Type Declarations ----------------------------------------------------*/ -type_decl : t_TYPE t_Identifier error t_Semicolon {$$="";} -type_decl : t_TYPE t_Identifier type_decl_1 t_Semicolon - { - addVhdlType($2,getParsedLine(t_TYPE),Entry::VARIABLE_SEC,VhdlDocGen::TYPE,0,$3.data()); - } - type_decl : t_TYPE error t_Semicolon {$$="";} - -type_decl_1 : /* empty */ {$$="";} -type_decl_1 : t_IS type_definition {$$="is "+$2;} - -type_definition : enumeration_type_definition {$$=$1;} -type_definition : range_constraint {$$=$1;} -type_definition : physical_type_definition { $$=$1; } -type_definition : unconstrained_array_definition {$$=$1;} -type_definition : constrained_array_definition {$$=$1;} -type_definition : record_type_definition {$$=$1;} -type_definition : access_type_definition {$$=$1;} -type_definition : file_type_definition {$$=$1;} -type_definition : protected_type_declaration {$$=$1;} -type_definition : protected_type_body {$$=$1;} - - -enumeration_type_definition : t_LeftParen enumeration_literal enumeration_type_definition_1 t_RightParen {$$="( "+$2+" "+$3+" )";} -enumeration_type_definition_1 : {$$="";} -enumeration_type_definition_1 : enumeration_type_definition_1 enumeration_type_definition_2 {$$=$1+" "+$2;} -enumeration_type_definition_2 : t_Comma enumeration_literal {$$=","+$2;} +type_decl: t_TYPE t_Identifier error t_Semicolon { $$=""; } +type_decl: t_TYPE t_Identifier type_decl_1 t_Semicolon + { + addVhdlType($2,getParsedLine(t_TYPE),Entry::VARIABLE_SEC,VhdlDocGen::TYPE,0,$3.data()); + } +type_decl: t_TYPE error t_Semicolon { $$=""; } + +type_decl_1: /* empty */ { $$=""; } +type_decl_1: t_IS type_definition { $$="is "+$2; } + +type_definition: enumeration_type_definition { $$=$1; } +type_definition: range_constraint { $$=$1; } +type_definition: physical_type_definition { $$=$1; } +type_definition: unconstrained_array_definition { $$=$1; } +type_definition: constrained_array_definition { $$=$1; } +type_definition: record_type_definition { $$=$1; } +type_definition: access_type_definition { $$=$1; } +type_definition: file_type_definition { $$=$1; } +type_definition: protected_type_declaration { $$=$1; } +type_definition: protected_type_body { $$=$1; } + + +enumeration_type_definition: t_LeftParen enumeration_literal enumeration_type_definition_1 t_RightParen { $$="( "+$2+" "+$3+" )"; } +enumeration_type_definition_1: { $$=""; } +enumeration_type_definition_1: enumeration_type_definition_1 enumeration_type_definition_2 { $$=$1+" "+$2; } +enumeration_type_definition_2: t_Comma enumeration_literal { $$=","+$2; } physical_type_definition : range_constraint t_UNITS base_unit_decl -physical_type_definition_1 t_END unit_stat - { - $$=$1; - current->args=$3+"#"+$4; - current->args.prepend("units"); - current->spec=VhdlDocGen::UNITS; - } + physical_type_definition_1 t_END unit_stat + { + $$=$1; + current->args=$3+"#"+$4; + current->args.prepend("units"); + current->spec=VhdlDocGen::UNITS; + } -unit_stat: t_UNITS t_Identifier -unit_stat : t_UNITS +unit_stat: t_UNITS t_Identifier +unit_stat: t_UNITS +physical_type_definition_1: /* empty */ { $$=""; } +physical_type_definition_1: physical_type_definition_1 physical_type_definition_2 { $$=$1+" "+$2; } +physical_type_definition_2: secondary_unit_decl { $$=$1+"#"; } -physical_type_definition_1 : /* empty */ {$$="";} -physical_type_definition_1 : physical_type_definition_1 physical_type_definition_2 {$$=$1+" "+$2;} -physical_type_definition_2 : secondary_unit_decl {$$=$1+"#";} +base_unit_decl: t_Identifier t_Semicolon { $$=$1; } -base_unit_decl : t_Identifier t_Semicolon {$$=$1;} +secondary_unit_decl: t_Identifier t_EQSym physical_literal t_Semicolon { $$=$1+"="+$3 } -secondary_unit_decl : t_Identifier t_EQSym physical_literal t_Semicolon {$$=$1+"="+$3} +unconstrained_array_definition: t_ARRAY t_LeftParen + index_subtype_definition unconstrained_array_definition_1 t_RightParen t_OF + subtype_indic + { + QCString sr1=" array ( "+$3+" "+$4; + QCString sr2=" ) of "+$7; + $$=sr1+sr2; + } -unconstrained_array_definition : t_ARRAY t_LeftParen -index_subtype_definition unconstrained_array_definition_1 t_RightParen t_OF -subtype_indic -{ - QCString sr1=" array ( "+$3+" "+$4; - QCString sr2=" ) of "+$7; +unconstrained_array_definition_1: { $$=""; } +unconstrained_array_definition_1: unconstrained_array_definition_1 unconstrained_array_definition_2 { $$=$1+" "+$2 } +unconstrained_array_definition_2: t_Comma index_subtype_definition { $$=", "+$2 } - $$=sr1+sr2; -} +index_subtype_definition: mark t_RANGE t_Box { $$=$1+" range<> "; } -unconstrained_array_definition_1 : {$$="";} -unconstrained_array_definition_1 : unconstrained_array_definition_1 unconstrained_array_definition_2 {$$=$1+" "+$2} -unconstrained_array_definition_2 : t_Comma index_subtype_definition {$$=", "+$2} +constrained_array_definition: t_ARRAY index_constraint t_OF subtype_indic { $$=" array "+$2+" of "+$4; } -index_subtype_definition : mark t_RANGE t_Box {$$=$1+" range<> ";} +record_type_simple_name:/*empty*/ { $$=""; } + | t_Identifier { $$=$1; } -constrained_array_definition : t_ARRAY index_constraint t_OF subtype_indic {$$=" array "+$2+" of "+$4;} +record_type_definition: t_RECORD element_decl record_type_definition_1 t_END + t_RECORD record_type_simple_name + { + QRegExp reg("[\\s]"); + QCString oo=$2+" "+$3; + current->spec=VhdlDocGen::RECORD; + current->args=oo; + current->args.replace(reg,"%"); + current->args.prepend("record"); + $$=$2+" "+$3; + } -record_type_simple_name :/*empty*/ {$$="";} - | t_Identifier {$$=$1;} - -record_type_definition : t_RECORD element_decl record_type_definition_1 t_END -t_RECORD record_type_simple_name -{ - QRegExp reg("[\\s]"); - QCString oo=$2+" "+$3; - current->spec=VhdlDocGen::RECORD; - current->args=oo; - current->args.replace(reg,"%"); - current->args.prepend("record"); - $$=$2+" "+$3; -} - -record_type_definition_1 : /*empty*/ {$$="";} -record_type_definition_1 : record_type_definition_1 record_type_definition_2 - { - $$=$1+" "+$2; +record_type_definition_1: /*empty*/ { $$=""; } +record_type_definition_1: record_type_definition_1 record_type_definition_2 + { + $$=$1+" "+$2; } -record_type_definition_2 : element_decl {$$=$1;} +record_type_definition_2: element_decl { $$=$1; } -element_decl : idf_list t_Colon subtype_indic t_Semicolon {$$=$1+":"+$3+"#"; } +element_decl: idf_list t_Colon subtype_indic t_Semicolon { $$=$1+":"+$3+"#"; } -access_type_definition : t_ACCESS subtype_indic {$$="access "+$2; } +access_type_definition: t_ACCESS subtype_indic { $$="access "+$2; } -file_type_definition : t_FILE t_OF mark {$$="file of "+$3; } +file_type_definition: t_FILE t_OF mark { $$="file of "+$3; } /*-------------------------------------------------- -- Subtypes and Constraints ----------------------------------------------------*/ -subtype_decl : t_SUBTYPE t_Identifier t_IS subtype_indic t_Semicolon - { - addVhdlType($2,getParsedLine(t_SUBTYPE),Entry::VARIABLE_SEC,VhdlDocGen::SUBTYPE,0,$4.data()); - } -subtype_decl : t_SUBTYPE error t_Semicolon {$$="";} -subtype_indic : mark subtype_indic_1 {$$=$1+" "+$2;}; -subtype_indic : subtype_indic1 {$$=$1;} -subtype_indic_1 : /* empty */ {$$="";} -subtype_indic_1 : gen_association_list {$$=$1;} - -subtype_indic1 : mark mark range_constraint {$$=$1+" "+$2+" "+$3;}; -subtype_indic1 : mark range_constraint {$$=$1+" "+$2;} -subtype_indic1 : mark mark subtype_indic1_1 {$$=$1+" "+$2+" "+$3;} -subtype_indic1_1 : /* empty */ {$$="";} -subtype_indic1_1 : gen_association_list {$$=$1;} - -range_constraint : t_RANGE range_spec { $$="range "+$2;} +subtype_decl: t_SUBTYPE t_Identifier t_IS subtype_indic t_Semicolon + { + addVhdlType($2,getParsedLine(t_SUBTYPE),Entry::VARIABLE_SEC,VhdlDocGen::SUBTYPE,0,$4.data()); + } +subtype_decl: t_SUBTYPE error t_Semicolon { $$=""; } +subtype_indic: mark subtype_indic_1 { $$=$1+" "+$2; } +subtype_indic: subtype_indic1 { $$=$1; } +subtype_indic_1: /* empty */ { $$=""; } +subtype_indic_1: gen_association_list { $$=$1; } + +subtype_indic1: mark mark range_constraint { $$=$1+" "+$2+" "+$3; } +subtype_indic1: mark range_constraint { $$=$1+" "+$2; } +subtype_indic1: mark mark subtype_indic1_1 { $$=$1+" "+$2+" "+$3; } +subtype_indic1_1: /* empty */ { $$=""; } +subtype_indic1_1: gen_association_list { $$=$1; } + +range_constraint: t_RANGE range_spec { $$="range "+$2; } //range_constraint : array_constraint +index_constraint: t_LeftParen discrete_range + index_constraint_1 + t_RightParen { $$="("+$2+" "+$3+")"; } +index_constraint_1: /* empty */ { $$=""; } +index_constraint_1: index_constraint_1 + index_constraint_2 { $$=$1+" "+$2; } +index_constraint_2: t_Comma discrete_range { $$=","+$2; } -index_constraint : t_LeftParen discrete_range index_constraint_1 t_RightParen { $$="("+$2+" "+$3+")";} -index_constraint_1 : /* empty */ {$$="";} -index_constraint_1 : index_constraint_1 index_constraint_2 { $$=$1+" "+$2;} -index_constraint_2 : t_Comma discrete_range { $$=","+$2;} - +discrete_range: subtype_indic { $$=$1; } +discrete_range: range_spec { $$=$1; } -discrete_range : subtype_indic { $$=$1;} -discrete_range : range_spec { $$=$1;} +discrete_range1 : subtype_indic1 { $$=$1; } +discrete_range1 : expr direction expr { $$=$1+" "+$2+" "+$3; } -discrete_range1 : subtype_indic1 { $$=$1;} -discrete_range1 : expr direction expr { $$=$1+" "+$2+" "+$3;} +range_spec : attribute_name { $$=$1; } +range_spec : simple_exp direction simple_exp { $$=$1+" "+$2+" "+$3; } -range_spec : attribute_name { $$=$1;} -range_spec : simple_exp direction simple_exp { $$=$1+" "+$2+" "+$3;} - - -direction : t_TO {$$=" to ";} -direction : t_DOWNTO {$$=" downto ";} +direction : t_TO { $$=" to "; } +direction : t_DOWNTO { $$=" downto "; } /*-------------------------------------------------- -- Objects, Aliases, Files, Disconnections ----------------------------------------------------*/ -constant_decl : t_CONSTANT idf_list t_Colon subtype_indic constant_decl_1 t_Semicolon - { - QCString it=$4+" "+$5; - // fprintf(stderr,"\n currP %d \n",currP); - addVhdlType($2,getParsedLine(t_CONSTANT),Entry::VARIABLE_SEC,VhdlDocGen::CONSTANT,0,it.data()); - } -constant_decl_1 : /* empty */ {$$="";} -constant_decl_1 : t_VarAsgn expr {$$=":="+$2;} +constant_decl: t_CONSTANT idf_list t_Colon subtype_indic constant_decl_1 t_Semicolon + { + QCString it=$4+" "+$5; + // fprintf(stderr,"\n currP %d \n",currP); + addVhdlType($2,getParsedLine(t_CONSTANT),Entry::VARIABLE_SEC,VhdlDocGen::CONSTANT,0,it.data()); + } +constant_decl_1: /* empty */ { $$=""; } +constant_decl_1: t_VarAsgn expr { $$=":="+$2; } -signal_decl : t_SIGNAL idf_list t_Colon subtype_indic signal_decl_1 signal_decl_2 t_Semicolon - { - QCString s=$4+" "+$6; - addVhdlType($2,getParsedLine(t_SIGNAL),Entry::VARIABLE_SEC,VhdlDocGen::SIGNAL,0,s.data()); - } -signal_decl_2 : /* empty */ {$$="";} -signal_decl_2 : t_VarAsgn expr {$$=":="+$2;} -signal_decl_1 : /* empty */ {$$="";} -signal_decl_1 : signal_kind { - $$=$1; - } +signal_decl: t_SIGNAL idf_list t_Colon subtype_indic signal_decl_1 signal_decl_2 t_Semicolon + { + QCString s=$4+" "+$6; + addVhdlType($2,getParsedLine(t_SIGNAL),Entry::VARIABLE_SEC,VhdlDocGen::SIGNAL,0,s.data()); + } +signal_decl_2: /* empty */ { $$=""; } +signal_decl_2: t_VarAsgn expr { $$=":="+$2; } +signal_decl_1: /* empty */ { $$=""; } +signal_decl_1: signal_kind { $$=$1; } +variable_decl: t_VARIABLE idf_list t_Colon subtype_indic variable_decl_1 t_Semicolon + { + $$=$2+":"+$4+" "+$5; + } +variable_decl: t_SHARED t_VARIABLE idf_list t_Colon subtype_indic variable_decl_1 t_Semicolon + { + $$=$5+" "+$6; + addVhdlType($3,getParsedLine(t_VARIABLE),Entry::VARIABLE_SEC,VhdlDocGen::SHAREDVARIABLE,0,$$.data()); + } +variable_decl_1: /* empty */ { $$=""; } +variable_decl_1: t_VarAsgn expr { $$=":="+$2; } + +object_class: t_CONSTANT { $$="constant"; } +object_class: t_SIGNAL { $$="signal"; } +object_class: t_VARIABLE { $$="variable"; } +object_class: t_SHARED t_VARIABLE { $$="shared"; } +object_class: t_FILE { $$="file"; } +object_class: t_TYPE { $$="type"; } +signal_kind: t_BUS { $$="bus"; } +signal_kind: t_REGISTER { $$="register"; } -variable_decl : t_VARIABLE idf_list t_Colon subtype_indic variable_decl_1 t_Semicolon +alias_decl: t_ALIAS alias_name_stat alias_spec t_IS name signature t_Semicolon { - $$=$2+":"+$4+" "+$5; - } -variable_decl : t_SHARED t_VARIABLE idf_list t_Colon subtype_indic variable_decl_1 t_Semicolon - { - $$=$5+" "+$6; - addVhdlType($3,getParsedLine(t_VARIABLE),Entry::VARIABLE_SEC,VhdlDocGen::SHAREDVARIABLE,0,$$.data()); - } -variable_decl_1 : /* empty */ {$$="";} -variable_decl_1 : t_VarAsgn expr {$$=":="+$2;} - -object_class : t_CONSTANT {$$="constant";} -object_class : t_SIGNAL {$$="signal";} -object_class : t_VARIABLE {$$="variable";} -object_class :t_SHARED t_VARIABLE {$$="shared";} -object_class :t_FILE {$$="file";} -object_class :t_TYPE {$$="type";} - -signal_kind : t_BUS {$$="bus";} -signal_kind : t_REGISTER {$$="register";} - -alias_decl : t_ALIAS alias_name_stat alias_spec t_IS name signature t_Semicolon - { - QCString s=$3+" "+$5+$6; - addVhdlType($2,getParsedLine(t_ALIAS),Entry::VARIABLE_SEC,VhdlDocGen::ALIAS,0,s.data()); - } - alias_decl : t_ALIAS alias_name_stat alias_spec t_IS error t_Semicolon {$$="";} - - alias_name_stat : t_Identifier {$$=$1;} - alias_name_stat : t_StringLit {$$=$1;} - - alias_spec :/*empty*/ {$$="";} - | t_Colon subtype_indic { $$=","+$2;} - ; - - -file_decl : t_FILE idf_list t_Colon subtype_indic t_IS file_decl_1 expr t_Semicolon - { - addVhdlType($2,getParsedLine(t_FILE),Entry::VARIABLE_SEC,VhdlDocGen::VFILE,0,$4.data()); - } - -file_decl : t_FILE idf_list t_Colon t_Identifier fi_dec t_Semicolon - { - QCString s=$4+" "+$5; - addVhdlType($2,getParsedLine(t_FILE),Entry::VARIABLE_SEC,VhdlDocGen::VFILE,0,s.data()); - } + QCString s=$3+" is "+$5+$6; + addVhdlType($2,getParsedLine(t_ALIAS),Entry::VARIABLE_SEC,VhdlDocGen::ALIAS,0,s.data()); + } +alias_decl: t_ALIAS alias_name_stat alias_spec t_IS error t_Semicolon { $$=""; } + +alias_name_stat: t_Identifier { $$=$1; } +alias_name_stat: t_StringLit { $$=$1; } + +alias_spec :/*empty*/ { $$=""; } + | t_Colon subtype_indic { $$=","+$2; } + ; + +file_decl: t_FILE idf_list t_Colon subtype_indic t_IS file_decl_1 expr t_Semicolon + { + addVhdlType($2,getParsedLine(t_FILE),Entry::VARIABLE_SEC,VhdlDocGen::VFILE,0,$4.data()); + } -fi_dec: /*empty*/ {$$="";} - | t_OPEN expr t_IS expr {$$="open "+$2+" is "+s_str.qstr; } +file_decl: t_FILE idf_list t_Colon t_Identifier fi_dec t_Semicolon + { + QCString s=$4+" "+$5; + addVhdlType($2,getParsedLine(t_FILE),Entry::VARIABLE_SEC,VhdlDocGen::VFILE,0,s.data()); + } +fi_dec: /*empty*/ { $$=""; } + | t_OPEN expr t_IS expr { $$="open "+$2+" is "+s_str.qstr; } -file_decl_1 : /* empty */ {$$="";} -file_decl_1 : mode {$$=$1;} -disconnection_spec : t_DISCONNECT signal_list t_Colon mark t_AFTER expr t_Semicolon +file_decl_1: /* empty */ { $$=""; } +file_decl_1: mode { $$=$1; } -signal_list : name signal_list_1 -signal_list : t_OTHERS -signal_list : t_ALL -signal_list_1 : /* empty */ -signal_list_1 : signal_list_1 signal_list_2 -signal_list_2 : t_Comma name +disconnection_spec: t_DISCONNECT signal_list t_Colon mark t_AFTER expr t_Semicolon + +signal_list: name signal_list_1 +signal_list: t_OTHERS +signal_list: t_ALL +signal_list_1: /* empty */ +signal_list_1: signal_list_1 signal_list_2 +signal_list_2: t_Comma name /*-------------------------------------------------- -- Attribute Declarations and Specifications ----------------------------------------------------*/ -attribute_decl : t_ATTRIBUTE t_Identifier t_Colon mark t_Semicolon - { - addVhdlType($2,getParsedLine(t_ATTRIBUTE),Entry::VARIABLE_SEC,VhdlDocGen::ATTRIBUTE,0,$4.data()); - } - -attribute_spec : t_ATTRIBUTE t_Identifier t_OF entity_spec t_IS expr t_Semicolon - { - QCString oo=$4+" is "+$6; - addVhdlType($2,getParsedLine(t_ATTRIBUTE),Entry::VARIABLE_SEC,VhdlDocGen::ATTRIBUTE,0,oo.data()); - } - -entity_spec : entity_name_list signature t_Colon entity_class - -entity_name_list : designator entity_name_list_1 {$$=$1+" "+$2;} -entity_name_list : t_OTHERS {$$="others";} -entity_name_list : t_ALL {$$="all";} -entity_name_list_1 : /* empty */ {$$="";} -entity_name_list_1 : entity_name_list_1 entity_name_list_2 {$$=$1+" "+$2;} -entity_name_list_2 : t_Comma designator {$$=","+$2;} - -entity_class : t_ENTITY {$$="entity";} -entity_class : t_ARCHITECTURE {$$="architecture";} -entity_class : t_PACKAGE {$$="package";} -entity_class : t_CONFIGURATION {$$="configuration";} -entity_class : t_COMPONENT {$$="component";} -entity_class : t_LABEL {$$="label";} -entity_class : t_TYPE {$$="type";} -entity_class : t_SUBTYPE {$$="subtype";} -entity_class : t_PROCEDURE {$$="procedure";} -entity_class : t_FUNCTION {$$="";} -entity_class : t_SIGNAL {$$="signal";} -entity_class : t_VARIABLE {$$="variable";} -entity_class : t_CONSTANT {$$="constant";} -entity_class : t_GROUP {$$="group";} -entity_class : t_FILE {$$="file";} -entity_class : t_UNITS {$$="units";} -entity_class : t_LITERAL {$$="literal";} -entity_class : t_SEQUENCE {$$="sequence";} -entity_class : t_PROPERTY {$$="property";} +attribute_decl: t_ATTRIBUTE t_Identifier t_Colon mark t_Semicolon + { + addVhdlType($2,getParsedLine(t_ATTRIBUTE),Entry::VARIABLE_SEC,VhdlDocGen::ATTRIBUTE,0,$4.data()); + } + +attribute_spec: t_ATTRIBUTE t_Identifier t_OF entity_spec t_IS expr t_Semicolon + { + QCString oo=$4+" is "+$6; + addVhdlType($2,getParsedLine(t_ATTRIBUTE),Entry::VARIABLE_SEC,VhdlDocGen::ATTRIBUTE,0,oo.data()); + } + +entity_spec : entity_name_list signature t_Colon entity_class + +entity_name_list: designator entity_name_list_1 { $$=$1+" "+$2; } +entity_name_list: t_OTHERS { $$="others"; } +entity_name_list: t_ALL { $$="all"; } +entity_name_list_1: /* empty */ { $$=""; } +entity_name_list_1: entity_name_list_1 entity_name_list_2 { $$=$1+" "+$2; } +entity_name_list_2: t_Comma designator { $$=","+$2; } + +entity_class: t_ENTITY { $$="entity"; } +entity_class: t_ARCHITECTURE { $$="architecture"; } +entity_class: t_PACKAGE { $$="package"; } +entity_class: t_CONFIGURATION { $$="configuration"; } +entity_class: t_COMPONENT { $$="component"; } +entity_class: t_LABEL { $$="label"; } +entity_class: t_TYPE { $$="type"; } +entity_class: t_SUBTYPE { $$="subtype"; } +entity_class: t_PROCEDURE { $$="procedure"; } +entity_class: t_FUNCTION { $$=""; } +entity_class: t_SIGNAL { $$="signal"; } +entity_class: t_VARIABLE { $$="variable"; } +entity_class: t_CONSTANT { $$="constant"; } +entity_class: t_GROUP { $$="group"; } +entity_class: t_FILE { $$="file"; } +entity_class: t_UNITS { $$="units"; } +entity_class: t_LITERAL { $$="literal"; } +entity_class: t_SEQUENCE { $$="sequence"; } +entity_class: t_PROPERTY { $$="property"; } /*-------------------------------------------------- @@ -1229,738 +1280,782 @@ entity_class : t_PROPERTY {$$="property" --------------------------------------------------------------------------*/ +if_generation_scheme: if_scheme -if_generation_scheme : if_scheme +if_scheme: t_IF expr t_GENERATE generate_statement_body if_scheme_1 if_scheme_2 +if_scheme: t_IF lable expr t_GENERATE generate_statement_body if_scheme_1 if_scheme_2 +if_scheme_2: /* empty */ +if_scheme_2: t_ELSE t_GENERATE generate_statement_body +if_scheme_2: t_ELSE lable t_GENERATE generate_statement_body +if_scheme_1: /* empty */ +if_scheme_1: if_scheme_1 if_scheme_3 +if_scheme_3: t_ELSIF expr t_GENERATE generate_statement_body +if_scheme_3: t_ELSIF lable expr t_GENERATE generate_statement_body -if_scheme : t_IF expr t_GENERATE generate_statement_body if_scheme_1 if_scheme_2 -if_scheme : t_IF lable expr t_GENERATE generate_statement_body if_scheme_1 if_scheme_2 +generation_scheme: for_scheme -if_scheme_2 : /* empty */ -if_scheme_2 : t_ELSE t_GENERATE generate_statement_body -if_scheme_2 : t_ELSE lable t_GENERATE generate_statement_body -if_scheme_1 : /* empty */ -if_scheme_1 : if_scheme_1 if_scheme_3 -if_scheme_3 : t_ELSIF expr t_GENERATE generate_statement_body -if_scheme_3 : t_ELSIF lable expr t_GENERATE generate_statement_body +iteration_scheme: for_scheme +iteration_scheme: while_scheme -generation_scheme : for_scheme +for_scheme: t_FOR t_Identifier t_IN discrete_range +for_scheme: t_FOR lable t_Identifier t_IN discrete_range -iteration_scheme : for_scheme -iteration_scheme : while_scheme - -for_scheme : t_FOR t_Identifier t_IN discrete_range -for_scheme : t_FOR lable t_Identifier t_IN discrete_range - -while_scheme : t_WHILE expr +while_scheme: t_WHILE expr /*-------------------------------------------------- -- Concurrent Statements ----------------------------------------------------*/ -concurrent_stats : concurrent_stats_1 -concurrent_stats_1 : /* empty */ -concurrent_stats_1 : concurrent_stats_1 concurrent_stats_2 -concurrent_stats_2 : concurrent_stat - -concurrent_stat : block_stat - | concurrent_assertion_stat - | concurrent_procedure_call - | concurrent_signal_assign_stat - | comp_inst_stat - | generate_stat - | procs_stat - -block_stat : t_Identifier t_Colon t_BLOCK block_stat_0 block_stat_1 block_stat_2 -block_stat_3 block_stat_4 t_BEGIN concurrent_stats t_END t_BLOCK block_stat_5 -t_Semicolon -block_stat_5 : /* empty */ -block_stat_5 : t_Identifier -block_stat_4 : /* empty */ -block_stat_4 : block_stat_4 block_stat_6 -block_stat_6 : block_decltve_item -block_stat_3 : /* empty */ -block_stat_3 : t_PORT interf_list t_Semicolon block_stat_7 -//block_sta_7 : /* empty */ -block_stat_7 : t_PORT t_MAP association_list t_Semicolon -block_stat_2 : /* empty */ -block_stat_2 : t_GENERIC interf_list t_Semicolon block_stat_8 -block_stat_8 : /* empty */ -block_stat_8 : t_GENERIC t_MAP association_list t_Semicolon -block_stat_1 : /* empty */ -block_stat_1 : t_LeftParen expr t_RightParen block_stat_0 -block_stat_0: /* empty */ +concurrent_stats: concurrent_stats_1 +concurrent_stats_1: /* empty */ +concurrent_stats_1: concurrent_stats_1 concurrent_stats_2 +concurrent_stats_2: concurrent_stat + +concurrent_stat : block_stat + | concurrent_assertion_stat + | concurrent_procedure_call + | concurrent_signal_assign_stat + | comp_inst_stat + | generate_stat + | procs_stat + +block_stat: t_Identifier t_Colon t_BLOCK block_stat_0 block_stat_1 block_stat_2 + block_stat_3 block_stat_4 t_BEGIN concurrent_stats t_END t_BLOCK block_stat_5 + t_Semicolon +block_stat_5: /* empty */ +block_stat_5: t_Identifier +block_stat_4: /* empty */ +block_stat_4: block_stat_4 block_stat_6 +block_stat_6: block_decltve_item +block_stat_3: /* empty */ +block_stat_3: t_PORT interf_list t_Semicolon block_stat_7 +//block_sta_7: /* empty */ +block_stat_7: t_PORT t_MAP association_list t_Semicolon +block_stat_2: /* empty */ +block_stat_2: t_GENERIC interf_list t_Semicolon block_stat_8 +block_stat_8: /* empty */ +block_stat_8: t_GENERIC t_MAP association_list t_Semicolon +block_stat_1: /* empty */ +block_stat_1: t_LeftParen expr t_RightParen block_stat_0 +block_stat_0: /* empty */ block_stat_0: t_IS -dot_name:t_Identifier {$$=$1;} - | dot_name t_Dot t_Identifier {$$=$1+"."+$3;} - ; - -mark_comp: dot_name comp_1 {$$=$1+" "+$2;} -mark_comp: dot_name {$$=$1;} - -comp_1: t_LeftParen t_Identifier t_RightParen {$$="("+$2+")";} - - vcomp_stat :t_CONFIGURATION {$$="configurátion";yyLineNr=s_str.iLine;} - vcomp_stat : t_ENTITY {$$="entity";yyLineNr=s_str.iLine;} - vcomp_stat : t_COMPONENT {$$="component";yyLineNr=s_str.iLine;} - -comp_inst_stat : t_Identifier t_Colon name {yyLineNr=s_str.iLine;} t_GENERIC t_MAP association_list comp_inst_stat_1 t_Semicolon +dot_name: t_Identifier { $$=$1; } + | dot_name t_Dot t_Identifier { $$=$1+"."+$3; } + ; + +mark_comp: dot_name comp_1 { $$=$1+" "+$2; } +mark_comp: dot_name { $$=$1; } + +comp_1: t_LeftParen t_Identifier t_RightParen { $$="("+$2+")"; } + +vcomp_stat: t_CONFIGURATION { $$="configurátion";yyLineNr=s_str.iLine; } +vcomp_stat: t_ENTITY { $$="entity";yyLineNr=s_str.iLine; } +vcomp_stat: t_COMPONENT { $$="component";yyLineNr=s_str.iLine; } + +comp_inst_stat: t_Identifier t_Colon name { yyLineNr=s_str.iLine; } t_GENERIC t_MAP association_list comp_inst_stat_1 t_Semicolon { addCompInst($1.data(),$3.data(),0,yyLineNr); } -comp_inst_stat : t_Identifier t_Colon name {yyLineNr=s_str.iLine;} t_PORT t_MAP association_list t_Semicolon +comp_inst_stat: t_Identifier t_Colon name { yyLineNr=s_str.iLine; } t_PORT t_MAP association_list t_Semicolon { addCompInst($1.data(),$3.data(),0,yyLineNr); } -comp_inst_stat : t_Identifier t_Colon vcomp_stat mark_comp t_PORT t_MAP association_list t_Semicolon +comp_inst_stat: t_Identifier t_Colon vcomp_stat mark_comp t_PORT t_MAP association_list t_Semicolon { addCompInst($1.data(),$4.data(),$3.data(),yyLineNr); } -comp_inst_stat : t_Identifier t_Colon vcomp_stat mark_comp t_GENERIC t_MAP association_list comp_inst_stat_1 t_Semicolon +comp_inst_stat: t_Identifier t_Colon vcomp_stat mark_comp t_GENERIC t_MAP association_list comp_inst_stat_1 t_Semicolon { addCompInst($1.data(),$4.data(),$3.data(),yyLineNr); - } -comp_inst_stat_1 : /* empty */ -comp_inst_stat_1 : t_PORT t_MAP association_list - -concurrent_assertion_stat : t_Identifier t_Colon assertion_stat -concurrent_assertion_stat : assertion_stat - -concurrent_assertion_stat : t_Identifier t_Colon t_POSTPONED assertion_stat -concurrent_assertion_stat : t_POSTPONED assertion_stat + } +comp_inst_stat_1: /* empty */ +comp_inst_stat_1: t_PORT t_MAP association_list -concurrent_procedure_call : t_Identifier t_Colon procedure_call_stat -concurrent_procedure_call : procedure_call_stat +concurrent_assertion_stat: t_Identifier t_Colon assertion_stat +concurrent_assertion_stat: assertion_stat -concurrent_procedure_call : t_Identifier t_Colon t_POSTPONED procedure_call_stat -concurrent_procedure_call : t_POSTPONED procedure_call_stat +concurrent_assertion_stat: t_Identifier t_Colon t_POSTPONED assertion_stat +concurrent_assertion_stat: t_POSTPONED assertion_stat +concurrent_procedure_call: t_Identifier t_Colon procedure_call_stat +concurrent_procedure_call: procedure_call_stat -concurrent_signal_assign_stat : t_Identifier t_Colon condal_signal_assign -concurrent_signal_assign_stat : condal_signal_assign +concurrent_procedure_call: t_Identifier t_Colon t_POSTPONED procedure_call_stat +concurrent_procedure_call: t_POSTPONED procedure_call_stat -concurrent_signal_assign_stat : t_Identifier t_Colon t_POSTPONED condal_signal_assign -concurrent_signal_assign_stat : t_POSTPONED condal_signal_assign +concurrent_signal_assign_stat: t_Identifier t_Colon condal_signal_assign +concurrent_signal_assign_stat: condal_signal_assign -concurrent_signal_assign_stat : t_Identifier t_Colon t_POSTPONED sel_signal_assign -concurrent_signal_assign_stat : t_POSTPONED sel_signal_assign +concurrent_signal_assign_stat: t_Identifier t_Colon t_POSTPONED condal_signal_assign +concurrent_signal_assign_stat: t_POSTPONED condal_signal_assign -concurrent_signal_assign_stat : t_Identifier t_Colon sel_signal_assign -concurrent_signal_assign_stat : sel_signal_assign +concurrent_signal_assign_stat: t_Identifier t_Colon t_POSTPONED sel_signal_assign +concurrent_signal_assign_stat: t_POSTPONED sel_signal_assign +concurrent_signal_assign_stat: t_Identifier t_Colon sel_signal_assign +concurrent_signal_assign_stat: sel_signal_assign -condal_signal_assign : target t_LESym opts condal_wavefrms t_Semicolon +condal_signal_assign: target t_LESym opts condal_wavefrms t_Semicolon -condal_wavefrms:wavefrm -condal_wavefrms:wavefrm t_WHEN expr -condal_wavefrms:wavefrm t_WHEN expr t_ELSE condal_wavefrms +condal_wavefrms: wavefrm +condal_wavefrms: wavefrm t_WHEN expr +condal_wavefrms: wavefrm t_WHEN expr t_ELSE condal_wavefrms -wavefrm : wavefrm_element wavefrm_1 -wavefrm : t_UNAFFECTED -wavefrm_1 : /* empty */ -wavefrm_1 : wavefrm_1 wavefrm_2 -wavefrm_2 : t_Comma wavefrm_element +wavefrm: wavefrm_element wavefrm_1 +wavefrm: t_UNAFFECTED +wavefrm_1: /* empty */ +wavefrm_1: wavefrm_1 wavefrm_2 +wavefrm_2: t_Comma wavefrm_element -wavefrm_element : expr wavefrm_element_1 -wavefrm_element_1 : /* empty */ -wavefrm_element_1 : t_AFTER expr -wavefrm_element_1 : t_NULL wavefrm_element_2 -wavefrm_element_1 : t_NULL - +wavefrm_element: expr wavefrm_element_1 +wavefrm_element_1: /* empty */ +wavefrm_element_1: t_AFTER expr +wavefrm_element_1: t_NULL wavefrm_element_2 +wavefrm_element_1: t_NULL +wavefrm_element_2: t_AFTER expr -wavefrm_element_2 : t_AFTER expr - -target : name -target : aggregate +target: name +target: aggregate -opts : opts_1 opts_2 +opts: opts_1 opts_2 -opts_2 : /* empty */ -opts_2 : t_TRANSPORT -opts_2 : t_REJECT expr t_INERTIAL -opts_2 : t_INERTIAL +opts_2: /* empty */ +opts_2: t_TRANSPORT +opts_2: t_REJECT expr t_INERTIAL +opts_2: t_INERTIAL -opts_1 : /* empty */ -opts_1 : t_GUARDED +opts_1: /* empty */ +opts_1: t_GUARDED -sel_signal_assign : t_WITH expr t_SELECT target t_LESym opts sel_wavefrms t_Semicolon +sel_signal_assign: t_WITH expr t_SELECT target t_LESym opts sel_wavefrms t_Semicolon -sel_wavefrms : sel_wavefrms_1 wavefrm t_WHEN choices -sel_wavefrms_1 : /* empty */ -sel_wavefrms_1 : sel_wavefrms_1 sel_wavefrms_2 -sel_wavefrms_2 : wavefrm t_WHEN choices t_Comma +sel_wavefrms: sel_wavefrms_1 wavefrm t_WHEN choices +sel_wavefrms_1: /* empty */ +sel_wavefrms_1: sel_wavefrms_1 sel_wavefrms_2 +sel_wavefrms_2: wavefrm t_WHEN choices t_Comma -gen_stat1: /* empty */ +gen_stat1: /* empty */ | block_declarative_part t_BEGIN | t_BEGIN - + // problem with double end // end; // end generate; - -generate_statement_body: gen_stat1 concurrent_stats - -generate_stat : t_Identifier t_Colon { pushLabel($1); } generation_scheme t_GENERATE - gen_stat1 concurrent_stats opstat - -// stems from VHDL 2008 generate_statement_body - opstat : end_stats t_END generate_stat_1 t_Semicolon { popLabel(); } - opstat : t_END generate_stat_1 t_Semicolon { popLabel(); } - -generate_stat : t_Identifier t_Colon { pushLabel($1); } if_generation_scheme - opstat // t_END generate_stat_1 t_Semicolon { popLabel(); } - -generate_stat : t_Identifier t_Colon case_scheme - -generate_stat_1 : t_GENERATE { $$=""; } -generate_stat_1 : t_GENERATE t_Identifier { $$=$2; } - - - //end_stats : - end_stats : t_END t_Semicolon - end_stats : t_END t_Identifier t_Semicolon - - - -procs_stat : t_Identifier t_Colon procs_stat1 - { - current->name=$1; - current->endBodyLine=s_str.yyLineNr; - newEntry(); - } - - -procs_stat : procs_stat1 - { - current->name=VhdlDocGen::getProcessNumber(); - current->endBodyLine=s_str.yyLineNr; - newEntry(); - } - -procs_stat1 : procs_stat1_5 {currP=VhdlDocGen::PROCESS;} t_PROCESS procs_stat1_1 procs_stat1_2 t_BEGIN seq_stats t_END - procs_stat1_3 t_Semicolon {currP=0;} - { - createFunction(currName,VhdlDocGen::PROCESS,$4.data()); - } -procs_stat1 : error t_END procs_stat1_3 t_Semicolon {currP=0;} - -procs_stat1_3 : /* empty */ -procs_stat1_3 : procs_stat1_5 t_PROCESS procs_stat1_6 +generate_statement_body: gen_stat1 concurrent_stats -procs_stat1_5 : /* empty */ {$$="";} -procs_stat1_5 : t_POSTPONED {$$="postponed";} +generate_stat : t_Identifier t_Colon + { pushLabel($1); } + generation_scheme t_GENERATE + gen_stat1 concurrent_stats opstat -procs_stat1_6 : /* empty */ {$$="";} -procs_stat1_6 : t_Identifier {$$=$1;} - -procs_stat1_2 : /* empty */ -procs_stat1_2 : t_IS -procs_stat1_2 : procs_stat1_2 procs_stat1_4 -procs_stat1_4 : procs_decltve_item -procs_stat1_1 : /* empty */ {$$="";} -procs_stat1_1 : t_LeftParen t_ALL t_RightParen {$$="all";} -procs_stat1_1 : t_LeftParen sensitivity_list t_RightParen {$$=$2;} - -sensitivity_list : name sensitivity_list_1 {$$=$1+" "+$2;} -sensitivity_list_1 : /* empty */ {$$="";} -sensitivity_list_1 : sensitivity_list_1 sensitivity_list_2 {$$=$1+" "+$2;} -sensitivity_list_2 : t_Comma name {$$=","+$2;} +// stems from VHDL 2008 generate_statement_body +opstat: end_stats t_END generate_stat_1 t_Semicolon { popLabel(); } +opstat: t_END generate_stat_1 t_Semicolon { popLabel(); } + +generate_stat: t_Identifier t_Colon + { pushLabel($1); } + if_generation_scheme opstat // t_END generate_stat_1 t_Semicolon { popLabel(); } +generate_stat: t_Identifier t_Colon case_scheme + +generate_stat_1: t_GENERATE { $$=""; } +generate_stat_1: t_GENERATE t_Identifier { $$=$2; } + +//end_stats : +end_stats: t_END t_Semicolon +end_stats: t_END t_Identifier t_Semicolon + +procs_stat: t_Identifier t_Colon procs_stat1 + { + current->name=$1; + current->endBodyLine=s_str.yyLineNr; + newEntry(); + } + +procs_stat: procs_stat1 + { + current->name=VhdlDocGen::getProcessNumber(); + current->endBodyLine=s_str.yyLineNr; + newEntry(); + } + +procs_stat1: procs_stat1_5 + { currP=VhdlDocGen::PROCESS; } + t_PROCESS procs_stat1_1 procs_stat1_2 t_BEGIN seq_stats t_END + procs_stat1_3 t_Semicolon + { currP=0; + createFunction(currName,VhdlDocGen::PROCESS,$4.data()); + } +procs_stat1: error t_END procs_stat1_3 t_Semicolon { currP=0; } + +procs_stat1_3: /* empty */ +procs_stat1_3: procs_stat1_5 t_PROCESS procs_stat1_6 + +procs_stat1_5: /* empty */ { $$=""; } +procs_stat1_5: t_POSTPONED { $$="postponed"; } + +procs_stat1_6: /* empty */ { $$=""; } +procs_stat1_6: t_Identifier { $$=$1; } + +procs_stat1_2: /* empty */ +procs_stat1_2: t_IS +procs_stat1_2: procs_stat1_2 procs_stat1_4 +procs_stat1_4: procs_decltve_item +procs_stat1_1: /* empty */ { $$=""; } +procs_stat1_1: t_LeftParen t_ALL t_RightParen { $$="all"; } +procs_stat1_1: t_LeftParen sensitivity_list t_RightParen { $$=$2; } + +sensitivity_list: name sensitivity_list_1 { $$=$1+" "+$2; } +sensitivity_list_1: /* empty */ { $$=""; } +sensitivity_list_1: sensitivity_list_1 sensitivity_list_2 { $$=$1+" "+$2; } +sensitivity_list_2: t_Comma name { $$=","+$2; } /*-------------------------------------------------- -- Sequential Statements ----------------------------------------------------*/ -seq_stats : seq_stats_1 -seq_stats_1 : /* empty */ -seq_stats_1 : seq_stats_1 seq_stats_2 -seq_stats_2 : seq_stat - -seq_stat : assertion_stat -seq_stat : lable assertion_stat -seq_stat : case_stat -seq_stat : exit_stat -seq_stat : if_stat -seq_stat : loop_stat -seq_stat : next_stat -seq_stat : null_stat -seq_stat : procedure_call_stat -seq_stat : return_stat -seq_stat :lable signal_assign_stat -seq_stat : signal_assign_stat -seq_stat : variable_assign_stat -seq_stat : wait_stat -seq_stat : lable wait_stat -seq_stat : report_statement - - - -report_statement : loop_stat_1 t_REPORT expr assertion_stat_2 t_Semicolon - -assertion_stat : t_ASSERT expr assertion_stat_1 assertion_stat_2 t_Semicolon -assertion_stat_2 : /* empty */ -assertion_stat_2 : t_SEVERITY expr +seq_stats: seq_stats_1 +seq_stats_1: /* empty */ +seq_stats_1: seq_stats_1 seq_stats_2 +seq_stats_2: seq_stat + +seq_stat: assertion_stat +seq_stat: lable assertion_stat +seq_stat: case_stat +seq_stat: exit_stat +seq_stat: if_stat +seq_stat: loop_stat +seq_stat: next_stat +seq_stat: null_stat +seq_stat: procedure_call_stat +seq_stat: return_stat +seq_stat: lable signal_assign_stat +seq_stat: signal_assign_stat +seq_stat: variable_assign_stat +seq_stat: wait_stat +seq_stat: lable wait_stat +seq_stat: report_statement + +report_statement: loop_stat_1 t_REPORT expr assertion_stat_2 t_Semicolon + +assertion_stat: t_ASSERT expr assertion_stat_1 assertion_stat_2 t_Semicolon +assertion_stat_2: /* empty */ +assertion_stat_2 : t_SEVERITY expr assertion_stat_1 : /* empty */ -assertion_stat_1 : t_REPORT expr +assertion_stat_1 : t_REPORT expr choice_stat : /* empty */ -choice_stat : t_Q +choice_stat : t_Q choice_stat_1: /* empty */ -choice_stat_1 : t_Q +choice_stat_1 : t_Q choice_stat_1 : t_Identifier -case_stat : t_CASE choice_stat expr t_IS case_stat_alternative case_stat_1 t_END t_CASE choice_stat_1 t_Semicolon -case_stat : lable t_CASE choice_stat expr t_IS case_stat_alternative case_stat_1 t_END t_CASE choice_stat_1 t_Semicolon +case_stat : t_CASE choice_stat expr t_IS case_stat_alternative case_stat_1 t_END t_CASE choice_stat_1 t_Semicolon +case_stat : lable t_CASE choice_stat expr t_IS case_stat_alternative case_stat_1 t_END t_CASE choice_stat_1 t_Semicolon -case_stat : t_CASE error t_END t_CASE choice_stat_1 t_Semicolon +case_stat : t_CASE error t_END t_CASE choice_stat_1 t_Semicolon case_stat_1 : /* empty */ -case_stat_1 : case_stat_1 case_stat_2 -case_stat_2 : case_stat_alternative +case_stat_1 : case_stat_1 case_stat_2 +case_stat_2 : case_stat_alternative -case_stat_alternative : t_WHEN choices t_Arrow seq_stats +case_stat_alternative : t_WHEN choices t_Arrow seq_stats -exit_stat : t_EXIT exit_stat_1 exit_stat_2 t_Semicolon +exit_stat : t_EXIT exit_stat_1 exit_stat_2 t_Semicolon exit_stat_2 : /* empty */ -exit_stat_2 : t_WHEN expr +exit_stat_2 : t_WHEN expr exit_stat_1 : /* empty */ -exit_stat_1 : t_Identifier +exit_stat_1 : t_Identifier -if_stat : t_IF expr t_THEN seq_stats if_stat_1 if_stat_2 t_END t_IF t_Semicolon -if_stat : t_IF expr t_THEN error t_END t_IF t_Semicolon +if_stat : t_IF expr t_THEN seq_stats if_stat_1 if_stat_2 t_END t_IF t_Semicolon +if_stat : t_IF expr t_THEN error t_END t_IF t_Semicolon if_stat_2 : /* empty */ -if_stat_2 : t_ELSE seq_stats +if_stat_2 : t_ELSE seq_stats if_stat_1 : /* empty */ -if_stat_1 : if_stat_1 if_stat_3 -if_stat_3 : t_ELSIF expr t_THEN seq_stats - -loop_stat : loop_stat_1 loop_stat_2 t_LOOP seq_stats t_END t_LOOP loop_stat_3 t_Semicolon -loop_stat_3 : /* empty */ -loop_stat_3 : t_Identifier -loop_stat_2 : /* epty */ -loop_stat_2 : iteration_scheme -loop_stat_1 : /* empty */ -loop_stat_1 : t_Identifier t_Colon - -next_stat : t_NEXT next_stat_1 next_stat_2 t_Semicolon -next_stat_2 : /* empty */ -next_stat_2 : t_WHEN expr -next_stat_1 : /* empty */ -next_stat_1 : t_Identifier - -null_stat : t_NULL t_Semicolon - -procedure_call_stat : name t_Semicolon - -return_stat : t_RETURN return_stat_1 t_Semicolon -return_stat_1 : /* empty */ -return_stat_1 : expr - -signal_assign_stat : target t_LESym wavefrm t_Semicolon - | target t_LESym delay_mechanism wavefrm t_Semicolon - | target t_LESym t_FORCE inout_stat expr t_Semicolon - | target t_LESym t_RELEASE inout_stat t_Semicolon - | selected_signal_assignment - | conditional_signal_assignment - ; - - - -variable_assign_stat : variable_assign_stat_1 t_Semicolon - | conditional_variable_assignment - | lable selected_variable_assignment - | selected_variable_assignment - -lable: t_Identifier t_Colon -variable_assign_stat_1: target t_VarAsgn expr -variable_assign_stat_1: lable target t_VarAsgn expr - -wait_stat : t_WAIT wait_stat_1 wait_stat_2 wait_stat_3 t_Semicolon -wait_stat_3 : /* empty */ -wait_stat_3 : t_FOR expr -wait_stat_2 : /* empty */ -wait_stat_2 : t_UNTIL expr -wait_stat_1 : /* empty */ -wait_stat_1 : t_ON sensitivity_list +if_stat_1 : if_stat_1 if_stat_3 +if_stat_3 : t_ELSIF expr t_THEN seq_stats + +loop_stat: loop_stat_1 loop_stat_2 t_LOOP seq_stats t_END t_LOOP loop_stat_3 t_Semicolon +loop_stat_3: /* empty */ +loop_stat_3: t_Identifier +loop_stat_2: /* epty */ +loop_stat_2: iteration_scheme +loop_stat_1: /* empty */ +loop_stat_1: t_Identifier t_Colon + +next_stat: t_NEXT next_stat_1 next_stat_2 t_Semicolon +next_stat_2: /* empty */ +next_stat_2: t_WHEN expr +next_stat_1: /* empty */ +next_stat_1: t_Identifier + +null_stat: t_NULL t_Semicolon + +procedure_call_stat: name t_Semicolon + +return_stat: t_RETURN return_stat_1 t_Semicolon +return_stat_1: /* empty */ +return_stat_1: expr + +signal_assign_stat: target t_LESym wavefrm t_Semicolon + | target t_LESym delay_mechanism wavefrm t_Semicolon + | target t_LESym t_FORCE inout_stat expr t_Semicolon + | target t_LESym t_RELEASE inout_stat t_Semicolon + | selected_signal_assignment + | conditional_signal_assignment + ; + +variable_assign_stat: variable_assign_stat_1 t_Semicolon + | conditional_variable_assignment + | lable selected_variable_assignment + | selected_variable_assignment + +lable: t_Identifier t_Colon +variable_assign_stat_1: target t_VarAsgn expr +variable_assign_stat_1: lable target t_VarAsgn expr + +wait_stat: t_WAIT wait_stat_1 wait_stat_2 wait_stat_3 t_Semicolon +wait_stat_3: /* empty */ +wait_stat_3: t_FOR expr +wait_stat_2: /* empty */ +wait_stat_2: t_UNTIL expr +wait_stat_1: /* empty */ +wait_stat_1: t_ON sensitivity_list /*-------------------------------------------------- -- Components and Configurations ----------------------------------------------------*/ - comp_end_dec : t_END {lastEntity=0;lastCompound=0;genLabels.resize(0);} - | t_END t_COMPONENT entity_decl_5 - | t_END t_ARCHITECTURE entity_decl_5 {lastCompound=0;genLabels.resize(0);} - | t_END t_ENTITY entity_decl_5 {lastEntity=0;genLabels.resize(0);} - | t_END t_Identifier {lastEntity=0;lastCompound=0;genLabels.resize(0);} - - iss :/*empty*/ {currP=VhdlDocGen::COMPONENT;} - | t_IS {currP=VhdlDocGen::COMPONENT;} - -comp_decl : t_COMPONENT t_Identifier iss comp_decl_1 comp_decl_2 comp_end_dec t_Semicolon - { - addVhdlType($2,getParsedLine(t_COMPONENT),Entry::VARIABLE_SEC,VhdlDocGen::COMPONENT,0,0); - currP=0; - } -comp_decl_2 : /* empty */ {$$="";} -comp_decl_2 : t_PORT interf_list t_Semicolon {$$=$2;} -comp_decl_1 : /* empty */ {$$="";} -comp_decl_1 : t_GENERIC interf_list t_Semicolon {$$=$2;} - -block_config : t_FOR block_spec block_config_1 block_config_2 t_END t_FOR t_Semicolon +comp_end_dec : t_END { lastEntity=0; lastCompound=0; genLabels.resize(0); } + | t_END t_COMPONENT entity_decl_5 + | t_END t_ARCHITECTURE entity_decl_5 { lastCompound=0; genLabels.resize(0); } + | t_END t_ENTITY entity_decl_5 { lastEntity=0; genLabels.resize(0); } + | t_END t_Identifier { lastEntity=0; lastCompound=0; genLabels.resize(0); } + +iss :/*empty*/ { currP=VhdlDocGen::COMPONENT; } + | t_IS { currP=VhdlDocGen::COMPONENT; } + +comp_decl: t_COMPONENT t_Identifier iss comp_decl_1 comp_decl_2 comp_end_dec t_Semicolon + { + addVhdlType($2,getParsedLine(t_COMPONENT),Entry::VARIABLE_SEC,VhdlDocGen::COMPONENT,0,0); + currP=0; + } +comp_decl_2: /* empty */ { $$=""; } +comp_decl_2: t_PORT interf_list t_Semicolon { $$=$2; } +comp_decl_1: /* empty */ { $$=""; } +comp_decl_1: t_GENERIC interf_list t_Semicolon { $$=$2; } + +block_config: t_FOR block_spec block_config_1 block_config_2 t_END t_FOR t_Semicolon { popConfig(); } - -block_config : t_FOR error t_END t_FOR t_Semicolon {$$="";} -block_config_2 : /* empty */ {$$="";} -block_config_2 : block_config_2 block_config_3 - { - $$=$1+" "; - } -block_config_3 : config_item {$$=$1;} -block_config_1 : /* empty */ {$$="";} -block_config_1 : block_config_1 block_config_4 - { - $$=$1; - } -block_config_4 : use_clause {$$=$1;} - -block_spec : name { -$$=$1; - - if(levelCounter==0) - addConfigureNode($1.data(),NULL,TRUE,FALSE); - else - addConfigureNode($1.data(),NULL,FALSE,FALSE); -} - -config_item : block_config { -$$=$1; - } - -config_item : comp_config { - $$=$1; - } - -comp_config : t_FOR comp_spec comp_config_1 comp_config_2 t_END t_FOR t_Semicolon - { - $$=$2+" "+$3+" "+$4; - popConfig(); - } -comp_config_2 : /* empty */ {$$="";} -comp_config_2 : block_config {$$=$1;} -comp_config_1 : /*empty*/ {$$="";} - -comp_config_1 : binding_indic_1 binding_indic_2 t_Semicolon {$$="";} -comp_config_1 : t_USE t_VUNIT idf_list t_Semicolon {$$="";} -comp_config_1 : t_USE binding_indic t_Semicolon - { - addConfigureNode(compSpec.data(),$2.data(),FALSE,FALSE); - } - -config_spec : t_FOR comp_spec comp_spec_stat t_Semicolon {addConfigureNode($2.data(),$3.data(),TRUE,FALSE,TRUE);currNode->confVhdl=lastCompound->name; } -config_spec : t_FOR comp_spec comp_spec_stat t_Semicolon t_END t_FOR t_Semicolon {addConfigureNode($2.data(),$3.data(),TRUE,FALSE,TRUE);currNode->confVhdl=lastCompound->name; } - -comp_spec_stat : t_USE binding_indic { $$=$2;} -comp_spec_stat : t_USE t_VUNIT idf_list t_Semicolon {$$="";} -comp_spec_stat : binding_indic_1 binding_indic_2 {$$="";} - -comp_spec : inst_list t_Colon expr - { + +block_config: t_FOR error t_END t_FOR t_Semicolon { $$=""; } +block_config_2: /* empty */ { $$=""; } +block_config_2: block_config_2 block_config_3 { $$=$1+" "; } +block_config_3: config_item { $$=$1; } +block_config_1: /* empty */ { $$=""; } +block_config_1: block_config_1 block_config_4 { $$=$1; } +block_config_4: use_clause { $$=$1; } + +block_spec: name + { + $$=$1; + + if (levelCounter==0) + addConfigureNode($1.data(),NULL,TRUE,FALSE); + else + addConfigureNode($1.data(),NULL,FALSE,FALSE); + } + +config_item: block_config { $$=$1; } +config_item: comp_config { $$=$1; } + +comp_config: t_FOR comp_spec comp_config_1 comp_config_2 t_END t_FOR t_Semicolon + { + $$=$2+" "+$3+" "+$4; + popConfig(); + } +comp_config_2: /* empty */ { $$=""; } +comp_config_2: block_config { $$=$1; } +comp_config_1: /*empty*/ { $$=""; } + +comp_config_1: binding_indic_1 binding_indic_2 t_Semicolon { $$=""; } +comp_config_1: t_USE t_VUNIT idf_list t_Semicolon { $$=""; } +comp_config_1: t_USE binding_indic t_Semicolon + { + addConfigureNode(compSpec.data(),$2.data(),FALSE,FALSE); + } + +config_spec: t_FOR comp_spec comp_spec_stat t_Semicolon + { + addConfigureNode($2.data(),$3.data(),TRUE,FALSE,TRUE);currNode->confVhdl=lastCompound->name; + } +config_spec: t_FOR comp_spec comp_spec_stat t_Semicolon t_END t_FOR t_Semicolon + { + addConfigureNode($2.data(),$3.data(),TRUE,FALSE,TRUE);currNode->confVhdl=lastCompound->name; + } + +comp_spec_stat: t_USE binding_indic { $$=$2; } +comp_spec_stat: t_USE t_VUNIT idf_list t_Semicolon { $$=""; } +comp_spec_stat: binding_indic_1 binding_indic_2 { $$=""; } + +comp_spec: inst_list t_Colon expr + { $$=$1+":"+$3; - compSpec=$$; - } + compSpec=$$; + } +inst_list: idf_list { $$=$1; } +inst_list: t_ALL { $$="all"; } +inst_list: t_OTHERS { $$="others"; } +binding_indic : entity_aspect binding_indic_1 binding_indic_2 { $$=$1; } -inst_list : idf_list {$$=$1;} -inst_list : t_ALL {$$="all";} -inst_list : t_OTHERS {$$="others";} +binding_indic_2: +binding_indic_2: t_PORT t_MAP association_list -binding_indic : entity_aspect binding_indic_1 binding_indic_2 - { - $$=$1; - } +binding_indic_1: +binding_indic_1: t_GENERIC t_MAP association_list -binding_indic_2 : -binding_indic_2 : t_PORT t_MAP association_list +entity_aspect: t_ENTITY name { $$="entity "+$2; } +entity_aspect: t_CONFIGURATION mark { $$="configuration "+ $2; } +entity_aspect: t_OPEN { $$="open "; } + ; -binding_indic_1 : +group_constituent: t_Identifier { $$=$1; } + | t_CharacterLit { $$=$1; } + ; -binding_indic_1 : t_GENERIC t_MAP association_list +group_constituent_list: group_constituent { $$=$1; } + | group_constituent_list t_Comma group_constituent { $$=$1+","+$3; } + ; +group_declaration : t_GROUP t_Identifier t_Colon group_name t_LeftParen group_constituent_list t_RightParen t_Semicolon + { + // $$=$2+":"+$4+$6; + $$="("+$4+$6+")"; + addVhdlType($2,getParsedLine(t_GROUP),Entry::VARIABLE_SEC,VhdlDocGen::GROUP,$$.data(),0); + } -entity_aspect : t_ENTITY name {$$="entity "+$2;} +group_template_declaration : t_GROUP t_Identifier t_IS t_LeftParen entity_class_entry_list t_RightParen t_Semicolon + { + $$=$2+":"+$5; + addVhdlType($2,getParsedLine(t_GROUP),Entry::VARIABLE_SEC,VhdlDocGen::GROUP,$5.data(),0); + } -entity_aspect : t_CONFIGURATION mark {$$="configuration "+ $2;} +group_template_declaration: t_GROUP t_Identifier t_IS t_LeftParen error t_Semicolon t_RightParen { $$=""; } -entity_aspect : t_OPEN {$$="open ";} -; +entity_class_entry : entity_class tbox -group_constituent : t_Identifier {$$=$1;} - | t_CharacterLit {$$=$1;} - ; +tbox : /* empty */ { $$=""; } +tbox : t_Box { $$="<>"; } -group_constituent_list : group_constituent {$$=$1;} - | group_constituent_list t_Comma group_constituent {$$=$1+","+$3;} - ; - - group_declaration : t_GROUP t_Identifier t_Colon group_name t_LeftParen group_constituent_list t_RightParen t_Semicolon - { - // $$=$2+":"+$4+$6; - $$="("+$4+$6+")"; - addVhdlType($2,getParsedLine(t_GROUP),Entry::VARIABLE_SEC,VhdlDocGen::GROUP,$$.data(),0); - } - - group_template_declaration : t_GROUP t_Identifier t_IS t_LeftParen entity_class_entry_list t_RightParen t_Semicolon - { - $$=$2+":"+$5; - addVhdlType($2,getParsedLine(t_GROUP),Entry::VARIABLE_SEC,VhdlDocGen::GROUP,$5.data(),0); - } - - group_template_declaration: t_GROUP t_Identifier t_IS t_LeftParen error t_Semicolon t_RightParen {$$="";} - entity_class_entry : entity_class tbox - - tbox : /* empty */ {$$="";} - tbox : t_Box {$$="<>";} - - entity_class_entry_list : entity_class_entry {$$=$1;} - | entity_class_entry_list t_Comma entity_class_entry {$$=$1+","+$3;} - ; - -group_name : t_Identifier {$$=$1;} -group_name: t_StringLit {$$=$1;} - - t_Identifier : t_LETTER - { - $$=s_str.qstr; - } - - - t_BitStringLit :t_DIGIT - { - $$=s_str.qstr; - } - - - t_StringLit : t_STRING - { - $$=s_str.qstr; - } +entity_class_entry_list: entity_class_entry { $$=$1; } + | entity_class_entry_list + t_Comma entity_class_entry { $$=$1+","+$3; } + ; - t_AbstractLit : t_ABSTRLIST - { - $$=s_str.qstr; - } - - t_CharacterLit : t_CHARLIST - { - $$=s_str.qstr; - } +group_name: t_Identifier { $$=$1; } +group_name: t_StringLit { $$=$1; } + +t_Identifier: t_LETTER + { + $$=s_str.qstr; + } + +t_BitStringLit: t_DIGIT + { + $$=s_str.qstr; + } + +t_StringLit: t_STRING + { + $$=s_str.qstr; + } + +t_AbstractLit: t_ABSTRLIST + { + $$=s_str.qstr; + } + +t_CharacterLit: t_CHARLIST + { + $$=s_str.qstr; + } /*-------------------------------------------------- -- VHDL 2002 extensions -- to do: must be added -----------------------------------------------------*/ -protected_type_declaration:t_PROTECTED protected_stats t_END protected_stat_1 {$$="";} -protected_type_declaration:t_PROTECTED error t_END protected_stat_1 {$$="";} - - protected_stats : /* empty */ - protected_stats : protected_stats protected_stat_decl_1 - protected_stat_decl_1: protected_type_declaration_item - protected_stat_1:t_PROTECTED - protected_stat_1:t_PROTECTED t_Identifier - -protected_type_declaration_item : use_clause -protected_type_declaration_item : attribute_spec -protected_type_declaration_item : subprog_decl -protected_type_declaration_item : subprogram_instantiation_decl - -protected_type_body : t_PROTECTED t_BODY protected_body_stats t_END protected_body_stat_1 {$$="";} -protected_type_body : t_PROTECTED t_BODY error t_END protected_body_stat_1 {$$="";} - - protected_body_stats : /* empty */ - protected_body_stats : protected_body_stats protected_body_stat_decl_1 - protected_body_stat_decl_1: protected_type_body_declaration_item +protected_type_declaration:t_PROTECTED protected_stats t_END protected_stat_1 { $$=""; } +protected_type_declaration:t_PROTECTED error t_END protected_stat_1 { $$=""; } + +protected_stats: /* empty */ +protected_stats: protected_stats protected_stat_decl_1 +protected_stat_decl_1: protected_type_declaration_item +protected_stat_1: t_PROTECTED +protected_stat_1: t_PROTECTED t_Identifier + +protected_type_declaration_item: use_clause +protected_type_declaration_item: attribute_spec +protected_type_declaration_item: subprog_decl +protected_type_declaration_item: subprogram_instantiation_decl + +protected_type_body: t_PROTECTED t_BODY protected_body_stats t_END protected_body_stat_1 { $$=""; } +protected_type_body: t_PROTECTED t_BODY error t_END protected_body_stat_1 { $$=""; } + +protected_body_stats: /* empty */ +protected_body_stats: protected_body_stats protected_body_stat_decl_1 +protected_body_stat_decl_1: protected_type_body_declaration_item protected_body_stat_1: t_PROTECTED t_BODY protected_body_stat_1: t_PROTECTED t_BODY t_Identifier protected_type_body_declaration_item: subprog_decltve_item // same as subprog - - /*-------------------------------------------------- -- VHDL 2008 extensions -- to do: must be added -----------------------------------------------------*/ - context_ref : t_CONTEXT sel_list t_Semicolon - - context_decl : t_CONTEXT t_Identifier t_IS libustcont_stats t_END context_stat_1 t_Semicolon - context_decl : t_CONTEXT t_Identifier t_IS t_END context_stat_1 t_Semicolon +context_ref: t_CONTEXT sel_list t_Semicolon { $$="context "+$2; } + +context_decl: t_CONTEXT t_Identifier t_IS { parse_sec=CONTEXT_SEC; } libustcont_stats t_END context_stat_1 t_Semicolon + { + parse_sec=0; + QCString v=$5; + addVhdlType($2,getParsedLine(t_LIBRARY),Entry::VARIABLE_SEC,VhdlDocGen::LIBRARY,"context",$5.data()); + } +context_decl: t_CONTEXT t_Identifier t_IS t_END context_stat_1 t_Semicolon + { + addVhdlType($2,getParsedLine(t_LIBRARY),Entry::VARIABLE_SEC,VhdlDocGen::LIBRARY,"context",0); + } context_stat_1: t_CONTEXT context_stat_1: t_CONTEXT t_Identifier - libustcont_stats : libustcont_stat - libustcont_stats : libustcont_stats libustcont_stat - - libustcont_stat : use_clause - libustcont_stat : lib_clause - libustcont_stat : context_ref - -package_instantiation_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name signature t_Semicolon; -package_instantiation_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name signature gen_assoc_list t_Semicolon -package_instantiation_decl: t_PACKAGE error t_Identifier t_IS t_NEW t_Semicolon; - -subprogram_instantiation_decl: t_FUNCTION t_Identifier t_IS t_NEW dot_name signature t_Semicolon -subprogram_instantiation_decl: t_FUNCTION t_Identifier t_IS t_NEW dot_name signature gen_assoc_list t_Semicolon -subprogram_instantiation_decl: t_FUNCTION t_Identifier t_IS t_NEW error t_Semicolon +libustcont_stats: libustcont_stat { $$ = $1; } +libustcont_stats: libustcont_stats libustcont_stat { $$ = $1+"#"+$2; } -signature:/*empty*/ {$$="";} -signature: t_LEFTBR signature1 t_RIGHTBR {$$="["+$2+" ]";} -signature: t_LEFTBR t_RIGHTBR {$$="[ ]";} +libustcont_stat: use_clause { $$ = $1; } +libustcont_stat: lib_clause { $$ = $1; } +libustcont_stat: context_ref { $$ = $1; } +package_instantiation_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name signature t_Semicolon + { + $$=" is new "+$5+$6; + //Entry * pp=lastCompound; + //Entry * pps=lastEntity ; + //assert(false); + addVhdlType($2,getParsedLine(t_PACKAGE),Entry::VARIABLE_SEC,VhdlDocGen::INSTANTIATION,"package",$$.data()); + } +package_instantiation_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name signature gen_assoc_list t_Semicolon + { + $$=" is new "+$5+$6; + addVhdlType($2,getParsedLine(t_PACKAGE),Entry::VARIABLE_SEC,VhdlDocGen::INSTANTIATION,"package",$$.data()); + } +package_instantiation_decl: t_PACKAGE error t_Identifier t_IS t_NEW t_Semicolon { $$=""; } +subprogram_instantiation_decl: t_FUNCTION t_Identifier t_IS t_NEW dot_name signature t_Semicolon + { + $$= " is new "+$5+$6; + addVhdlType($2,getParsedLine(t_FUNCTION),Entry::VARIABLE_SEC,VhdlDocGen::INSTANTIATION,"function ",$$.data()); + } +subprogram_instantiation_decl: t_FUNCTION t_Identifier t_IS t_NEW dot_name signature gen_assoc_list t_Semicolon + { + $$=" is new "+$5+$6; + addVhdlType($2,getParsedLine(t_FUNCTION),Entry::VARIABLE_SEC,VhdlDocGen::INSTANTIATION,"function ",$$.data()); + } +subprogram_instantiation_decl: t_FUNCTION t_Identifier t_IS t_NEW error t_Semicolon { $$=""; } -signature1: t_RETURN mark {$$="return "+$2;} -signature1:mark_stats { $$=$1;} -signature1: mark_stats t_RETURN mark {$$=$1+" return "+$3;} +signature:/*empty*/ { $$=""; } +signature: t_LEFTBR signature1 + t_RIGHTBR { $$="["+$2+" ]"; } +signature: t_LEFTBR t_RIGHTBR { $$="[ ]"; } -mark_stats : mark {$$=$1;} -mark_stats: mark_stats mark_stats_1 {$$=$1+" "+$2;} -mark_stats_1: t_Comma mark {$$=" , "+$2;} +signature1: t_RETURN mark { $$="return "+$2; } +signature1: mark_stats { $$=$1; } +signature1: mark_stats t_RETURN mark { $$=$1+" return "+$3; } -case_scheme: t_CASE expr t_GENERATE when_stats ttend t_END t_GENERATE generate_stat_1 t_Semicolon -case_scheme: t_CASE expr t_GENERATE when_stats t_END t_GENERATE generate_stat_1 t_Semicolon -case_scheme: t_CASE error t_GENERATE error t_END t_GENERATE generate_stat_1 t_Semicolon +mark_stats: mark { $$=$1; } +mark_stats: mark_stats mark_stats_1 { $$=$1+" "+$2; } +mark_stats_1: t_Comma mark { $$=" , "+$2; } -when_stats_1 : t_WHEN lable choices t_Arrow generate_statement_body -when_stats_1 : t_WHEN choices t_Arrow generate_statement_body -when_stats : when_stats when_stats_1 -when_stats : when_stats_1 +case_scheme: t_CASE expr t_GENERATE when_stats ttend t_END t_GENERATE generate_stat_1 t_Semicolon +case_scheme: t_CASE expr t_GENERATE when_stats t_END t_GENERATE generate_stat_1 t_Semicolon +case_scheme: t_CASE error t_GENERATE error t_END t_GENERATE generate_stat_1 t_Semicolon - ttend :t_END t_Semicolon - ttend : t_END t_Identifier t_Semicolon +when_stats_1: t_WHEN lable choices t_Arrow generate_statement_body +when_stats_1: t_WHEN choices t_Arrow generate_statement_body +when_stats: when_stats when_stats_1 +when_stats: when_stats_1 -conditional_signal_assignment : conditional_waveform_assignment -conditional_signal_assignment : conditional_force_assignment - -conditional_waveform_assignment: target t_LESym wavefrm_element t_WHEN expr else_wave_list t_Semicolon -conditional_waveform_assignment: target t_LESym delay_mechanism wavefrm_element t_WHEN expr else_wave_list t_Semicolon +ttend: t_END t_Semicolon +ttend: t_END t_Identifier t_Semicolon -conditional_waveform_assignment: target t_LESym wavefrm_element t_WHEN expr t_Semicolon -conditional_waveform_assignment: target t_LESym delay_mechanism wavefrm_element t_WHEN expr t_Semicolon -conditional_waveform_assignment: target t_LESym error t_Semicolon +conditional_signal_assignment: conditional_waveform_assignment +conditional_signal_assignment: conditional_force_assignment + +conditional_waveform_assignment: target t_LESym wavefrm_element t_WHEN expr else_wave_list t_Semicolon +conditional_waveform_assignment: target t_LESym delay_mechanism wavefrm_element t_WHEN expr else_wave_list t_Semicolon +conditional_waveform_assignment: target t_LESym wavefrm_element t_WHEN expr t_Semicolon +conditional_waveform_assignment: target t_LESym delay_mechanism wavefrm_element t_WHEN expr t_Semicolon +conditional_waveform_assignment: target t_LESym error t_Semicolon else_wave_list: t_ELSE expr t_WHEN expr else_wave_list: t_ELSE expr -conditional_force_assignment: target t_LESym t_FORCE inout_stat expr t_WHEN expr else_stat t_Semicolon -conditional_force_assignment: target t_LESym t_FORCE inout_stat expr t_WHEN expr t_Semicolon +conditional_force_assignment: target t_LESym t_FORCE inout_stat expr t_WHEN expr else_stat t_Semicolon +conditional_force_assignment: target t_LESym t_FORCE inout_stat expr t_WHEN expr t_Semicolon selected_signal_assignment : selected_waveform_assignment selected_signal_assignment : selected_force_assignment -selected_waveform_assignment: t_WITH expr t_SELECT choice_stat - target t_LESym delay_stat sel_wave_list +selected_waveform_assignment: t_WITH expr t_SELECT choice_stat + target t_LESym delay_stat sel_wave_list + +delay_stat: +delay_stat: delay_mechanism -delay_stat : -delay_stat : delay_mechanism - -sel_wave_list : wavefrm_element t_WHEN choices t_Comma sel_wave_list -sel_wave_list : sel_wave_list_1 +sel_wave_list: wavefrm_element t_WHEN choices t_Comma sel_wave_list +sel_wave_list: sel_wave_list_1 -sel_wave_list_1 : wavefrm_element t_WHEN choices t_Semicolon +sel_wave_list_1: wavefrm_element t_WHEN choices t_Semicolon -selected_force_assignment: t_WITH expr t_SELECT choice_stat target t_LESym t_FORCE - inout_stat sel_var_list +selected_force_assignment: t_WITH expr t_SELECT choice_stat target t_LESym t_FORCE + inout_stat sel_var_list - inout_stat : - inout_stat : t_IN - inout_stat : t_OUT +inout_stat: +inout_stat: t_IN +inout_stat: t_OUT delay_mechanism : t_TRANSPORT - | t_REJECT expr t_INERTIAL - | t_INERTIAL - - conditional_variable_assignment : variable_assign_stat_1 t_WHEN expr else_stat t_Semicolon - conditional_variable_assignment : variable_assign_stat_1 t_WHEN expr t_Semicolon - -else_stat : t_ELSE expr t_WHEN expr -else_stat : else_stat t_ELSE expr t_WHEN expr -else_stat : t_ELSE expr - -selected_variable_assignment: t_WITH expr t_SELECT choice_stat select_name t_VarAsgn sel_var_list - - sel_var_list : expr t_WHEN choices t_Comma sel_var_list - sel_var_list : sel_var_list_1 - - sel_var_list_1 : expr t_WHEN choices t_Semicolon - -select_name:name - | aggregate - -interface_subprogram_decl: iproc - | ifunc - ; -iproc: t_PROCEDURE t_Identifier param -ifunc: func_prec t_FUNCTION func_name param t_RETURN mark return_is -ifunc: t_FUNCTION func_name param t_RETURN mark return_is - - -func_name: t_Identifier - | t_StringLit // "?<" - ; - -return_is: /* empty */ - | t_IS t_Identifier - | t_IS t_Box - -param: /* empty */ -param: t_PARAMETER -param: t_PARAMETER t_LeftParen interf_element interf_list_1 t_RightParen -param:t_LeftParen interf_element interf_list_1 t_RightParen - -interface_package_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name -interface_package_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name gen_assoc_list - -gen_assoc_list : t_GENERIC t_MAP association_list - - -gen_interface_list : t_GENERIC interf_list - + | t_REJECT expr t_INERTIAL + | t_INERTIAL + +conditional_variable_assignment : variable_assign_stat_1 t_WHEN expr else_stat t_Semicolon +conditional_variable_assignment : variable_assign_stat_1 t_WHEN expr t_Semicolon + +else_stat: t_ELSE expr t_WHEN expr +else_stat: else_stat t_ELSE expr t_WHEN expr +else_stat: t_ELSE expr + +selected_variable_assignment: t_WITH expr t_SELECT choice_stat select_name t_VarAsgn sel_var_list + +sel_var_list: expr t_WHEN choices t_Comma sel_var_list +sel_var_list: sel_var_list_1 + +sel_var_list_1: expr t_WHEN choices t_Semicolon + +select_name: name + | aggregate + +interface_subprogram_decl: iproc { $$ = $1; } + | ifunc { $$=$1; } + ; +iproc: t_PROCEDURE t_Identifier param { $$ = "procedure "+$2+$3; current->name=$2; } + +ifunc: t_FUNCTION func_name param t_RETURN mark return_is + { + QCString s=$6; + if (!s.isEmpty()) + { + s.prepend(" is "); + } + $$=" function "+$2+$3+$5+s; + current->name=$2; + } +ifunc: func_prec t_FUNCTION func_name param t_RETURN mark return_is + { + QCString s=$7; + if (!s.isEmpty()) + { + s.prepend(" is "); + } + $$=$1+" function "+$3+$4+" return "+$6+s; + current->name=$3; + } + +func_name: t_Identifier { $$=$1; } + | t_StringLit { $$=$1; } // "?<" + ; + +return_is: /* empty */ { $$=""; } + | t_IS t_Identifier { $$=$2; } + | t_IS t_Box { $$="<>"; } + +param: /* empty */ { $$=""; } +param: t_PARAMETER { $$="parameter "; } +param: t_PARAMETER { parse_sec=PARAM_SEC; } + t_LeftParen interf_element interf_list_1 t_RightParen + { parse_sec=0; } + +param: t_LeftParen interf_element interf_list_1 t_RightParen { $$="("+$2+")"; } + +interface_package_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name + { + $$="package "+$2+" is new "+$5; + current->name=$2; + } +interface_package_decl: t_PACKAGE t_Identifier t_IS t_NEW dot_name gen_assoc_list + { + $$="package "+$2+" is new "+$5+"( ... )" ; + current->name=$2; + } + +gen_assoc_list: t_GENERIC t_MAP association_list + +gen_interface_list : t_GENERIC + { + //int u=s_str.iLine; + parse_sec=GEN_SEC; + } + interf_list + { + QCString vo=$3; + parse_sec=0; + } + external_name: t_SLSL sig_stat external_pathname t_Colon subtype_indic t_SRSR + { + QCString s="<<"+$2; + QCString s1=$3+":"+$5+">>"; + $$=s+s1; + } + +sig_stat: t_CONSTANT { $$="constant "; } +sig_stat: t_SIGNAL { $$="signal "; } +sig_stat: t_VARIABLE { $$="variable "; } -sig_stat: t_CONSTANT -sig_stat: t_SIGNAL -sig_stat: t_VARIABLE +external_pathname: absolute_pathname { $$=$1; } + | relative_pathname { $$=$1; } + | package_path_name { $$=$1; } + ; -external_pathname: absolute_pathname - | relative_pathname - | package_path_name - ; +absolute_pathname: t_Dot pathname_element_list t_Identifier { $$="."+$2+$3; } +absolute_pathname: t_Dot t_Identifier { $$="."+$2; } -absolute_pathname: t_Dot pathname_element_list t_Identifier -absolute_pathname: t_Dot t_Identifier +relative_pathname: neg_list pathname_element_list t_Identifier { $$=$1+$2+$3; } +relative_pathname: neg_list t_Identifier { $$=$1+$2; } -relative_pathname: t_Neg t_Dot pathname_element_list t_Identifier -relative_pathname: t_Neg t_Dot t_Identifier +neg_list: t_Neg t_Dot { $$="^."; } +neg_list: neg_list t_Neg t_Dot { $$=$1+"^."; } -pathname_element: t_Identifier - | t_Identifier t_LeftParen expr t_RightParen - ; - - pathname_element_list: pathname_element t_Dot - | pathname_element_list pathname_element t_Dot - -package_path_name: t_At dot_name +pathname_element: t_Identifier { $$=$1; } + | t_Identifier t_LeftParen expr t_RightParen { $$=$1+"("+$3+")"; } + ; -tool_directive : t_ToolDir +pathname_element_list: pathname_element t_Dot { $$=$1+"."; } + | pathname_element_list pathname_element t_Dot { $$=$1+$2+"."; } + +package_path_name: t_At dot_name { $$="@"+$2; } + +tool_directive: t_ToolDir { // fprintf(stderr,"\n tooldir %s",s_str.qstr.data() ); } @@ -1980,11 +2075,11 @@ int MyParserVhdl::parse(MyParserVhdl* conv) { myconv=conv; return vhdlScanYYparse(); -} +} int lex(void) { - return myconv->doLex(); + return myconv->doLex(); } struct s_contVhdl* getVhdlCont() @@ -2000,19 +2095,19 @@ Entry* getVhdlCompound() } QList<ConfNode>& getVhdlConfiguration() { return configL; } - + static void addCompInst(char *n, char* instName, char* comp,int iLine) { - current->spec=VhdlDocGen::COMPONENT_INST; + current->spec=VhdlDocGen::INSTANTIATION; current->section=Entry::VARIABLE_SEC; current->startLine=iLine; current->bodyLine=iLine; - current->type=instName; // foo:instname e.g proto or work. proto(ttt) - current->exception=genLabels; // |arch|label1:label2... - current->name=n; // foo + current->type=instName; // foo:instname e.g proto or work. proto(ttt) + current->exception=genLabels; // |arch|label1:label2... + current->name=n; // foo current->args=lastCompound->name; // architecture name - current->includeName=comp; // component/enity/configuration + current->includeName=comp; // component/enity/configuration //printf(" \n genlable: [%s] inst: [%s] name: [%s] \n",genLabels.data(),instName,n); @@ -2020,7 +2115,7 @@ static void addCompInst(char *n, char* instName, char* comp,int iLine) { current->args=lastCompound->name; if (!findInstant(current->type)) - { + { initEntry(current); instFiles.append(new Entry(*current)); } @@ -2031,7 +2126,7 @@ static void addCompInst(char *n, char* instName, char* comp,int iLine) newEntry(); } } - + static void pushLabel(QCString label) { genLabels+="|"+label; @@ -2041,11 +2136,11 @@ static void popLabel() { int u=genLabels.findRev("|"); if (u<0) return; - genLabels=genLabels.left(u); + genLabels=genLabels.left(u); } static void popConfig() -{ +{ assert(currNode); currNode=currNode->prevNode; // printf("\n pop arch %s ",currNode->arch.data()); @@ -2091,32 +2186,12 @@ static void addConfigureNode(const char* a,const char*b, bool isRoot,bool isLeav } }// addConfigure - - //------------------------------------------------------------------------------------------------------------ -static bool addLibUseClause(const QCString &type) -{ - static bool show=Config_getBool("SHOW_INCLUDE_FILES"); - static bool showIEEESTD=Config_getBool("FORCE_LOCAL_INCLUDES"); - - if (!show) // all libraries and included packages are not shown - { - return FALSE; - } - - if (!showIEEESTD) // all standard packages and libraries are not shown - { - if (type.lower().stripPrefix("ieee")) return FALSE; - if (type.lower().stripPrefix("std")) return FALSE; - } - return TRUE; -} - static bool isFuncProcProced() { - if (currP==VhdlDocGen::FUNCTION || - currP==VhdlDocGen::PROCEDURE || + if (currP==VhdlDocGen::FUNCTION || + currP==VhdlDocGen::PROCEDURE || currP==VhdlDocGen::PROCESS ) { @@ -2125,7 +2200,6 @@ static bool isFuncProcProced() return FALSE; } - static void initEntry(Entry *e) { e->fileName = s_str.fileName; @@ -2136,7 +2210,7 @@ static void initEntry(Entry *e) static void addProto(const char *s1,const char *s2,const char *s3, const char *s4,const char *s5,const char *s6) { - (void)s3; // avoid unused warning + // (void)s3; // avoid unused warning (void)s5; // avoid unused warning static QRegExp reg("[\\s]"); QCString name=s2; @@ -2146,9 +2220,29 @@ static void addProto(const char *s1,const char *s2,const char *s3, { Argument *arg=new Argument; arg->name=(QCString)ql[u]; - arg->type=s4; - arg->defval=s1; - arg->attrib=s6; + if (s3) + { + arg->type=s3; + } + arg->type+=" "; + arg->type+=s4; + if (s6) + { + arg->type+=s6; + } + if (parse_sec==GEN_SEC && param_sec==0) + { + arg->defval="gen!"; + } + + if (parse_sec==PARAM_SEC) + { + assert(false); + } + + arg->defval+=s1; + arg->attrib="";//s6; + current->argList->append(arg); current->args+=s2; current->args+=","; @@ -2175,12 +2269,20 @@ static void createFunction(const QCString &impure,int spec, { int it=0; current->bodyLine=getParsedLine(spec); - current->spec=spec; + current->spec=spec; current->section=Entry::FUNCTION_SEC; current->exception=impure; + + if (parse_sec==GEN_SEC) + { + current->spec= VhdlDocGen::GENERIC; + current->section=Entry::FUNCTION_SEC; + } + if (currP==VhdlDocGen::PROCEDURE) { current->name=impure; + current->exception=""; it=t_PROCEDURE; } else @@ -2195,16 +2297,16 @@ static void createFunction(const QCString &impure,int spec, current->args=fname; current->name=impure; if (!fname.isEmpty()) - { + { QStringList q1=QStringList::split(',',fname); for (uint ii=0;ii<q1.count();ii++) { - Argument *arg=new Argument; - arg->name=(QCString)q1[ii]; - current->argList->append(arg); + Argument *arg=new Argument; + arg->name=(QCString)q1[ii]; + current->argList->append(arg); } } - } + } current->startLine=getParsedLine(it); current->bodyLine=getParsedLine(it); @@ -2222,21 +2324,24 @@ static void addVhdlType(const QCString &name,int startLine,int section,int spec, return; } + if (parse_sec==GEN_SEC) + { + spec= VhdlDocGen::GENERIC; + } + // more than one name ? QStringList ql=QStringList::split(",",name,FALSE); for (uint u=0;u<ql.count();u++) { current->name=(QCString)ql[u]; - if (section==Entry::VARIABLE_SEC && - !(spec == VhdlDocGen::USE || spec == VhdlDocGen::LIBRARY) - ) + if (section==Entry::VARIABLE_SEC && !(spec == VhdlDocGen::USE || spec == VhdlDocGen::LIBRARY) ) { current->name.prepend(VhdlDocGen::getRecordNumber()); } current->startLine=startLine; current->bodyLine=startLine; - current->section=section; + current->section=section; current->spec=spec; current->fileName=s_str.fileName; if (current->args.isEmpty()) @@ -2253,9 +2358,9 @@ static void addVhdlType(const QCString &name,int startLine,int section,int spec, static void newEntry() { - if (current->spec==VhdlDocGen::ENTITY || - current->spec==VhdlDocGen::PACKAGE || - current->spec==VhdlDocGen::ARCHITECTURE || + if (current->spec==VhdlDocGen::ENTITY || + current->spec==VhdlDocGen::PACKAGE || + current->spec==VhdlDocGen::ARCHITECTURE || current->spec==VhdlDocGen::PACKAGE_BODY ) { @@ -2263,7 +2368,7 @@ static void newEntry() } else { - if (lastCompound) + if (lastCompound) { lastCompound->addSubEntry(current); } @@ -2271,11 +2376,11 @@ static void newEntry() { if (lastEntity) { - lastEntity->addSubEntry(current); + lastEntity->addSubEntry(current); } - else + else { - current_root->addSubEntry(current); + current_root->addSubEntry(current); } } } diff --git a/src/vhdlscanner.l b/src/vhdlscanner.l index 3212b75..9a7cf3a 100644 --- a/src/vhdlscanner.l +++ b/src/vhdlscanner.l @@ -4,7 +4,7 @@ * * This scanner is derived from a scanner of the ALLIANCE CAD toolset, * release 1.1. That toolset was written from: - * MASI/CAO-VLSI CAD Team + * MASI/CAO-VLSI CAD Team * Laboratoire MASI/CAO-VLSI * Tour 55-65, 2eme etage, Porte 13 * Universite Pierre et Marie Curie (PARIS VI) @@ -107,6 +107,7 @@ static QMap<QCString, int> keyMap; static void handleCommentBlock(const QCString &doc,bool brief); static void mapLibPackage(const Entry* ce); static Entry* getEntryAtLine(const Entry* ce,int line); +static bool addLibUseClause(const QCString &type); #define YY_NEVER_INTERACTIVE 1 @@ -321,12 +322,12 @@ static void makeInlineDoc(int endCode) if (compound) { - compound->addSubEntry(temp); + compound->addSubEntry(temp); } else { - temp->type="misc"; // global code like library ieee... - current_root->addSubEntry(temp); + temp->type="misc"; // global code like library ieee... + current_root->addSubEntry(temp); } strComment.resize(0); gBlock.reset(); @@ -445,6 +446,19 @@ BR [ \t\n\r] // printf("\n <<<< insert tok: %s %d %d>>>\n",vhdlScanYYtext,itoken,yyLineNr); lineIndex[itoken]=yyLineNr; } + + // global members + if (( itoken==t_ARCHITECTURE ) || + ( itoken==t_ENTITY) || + ( itoken==t_PACKAGE ) || + ( itoken==t_LIBRARY ) || + ( itoken==t_USE ) || + ( itoken==t_CONFIGURATION ) || + ( itoken==t_CONTEXT ) ) + { + lineIndex[itoken]=yyLineNr; + } + prevToken=itoken; yycont->qstr=vhdlScanYYtext; @@ -521,7 +535,7 @@ BR [ \t\n\r] . { /* unknown characters */ } -<*>{BR}*"--!"[^{}\n][^\n]*\n/{B}*"--!" { // multi line comment +<*>{B}*"--!"[^{}\n][^\n]*\n/{B}*"--!" { // multi line comment if (iDocLine==-1) iDocLine=yyLineNr; QCString qc(vhdlScanYYtext); int len=qc.contains('\n')+yyLineNr-1; @@ -556,6 +570,7 @@ BR [ \t\n\r] startCodeBlock(index); } lineCount(); + BEGIN(Comment); } <Comment>.|\n { @@ -566,12 +581,14 @@ BR [ \t\n\r] { startCodeBlock(index); } - + VhdlDocGen::prepareComment(strComment); - - + + if (index==-1) + { handleCommentBlock(strComment,FALSE); + } strComment.resize(0);; unput(*vhdlScanYYtext); BEGIN(g_lastCommentContext); @@ -658,11 +675,11 @@ BR [ \t\n\r] if (c =='/') { unput('*'); - BEGIN(Vhdl2008Comment); + BEGIN(EndVhdl2008Comment); } else { - BEGIN(EndVhdl2008Comment); + BEGIN(Vhdl2008Comment); } } @@ -825,30 +842,40 @@ static void mapLibPackage(const Entry* ce) for (;(rt=eli.current()),eli1=eli;++eli) { if (rt->spec==VhdlDocGen::LIBRARY || rt->spec==VhdlDocGen::USE) - // top level library or use statement + // top level library or use statement { - Entry *temp=0; - for (;(temp=eli1.current());++eli1) // find next entity - { - if (temp->spec==VhdlDocGen::ENTITY || temp->spec==VhdlDocGen::PACKAGE || temp->spec==VhdlDocGen::ARCHITECTURE || temp->spec==VhdlDocGen::PACKAGE_BODY) - { - Entry *ee=new Entry(*rt); //append a copy to entries sublist - temp->addSubEntry(ee); - found=TRUE; - rt->spec=-1; //nullify entry - rt->section=0; - lastComp=temp; - break; - } - }//for - if (lastComp && rt->spec!=-1) - { - Entry *ee=new Entry(*rt); //append a copy to entries sublist - lastComp->addSubEntry(ee); - found=TRUE; - rt->spec=-1; //nullify entry - rt->section=0; - } + Entry *temp=0; + if(!addLibUseClause(rt->name)) + { + rt->spec=-1; + rt->section=0; + // continue; + } + + for (;(temp=eli1.current());++eli1) // find next entity + { + if (temp->spec==VhdlDocGen::ENTITY || + temp->spec==VhdlDocGen::PACKAGE || + temp->spec==VhdlDocGen::ARCHITECTURE || + temp->spec==VhdlDocGen::PACKAGE_BODY) + { + Entry *ee=new Entry(*rt); //append a copy to entries sublist + temp->addSubEntry(ee); + found=TRUE; + rt->spec=-1; //nullify entry + rt->section=0; + lastComp=temp; + break; + } + }//for + if (lastComp && rt->spec!=-1) + { + Entry *ee=new Entry(*rt); //append a copy to entries sublist + lastComp->addSubEntry(ee); + found=TRUE; + rt->spec=-1; //nullify entry + rt->section=0; + } }//if }//for if (!found) // nothing left to do @@ -858,6 +885,24 @@ static void mapLibPackage(const Entry* ce) }//while }//MapLib +static bool addLibUseClause(const QCString &type) +{ + static bool show=Config_getBool("SHOW_INCLUDE_FILES"); + static bool showIEEESTD=Config_getBool("FORCE_LOCAL_INCLUDES"); + + if (!show) // all libraries and included packages will not be shown + { + return FALSE; + } + + if (!showIEEESTD) // all standard packages and libraries will not be shown + { + if (type.lower().stripPrefix("ieee")) return FALSE; + if (type.lower().stripPrefix("std")) return FALSE; + } + return TRUE; +} + static void handleCommentBlock(const QCString &doc,bool brief) { int position=0; diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 856d3d2..1e135ef 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -953,6 +953,19 @@ void XmlDocVisitor::visitPost(DocText *) { } +void XmlDocVisitor::visitPre(DocHtmlBlockQuote *) +{ + if (m_hide) return; + m_t << "<blockquote>"; +} + +void XmlDocVisitor::visitPost(DocHtmlBlockQuote *) +{ + if (m_hide) return; + m_t << "</blockquote>"; +} + + void XmlDocVisitor::filter(const char *str) { m_t << convertToXML(str); diff --git a/src/xmldocvisitor.h b/src/xmldocvisitor.h index 7d2ab4b..531cd38 100644 --- a/src/xmldocvisitor.h +++ b/src/xmldocvisitor.h @@ -131,6 +131,8 @@ class XmlDocVisitor : public DocVisitor void visitPost(DocCopy *); void visitPre(DocText *); void visitPost(DocText *); + void visitPre(DocHtmlBlockQuote *); + void visitPost(DocHtmlBlockQuote *); private: diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 886e921..b398ac3 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -119,8 +119,8 @@ inline void writeXMLCodeString(FTextStream &t,const char *s, int &col) { case '\t': { - int spacesToNextTabStop = - Config_getInt("TAB_SIZE") - (col%Config_getInt("TAB_SIZE")); + static int tabSize = Config_getInt("TAB_SIZE"); + int spacesToNextTabStop = tabSize - (col%tabSize); col+=spacesToNextTabStop; while (spacesToNextTabStop--) t << "<sp/>"; break; |