Commit 3b8fea2f authored by Dimitri van Heesch's avatar Dimitri van Heesch
Browse files

Vhdl fixes

parent 7506404e
Loading
Loading
Loading
Loading
+105 −92
Original line number Diff line number Diff line
@@ -28,9 +28,9 @@
#include <qfileinfo.h>
#include <qstringlist.h>

#ifdef DEBUGFLOW
//#ifdef DEBUGFLOW
#include <qmap.h>
#endif
//#endif

/* --------------------------------------------------------------- */

@@ -58,7 +58,9 @@
#include "namespacedef.h"
#include "filename.h"
#include "membergroup.h"
#include "memberdef.h"

#include "vhdljjparser.h"
#include "VhdlParser.h"

#include "vhdlcode.h"
@@ -712,11 +714,13 @@ ClassDef* VhdlDocGen::getPackageName(const QCString & name)
  return cd;
}

static QMap<QCString,MemberDef*> varMap;
static QList<ClassDef> qli;
static QMap<ClassDef*,QList<ClassDef> > packages;

MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& memName)
{
  QDict<QCString> packages(17,FALSE);
  packages.setAutoDelete(TRUE);
  ClassDef* cd;
  ClassDef* cd,*ecd;
  MemberDef *mdef=0;

  cd=getClass(className);
@@ -738,7 +742,7 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
    // searching upper/lower case names

    QCString tt=d->name();
    ClassDef *ecd =getClass(tt);
    ecd =getClass(tt);
    if (!ecd)
    {
      tt=tt.upper();
@@ -758,12 +762,9 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
      mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType_pubMethods);
      if (mdef) return mdef;
    }
    //cd=getClass(getClassName(cd));
    //if (!cd) return 0;
   }
  // 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 ||
      (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS)
  {
@@ -781,60 +782,88 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
      tt=tt.lower();
      ecd =getClass(tt);
    }

    if (ecd) //d && d->definitionType()==Definition::TypeClass)
    {
      VhdlDocGen::findAllPackages(ecd->className(),packages);
      if(!packages.contains(ecd))
      {
        VhdlDocGen::findAllPackages(ecd);
      }
    }

  QDictIterator<QCString> packli(packages);
  QCString *curString;
  for (packli.toFirst();(curString=packli.current());++packli)
  {
    if (curString)
    {
      cd=VhdlDocGen::getPackageName(*curString);
      if (!cd)
      {
        *curString=curString->upper();
        cd=VhdlDocGen::getPackageName(*curString);
  }
      if (!cd)
  else
  {
        *curString=curString->lower();
        cd=VhdlDocGen::getPackageName(*curString);
      }
    ecd=cd;
    if (!packages.contains(ecd)) VhdlDocGen::findAllPackages(ecd);
  }
    if (cd)

  uint len=packages.count();
  for (uint j=0;j<len;j++)
  {
      mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType_variableMembers);
    for (QMap<ClassDef*,QList<ClassDef> >::Iterator cList=packages.begin();cList != packages.end();cList++)
    {
      if (cList.key()==0) continue;
      QList<ClassDef> mlist=cList.data();
      for (uint j=0;j<mlist.count();j++)
      {
        mdef=VhdlDocGen::findMemberDef(mlist.at(j),memName,MemberListType_variableMembers);
        if (mdef) return mdef;
      mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType_pubMethods);
        mdef=VhdlDocGen::findMemberDef(mlist.at(j),memName,MemberListType_pubMethods);
        if (mdef) return mdef;
      }
  } // for
    }
  }
  return 0;

}//findMember

/**
 *  This function returns the entity|package
 *  in which the key (type) is found
 */

MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberListType type)
{
  //    return cd->getMemberByName(key);//does not work
  MemberDef *md=0;
  MemberList *ml=0;
  QCString keyType=cd->symbolName()+"@"+key;
  //printf("\n %s | %s | %s",cd->symbolName().data(),key.data(,),keyType.data());

  MemberList *ml=    cd->getMemberList(type);
  if (ml==0) return 0;

  QMap<QCString, MemberDef*>::Iterator it =varMap.find(keyType);
  if (it.key())
  {
    md=it.data();
    if (md)
    {
      return md;
    }
  }
  if (qli.contains(cd))
  {
    return 0;
  }
  ml=cd->getMemberList(type);
  qli.append(cd);
  if (!ml)
  {
    return 0;
  }
  MemberListIterator fmni(*ml);
  //int l=ml->count();
  //	fprintf(stderr,"\n loading enity %s %s: %d",cd->symbolName().data(),keyType.data(),l);

  for (fmni.toFirst();(md=fmni.current());++fmni)
  {
    if (qstricmp(key,md->name())==0)
    QCString tkey=cd->symbolName()+"@"+md->name();
    if (varMap.contains(tkey))
    {
      continue;
    }
    varMap.insert(tkey.data(),md);
  }
  it=varMap.find(keyType.data());
  if (it.key())
  {
    md=it.data();
    if (md)
    {
      return md;
    }
@@ -846,42 +875,30 @@ MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList
 * finds all included packages of an Entity or Package
 */

void VhdlDocGen::findAllPackages(const QCString& className,QDict<QCString>& qdict)
{
  ClassDef *cdef=getClass(className);
  if (cdef)
void VhdlDocGen::findAllPackages( ClassDef *cdef)
{
  QList<ClassDef> cList;
  if (packages.contains(cdef)) return;
  MemberList *mem=cdef->getMemberList(MemberListType_variableMembers);
  MemberDef *md;

    if (mem)
    {
  if (!mem) return;

  MemberListIterator fmni(*mem);
  for (fmni.toFirst();(md=fmni.current());++fmni)
  {
    if (VhdlDocGen::isPackage(md))
    {
          QCString *temp1=new QCString(md->name().data());
          //*temp1=temp1->lower();
          QCString p(md->name().data());
          //p=p.lower();
          ClassDef* cd=VhdlDocGen::getPackageName(*temp1);
      ClassDef* cd=VhdlDocGen::getPackageName(md->name());
      if (cd)
      {
            QCString *ss=qdict.find(*temp1);
            if (ss==0)
            {
              qdict.insert(p,temp1);
              QCString tmp=cd->className();
              VhdlDocGen::findAllPackages(tmp,qdict);
        cList.append(cd);
        VhdlDocGen::findAllPackages(cd);
        packages.insert(cdef,cList);
      }
            else delete temp1;
          }
          else delete temp1;
    }
  }//for
    }//if
  }//cdef

}// findAllPackages

/*!
@@ -1939,17 +1956,6 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,

  Definition *d=0;

  /* some vhdl files contain only a configuration  description

     library work;
     configuration cfg_tb_jtag_gotoBackup of tb_jtag_gotoBackup is
     for RTL
     end for;
     end cfg_tb_jtag_gotoBackup;

     in this case library work does not belong to an entity, package ...

   */

  ASSERT(cd!=0 || nd!=0 || fd!=0 || gd!=0 ||
      mdef->getMemberSpecifiers()==VhdlDocGen::LIBRARY ||
@@ -2024,11 +2030,11 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
  ClassDef *annoClassDef=mdef->getClassDefOfAnonymousType();

  // start a new member declaration
  bool isAnonymous = annoClassDef; // || m_impl->annMemb || m_impl->annEnumType;
  uint isAnonymous = (bool)(annoClassDef); // || m_impl->annMemb || m_impl->annEnumType;
  ///printf("startMemberItem for %s\n",name().data());
  int mm=mdef->getMemberSpecifiers();
  if (mm==VhdlDocGen::MISCELLANEOUS)
      isAnonymous=TRUE;
      isAnonymous=3;

   ol.startMemberItem( mdef->anchor(), isAnonymous ); //? 1 : m_impl->tArgList ? 3 : 0);

@@ -2274,8 +2280,8 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
    ol.endDoxyAnchor(cfname,mdef->anchor());
  }

  //printf("endMember %s annoClassDef=%p annEnumType=%p\n",
  //    name().data(),annoClassDef,annEnumType);
 // if(mm!=VhdlDocGen::MISCELLANEOUS)
  ol.endMemberItem();
  if (!mdef->briefDescription().isEmpty() &&   Config_getBool("BRIEF_MEMBER_DESC") /* && !annMemb */)
  {
@@ -2592,7 +2598,7 @@ void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList&
void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname)
{
  ParserInterface *pIntf = Doxygen::parserManager->getParser(".vhd");
  pIntf->resetCodeParserState();
 // pIntf->resetCodeParserState();

  QCString codeFragment=mdef->documentation();

@@ -3363,6 +3369,13 @@ void VhdlDocGen::createFlowChart(const MemberDef *mdef)
  pIntf->finishTranslationUnit();
}

void VhdlDocGen::resetCodeVhdlParserState()
{
  varMap.clear();
  qli.clear();
  packages.clear();
}

bool VhdlDocGen::isConstraint(const MemberDef *mdef)
{ return mdef->getMemberSpecifiers()==VhdlDocGen::UCF_CONST; }
bool VhdlDocGen::isConfig(const MemberDef *mdef)
@@ -4437,7 +4450,7 @@ void FlowChart::writeFlowLinks(FTextStream &t)
void VHDLLanguageScanner::parseCode(CodeOutputInterface &codeOutIntf,
    const char *scopeName,
    const QCString &input,
    SrcLangExt ,
    SrcLangExt, // lang
    bool isExampleBlock,
    const char *exampleName,
    FileDef *fileDef,
+2 −3
Original line number Diff line number Diff line
@@ -108,8 +108,7 @@ class VhdlDocGen
    static ClassDef* getPackageName(const QCString& name);
    static MemberDef* findMember(const QCString& className, 
                                 const QCString& memName);
    static void findAllPackages(const QCString& className,
                                QDict<QCString>&);
    static void findAllPackages(ClassDef*);
    static MemberDef* findMemberDef(ClassDef* cd,
                                const QCString& key,
                                MemberListType type);
@@ -246,7 +245,7 @@ class VhdlDocGen
             cu->spec==VhdlDocGen::PACKAGE_BODY;
    }


  static void resetCodeVhdlParserState();

  private:
    static void findAllArchitectures(QList<QCString>& ql,const ClassDef *cd);
+287 −67
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@
#include "outputlist.h"
#include "arguments.h"
#include "types.h"

#include "VhdlParserIF.h"

using namespace vhdl::parser;
@@ -38,15 +37,40 @@ static ParserInterface *g_thisParser;

static QCString         yyFileName;
static int              yyLineNr      = 1;
static bool             docBlockAutoBrief = FALSE;
static char             docBlockTerm = FALSE;
static int              iDocLine      = -1;
static int              lineParseSize = 200;
static int*             lineParse;
static int              iDocLine      = -1;
static QCString         inputString;
static Entry            gBlock;
static Entry*           previous      = 0;
#if 0
int iLine;
QStringList      qrl;
ParserInterface *g_thisParser;
int              inputPosition;
int              inputLen;
int              startComment  = 0;
QFile            inputFile;
QCString         inbuf;

QCString         yyFileName;
bool             g_lexInit     = FALSE;
int              yyLineNr      = 1;
int              g_lastCommentContext = 0;
bool             docBlockAutoBrief;
char             docBlockTerm;
int              iDocLine      = -1;
int              num_chars;
int*             lineParse;
#endif
//-------------------------------------------------------

static Entry* oldEntry;
static bool varr=FALSE;
static QCString varName;

static QList<Entry> instFiles;
static QList<Entry> libUse;
static QList<Entry> lineEntry;

Entry*   VhdlParser::currentCompound=0;
Entry*   VhdlParser::tempEntry=0;
@@ -68,21 +92,99 @@ int VhdlParser::levelCounter;

static QList<VhdlConfNode> configL;

struct
{
  QCString doc;
  bool brief;
  bool pending;
  int iDocLine;
} str_doc;

static bool doxComment=FALSE; // doxygen comment ?
static QCString strComment;
static int iCodeLen;

bool  checkMultiComment(QCString& qcs,int line);
QList<Entry>* getEntryAtLine(const Entry* ce,int line);

//-------------------------------------

QList<VhdlConfNode>& getVhdlConfiguration() { return  configL; }
QList<Entry>& getVhdlInstList() { return  instFiles; }

Entry* getVhdlCompound()
{
  if (VhdlParser::lastEntity) return VhdlParser::lastEntity;
  if (VhdlParser::lastCompound) return VhdlParser::lastCompound;
  return NULL;
}

void startCodeBlock(int index)
{
  int ll=strComment.length();
  iCodeLen=inputString.findRev(strComment.data())+ll;
  // fprintf(stderr,"\n startin code..%d %d %d\n",iCodeLen,num_chars,ll);
  //assert(false);
  gBlock.reset();
  int len=strComment.length();
  QCString name=strComment.right(len-index);//
  name=VhdlDocGen::getIndexWord(name.data(),1);
  if (!name)
    gBlock.name="misc"+ VhdlDocGen::getRecordNumber();
  else
    gBlock.name=name;

  //int li=strComment.contains('\n');

  gBlock.startLine=yyLineNr;
  gBlock.bodyLine=yyLineNr;

  strComment=strComment.left(index);
  VhdlDocGen::prepareComment(strComment);
  gBlock.brief+=strComment;
}

void makeInlineDoc(int endCode)
{
  int len=endCode-iCodeLen;
  QCString par=inputString.mid(iCodeLen,len);
  //fprintf(stderr,"\n inline code: \n<%s>",par.data());
  gBlock.doc=par;
  gBlock.inbodyDocs=par;
  gBlock.section=Entry::VARIABLE_SEC;
  gBlock.spec=VhdlDocGen::MISCELLANEOUS;
  gBlock.fileName = yyFileName;
  gBlock.endBodyLine=yyLineNr-1;
  gBlock.lang=SrcLangExt_VHDL;
  Entry *temp=new Entry(gBlock);
  Entry* compound=getVhdlCompound();

  if (compound)
  {
    compound->addSubEntry(temp);
  }
  else
  {
    temp->type="misc"; // global code like library ieee...
    VhdlParser::current_root->addSubEntry(temp);
  }
  strComment.resize(0);
  gBlock.reset();
}// makeInlineDoc


bool isConstraintFile(const QCString &fileName,const QCString &ext)
{
  return fileName.right(ext.length())==ext;
}


void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root,
                          bool ,QStrList&)
{
  g_thisParser=this;
  bool inLine=false;

  inputString=fileBuf;
  if (strlen(fileName)==0)
  {
    inLine=true;
@@ -115,27 +217,22 @@ void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,En
  VhdlParser::current=new Entry();
  VhdlParser::initEntry(VhdlParser::current);
  groupEnterFile(fileName,yyLineNr);
  lineParse=new int[lineParseSize];
  lineParse=new int[200];
  VhdlParserIF::parseVhdlfile(fileBuf,inLine);

  delete VhdlParser::current;
  VhdlParser::current=0;

  if (!inLine)
  {
  VhdlParser::mapLibPackage(root);
  }

  delete lineParse;
  yyFileName.resize(0);
  libUse.clear();
  VhdlDocGen::resetCodeVhdlParserState();
}


void VhdlParser::lineCount()
{
 yyLineNr++;
}
void VhdlParser::lineCount(){ yyLineNr++; }

void VhdlParser::lineCount(const char* text)
{
@@ -145,10 +242,22 @@ void VhdlParser::lineCount(const char* text)
  }
}

void isVhdlDocPending()
{
  if (!str_doc.pending) return;

  str_doc.pending=FALSE;
  oldEntry=0; // prevents endless recursion
  iDocLine=str_doc.iDocLine;
  VhdlParser::handleCommentBlock(str_doc.doc,str_doc.brief);
  iDocLine=-1;
}

void VhdlParser::initEntry(Entry *e)
{
  e->fileName = yyFileName;
  e->lang     = SrcLangExt_VHDL;
  isVhdlDocPending();
  initGroupInfo(e);
}

@@ -179,25 +288,94 @@ void VhdlParser::newEntry()
      }
    }
  }
  //previous = current;
  previous = current;
  current = new Entry ;
  initEntry(current);
}

bool checkInlineCode(QCString & doc)
{
  int index=doc.find("\\code");

  if (index>0)
  {
     strComment+=doc;
	 startCodeBlock(index);
	 doxComment=TRUE;
	 return true;
  }
  return false;
}

void VhdlParser::handleFlowComment(const char* doc)
{
  lineCount(doc);
  if (VhdlDocGen::getFlowMember())
  {
    QCString qcs(doc);
    qcs=qcs.stripWhiteSpace();
    qcs.stripPrefix("--#");
    FlowChart::addFlowChart(FlowChart::COMMENT_NO,0,0,qcs.data());
  }
}

void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
{
  int position=0;
  static bool isIn;
  QCString doc(doc1);
  if (doc.isEmpty()) return;

  if (checkMultiComment(doc,yyLineNr))
  {
    lineCount(doc1);
    return;
  }

  isIn=checkInlineCode(doc);
  bool isEndCode=doc.contains("\\endcode");
  // empty comment  --!
  if (isEndCode)
  {
    int end=inputString.find(doc.data(),iCodeLen);
    makeInlineDoc(end);
    strComment.resize(0);
    isIn=false;
  }
  if (isIn)
  {
    isIn=false;
    lineCount(doc1);
    return;
  }

  VhdlDocGen::prepareComment(doc);

  bool needsEntry=FALSE;
  Protection protection=Public;
  int lineNr = iDocLine;

  if (oldEntry==current)
  {
    //printf("\n find pending message  < %s > at line: %d \n ",doc.data(),iDocLine);
    str_doc.doc=doc;
    str_doc.iDocLine=iDocLine;
    str_doc.brief=brief;
    str_doc.pending=TRUE;
    return;
  }

  oldEntry=current;

  if (brief)
  {
    current->briefLine = yyLineNr;
  }
  else
  {
    current->docLine = yyLineNr;

  //printf("parseCommentBlock %p [%s]\n",current,doc.data());
  }
  //  printf("parseCommentBlock file<%s>\n [%s]\n",yyFileName.data(),doc.data());
  while (parseCommentBlock(
        g_thisParser,
        current,
@@ -205,7 +383,7 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
        yyFileName, // file
        lineNr,     // line of block start
        brief,
	docBlockAutoBrief,
        0,
        FALSE,
        protection,
        position,
@@ -218,20 +396,26 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
  }
  if (needsEntry)
  {
    if (varr)
    {
      varr=FALSE;
      current->name=varName;
      current->section=Entry::VARIABLEDOC_SEC;
      varName="";
    }
    newEntry();
  }
  lineCount(doc1);
}

  if (docBlockTerm)
void VHDLLanguageScanner::parsePrototype(const char *text)
{
   // unput(docBlockTerm);
    docBlockTerm=0;
  }
  lineCount(doc1);
  varName=text;
  varr=TRUE;
}

void VhdlParser::addCompInst(char *n, char* instName, char* comp,int iLine)
{

  current->spec=VhdlDocGen::INSTANTIATION;
  current->section=Entry::VARIABLE_SEC;
  current->startLine=iLine;
@@ -276,7 +460,9 @@ void VhdlParser::addVhdlType(const char *n,int startLine,int section,
  if (isFuncProcProced() || VhdlDocGen::getFlowMember())  return;

  if (parse_sec==GEN_SEC)
  {
    spec= VhdlDocGen::GENERIC;
  }

  QStringList ql=QStringList::split(",",name,FALSE);

@@ -304,10 +490,8 @@ void VhdlParser::addVhdlType(const char *n,int startLine,int section,
  }
}

void VhdlParser::createFunction(const char *imp,uint64 spec,
    const char *fn)
void VhdlParser::createFunction(const char *imp,uint64 spec,const char *fn)
{

  QCString impure(imp);
  QCString fname(fn);
  current->spec=spec;
@@ -336,7 +520,6 @@ void VhdlParser::createFunction(const char *imp,uint64 spec,

  if (spec==VhdlDocGen::PROCESS)
  {

    current->args=fname;
    current->name=impure;
    VhdlDocGen::deleteAllChars(current->args,' ');
@@ -402,7 +585,9 @@ void VhdlParser::addConfigureNode(const char* a,const char*b, bool,bool isLeaf,b
    VhdlConfNode* vc=configL.getLast();
    level=vc->level;
    if (levelCounter==0)
    {
      pushLabel(forL,ent);
    }
    else if (level<levelCounter)
    {
      if (!isLeaf)
@@ -418,10 +603,8 @@ void VhdlParser::addConfigureNode(const char* a,const char*b, bool,bool isLeaf,b
  else
  {
    pushLabel(forL,ent);

  }


  if (inlineConf)
  {
    confName=lastCompound->name;
@@ -508,17 +691,18 @@ void VhdlParser::mapLibPackage( Entry* root)
      for (eLib.toFirst();(current=eLib.current());++eLib)
      {
        if (VhdlDocGen::isVhdlClass(current))
        {
          if (current->startLine > rt->startLine)
          {
            bFound=TRUE;
            current->addSubEntry(new Entry(*rt));
            break;
          }
        }
      }//for
      if (!bFound)
      {
        root->addSubEntry(new Entry(*rt));

      }
    } //if
  }// for
@@ -543,7 +727,7 @@ int VhdlParser::getLine()

void VhdlParser::setLineParsed(int tok)
{
  if (tok<lineParseSize) lineParse[tok]=yyLineNr;
  lineParse[tok]=yyLineNr;
}

int VhdlParser::getLine(int tok)
@@ -551,7 +735,6 @@ int VhdlParser::getLine(int tok)
  int val=lineParse[tok];
  if (val<0) val=0;
  //assert(val>=0 && val<=yyLineNr);

  return val;
}

@@ -605,4 +788,41 @@ void VhdlParser::createFlow()
  currP=0;
}

bool  checkMultiComment(QCString& qcs,int line)
{
  QList<Entry> *pTemp=getEntryAtLine(VhdlParser::current_root,line);

  if (pTemp->isEmpty()) return false;

  //int ii=pTemp->count();
  // qcs.stripPrefix("--!");
  VhdlDocGen::prepareComment(qcs);
  while (!pTemp->isEmpty())
  {
    Entry *e=(Entry*)pTemp->getFirst();
    e->briefLine=line;
    e->brief+=qcs;
    iDocLine=-1;
    pTemp->removeFirst();
    //ii=pTemp->count();
  }
  return true;
}

// returns the vhdl parsed types at line xxx
QList<Entry>* getEntryAtLine(const Entry* ce,int line)
{
  EntryListIterator eli(*ce->children());
  Entry *rt;
  for (;(rt=eli.current());++eli)
  {
    if (rt->bodyLine==line)
    {
      lineEntry.insert(0,rt);
    } // if

    getEntryAtLine(rt,line);
  }
  return &lineEntry;
}
+37 −33
Original line number Diff line number Diff line
@@ -11,15 +11,17 @@
#include <qfile.h>
#include <qdict.h>
#include <string>
#include "memberlist.h"
#include "types.h"
#include "entry.h"

#include "vhdldocgen.h"
#include "qstringlist.h"
#include "vhdlcode.h"
#include "memberlist.h"
#include "config.h"




enum  { GEN_SEC=0x1, PARAM_SEC,CONTEXT_SEC,PROTECTED_SEC } ;
void  parserVhdlfile(const char* inputBuffer);

@@ -29,7 +31,8 @@ class FileStorage;
class ClassDef;
class MemberDef;
class QStringList;
class VhdlConfNode;
struct VhdlConfNode;


/** \brief VHDL parser using state-based lexical scanning.
 *
@@ -60,16 +63,15 @@ class VHDLLanguageScanner : public ParserInterface
                   MemberDef *memberDef=0,
                   bool showLineNumbers=TRUE,
                   Definition *searchCtx=0,
                   bool collectXRefs=TRUE);

                   bool collectXRefs=TRUE
				   );
		bool needsPreprocessing(const QCString &) { return TRUE; }
    void resetCodeParserState() {}
    void parsePrototype(const char *) {}
		void resetCodeParserState(){};
	    void parsePrototype(const char *text);
};

class VhdlConfNode
struct VhdlConfNode
{ 
  public:
  VhdlConfNode(const char*  a,const char*  b,const char* config,const char* cs,bool leaf) 
  { 
    arch=a;              // architecture  e.g. for iobuffer
@@ -89,9 +91,11 @@ class VhdlConfNode
  int level;
  bool isLeaf;
  bool isInlineConf;

};

void vhdlscanFreeScanner();

QList<VhdlConfNode>& getVhdlConfiguration();
QList<Entry>& getVhdlInstList();

+43 −8
Original line number Diff line number Diff line
/* Generated By:JavaCC: Do not edit this line. ErrorHandler.h Version 6.0 */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,BUILD_PARSER=true,BUILD_TOKEN_MANAGER=true */
#ifndef ERRORHANDLER_H
#define ERRORHANDLER_H
#include <string>
//#include <string>
#include "JavaCC.h"
#include "Token.h"

namespace vhdl {
namespace parser {

//JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str);

  class VhdlParser;
  class ErrorHandler {
    friend class VhdlParserTokenManager;
    friend class VhdlParser;
    protected:
      int error_count;
    public:
@@ -18,26 +23,56 @@ class VhdlParser;
      // expectedKind - token kind that the parser was trying to consume.
      // expectedToken - the image of the token - tokenImages[expectedKind].
      // actual - the actual token that the parser got instead.
      virtual void handleUnexpectedToken(int, JAVACC_STRING_TYPE expectedToken, Token *actual, VhdlParser *) {
      virtual void handleUnexpectedToken(int , JAVACC_STRING_TYPE , Token *, VhdlParser *) {
        error_count++;
        fprintf(stderr, "Expecting %s at: %d:%d but got %s\n", addUnicodeEscapes(expectedToken).c_str(), actual->beginLine, actual->beginColumn, addUnicodeEscapes(actual->image).c_str());
    //    fprintf(stderr, "Expecting %s at: %d:%d but got %s\n", addUnicodeEscapes(expectedToken).c_str(), actual->beginLine, actual->beginColumn, addUnicodeEscapes(actual->image).c_str());
      }
      // Called when the parser cannot continue parsing.
      // last - the last token successfully parsed.
      // unexpected - the token at which the error occurs.
      // production - the production in which this error occurrs.
      virtual void handleParseError(Token *, Token *unexpected, JAVACC_SIMPLE_STRING production, VhdlParser *) {
      virtual void handleParseError(Token *, Token *, JAVACC_SIMPLE_STRING , VhdlParser *) {
        error_count++;
        fprintf(stderr, "Encountered: %s at: %d:%d while parsing: %s\n", addUnicodeEscapes(unexpected->image).c_str(), unexpected->beginLine, unexpected->beginColumn, production.c_str());
  //     fprintf(stderr, "Encountered: %s at: %d:%d while parsing: %s\n", addUnicodeEscapes(unexpected->image).c_str(), unexpected->beginLine, unexpected->beginColumn, production.c_str());
      }
      virtual int getErrorCount() {
        return error_count;
      }
      virtual void handleOtherError(JAVACC_STRING_TYPE message, VhdlParser *) {
        fprintf(stderr, "Error: %s\n", (char*)message.c_str());
      }
      virtual ~ErrorHandler() {}
      ErrorHandler() { error_count = 0; }
  };

  class VhdlParserTokenManager;
  class TokenManagerErrorHandler {
    friend class VhdlParserTokenManager;
    protected:
      int error_count;
    public:
       // Returns a detailed message for the Error when it is thrown by the
       // token manager to indicate a lexical error.
       // Parameters :
       //    EOFSeen     : indicates if EOF caused the lexical error
       //    curLexState : lexical state in which this error occurred
       //    errorLine   : line number when the error occurred
       //    errorColumn : column number when the error occurred
       //    errorAfter  : prefix that was seen before this error occurred
       //    curchar     : the offending character
       //
       virtual void lexicalError(bool EOFSeen, int /*lexState*/, int errorLine, int errorColumn, JAVACC_STRING_TYPE errorAfter, JAVACC_CHAR_TYPE curChar, VhdlParserTokenManager*) {
        // by default, we just print an error message and return.
        fprintf(stderr, "Lexical error at: %d:%d. Encountered: %c after: %s.\n", errorLine, errorColumn, curChar, (EOFSeen? "EOF" : (const char*)errorAfter.c_str()));
      }
       virtual void lexicalError(JAVACC_STRING_TYPE errorMessage, VhdlParserTokenManager* ) {
        fprintf(stderr, "%s\n", (char*)errorMessage.c_str());
      }
      virtual ~TokenManagerErrorHandler() {}
  };

}
}

#endif
/* JavaCC - OriginalChecksum=282223c3bcb53b7ff385aed35944d185 (do not edit this line) */
/* JavaCC - OriginalChecksum=685d19cb4cd943b60089f599e45f23ad (do not edit this line) */
Loading