#ifndef vhdl_parserH
#define vhdl_parserH

#include <string>
#include <list>
#include "import.h"
#include "lexan_vhdl.h"
#include "vhdl_parser_struct.h"


// --------------------------------------------------------------------------
class VhdlParserClient { 
public:
	// ---- interface to semantic classes
	virtual void haveUnit(void);
	virtual void endUnit(void);
	virtual void haveEntity( const StringToken& entName );
	virtual void endEntity(void);
	virtual void havePort(InterfaceDecl& intDecl );
	virtual void haveArch(const StringToken& archName,const StringToken& entName );
	virtual void endArch(const StringToken& archName ="" );
		//signal declaration
	virtual void haveSignalDeclar( InterfaceDecl intDecl );
		//component declaration
	virtual void haveComponent(const StringToken& compName);
	virtual void endComponent(const StringToken& compName);
	virtual void haveComponentPort(InterfaceDecl& intDecl );
		// component instantion
	virtual void haveComponentInst(const StringToken& label, const StringToken& compName,const StringToken& archName);
	virtual void havePortAssoc(const StringToken& compPortName,const StringToken& NetName);
	virtual void havePosPortAssoc(int portPosition, const StringToken& NetName);
	virtual void endComponentInst(void);
		//signal_assignment
	virtual StringToken* haveSymFunc(const std::list<StringToken> listInputNames,
		const std::string& func, bool createNet = true);
	virtual void haveOperand(const StringToken& portName ); 
	virtual void haveSignalAssignment(StringToken targetName, Expr* waveform );

    virtual ~VhdlParserClient ();
};

class VhdlParser {
    bool trace_parsing;
public:
    LexanVhdl l;
    VhdlParserClient* client_;
    VhdlParser (VhdlParserClient* client): trace_parsing (false), client_(client) { Label = NULL; }
    void run (std::istream& istr, const std::string& f); // start the analysis with filename
    int resume;
    std::string fn;
    StringToken* Label;
};

#endif
