#ifndef _TUPLE_NAMEMATCH_H_
#define _TUPLE_NAMEMATCH_H_

#include <map>
#include <vector>
#include <string>

#include "SynTree/SynTree.h"
#include "SynTree/Mutator.h"

#include "SynTree/Type.h"
#include "SynTree/Declaration.h"
#include "SynTree/Expression.h"
#include "SynTree/Statement.h"

#include "ResolvExpr/Alternative.h"

namespace Tuples {
  struct NoMoreElements {};
  struct NoMatch {
    NoMatch( std::string msg ) : message( msg ) {}
    std::string message;
  };

  class NameMatcher
  {
  public:
    NameMatcher( std::list< DeclarationWithType* >& );
    ~NameMatcher();

    void match( ResolvExpr::AltList &alternatives ) throw (NoMatch) ;
    ResolvExpr::Alternative &get_next() throw (NoMoreElements);

  private:
    int current;
    std::vector< DeclarationWithType* > index;
    std::vector< const ResolvExpr::Alternative * > exprs;
    std::map< std::string, int> table;
  };

} // namespace Tuples

#endif // #ifndef _TUPLE_NAMEMATCH_H_

/*
  Local Variables:
  mode: c++
  End:
*/
