| 1 | #include "SynTree/Declaration.h"
|
|---|
| 2 | #include "SynTree/Expression.h"
|
|---|
| 3 | #include "SynTree/Type.h"
|
|---|
| 4 | #include "ResolvExpr/AlternativeFinder.h"
|
|---|
| 5 |
|
|---|
| 6 | #include <vector>
|
|---|
| 7 | #include <string>
|
|---|
| 8 | #include <list>
|
|---|
| 9 | #include <map>
|
|---|
| 10 |
|
|---|
| 11 | namespace Designators {
|
|---|
| 12 | class Matcher;
|
|---|
| 13 | class GenSym;
|
|---|
| 14 |
|
|---|
| 15 | template < class OutputIterator > bool extractNames( std::list< DeclarationWithType * > &, OutputIterator );
|
|---|
| 16 | template < class OutputIterator > bool extractNames( Expression *, OutputIterator, Matcher );
|
|---|
| 17 | void check_alternative( FunctionType *, ResolvExpr::AltList & );
|
|---|
| 18 | ObjectDecl *extractTupleV( Matcher, TupleExpr *names );
|
|---|
| 19 | bool fixDesignations( ResolvExpr::AlternativeFinder &finder, Expression *designation );
|
|---|
| 20 | DeclarationWithType *gensym( GenSym &, DeclarationWithType * );
|
|---|
| 21 |
|
|---|
| 22 | class GenSym {
|
|---|
| 23 | public:
|
|---|
| 24 | GenSym( std::string prefix = "" ) : gensym_count(0) {}
|
|---|
| 25 | GenSym( GenSym &other ) { gensym_count = other.gensym_count; }
|
|---|
| 26 |
|
|---|
| 27 | // std::string get_symbol() { }
|
|---|
| 28 | private:
|
|---|
| 29 | std::string prefix;
|
|---|
| 30 | int gensym_count;
|
|---|
| 31 | };
|
|---|
| 32 |
|
|---|
| 33 | // template< typename Key >
|
|---|
| 34 | class Matcher {
|
|---|
| 35 | public:
|
|---|
| 36 | typedef std::vector< std::string >::iterator iterator;
|
|---|
| 37 |
|
|---|
| 38 | Matcher( const std::list< DeclarationWithType * > & );
|
|---|
| 39 | ~Matcher() {}
|
|---|
| 40 |
|
|---|
| 41 | template< class OutputIterator > bool get_reorderedCall( OutputIterator );
|
|---|
| 42 | template< class InputIterator > bool add(InputIterator, InputIterator, ResolvExpr::Alternative &);
|
|---|
| 43 | template< class InputIterator, class OutputIterator > bool slice(InputIterator begin, InputIterator end, OutputIterator );
|
|---|
| 44 | //std::vector<std::string> &get_order() const { return order; }
|
|---|
| 45 |
|
|---|
| 46 | iterator begin() { return order.begin(); }
|
|---|
| 47 | iterator end() { return order.end(); }
|
|---|
| 48 |
|
|---|
| 49 | //Expression *operator[]( int idx ) { return table( order[ idx ] ); }
|
|---|
| 50 | private:
|
|---|
| 51 | std::map< std::string, int > table;
|
|---|
| 52 | std::vector<std::string> order;
|
|---|
| 53 | std::vector<DeclarationWithType *> declarations;
|
|---|
| 54 | std::vector<ResolvExpr::Alternative *> alternatives;
|
|---|
| 55 | };
|
|---|
| 56 | // void pruneAlternatives( Expression *expr, ResolvExpr::AlternativeFinder & );
|
|---|
| 57 |
|
|---|
| 58 | } // namespace Designators
|
|---|
| 59 |
|
|---|
| 60 | /*
|
|---|
| 61 | Local Variables:
|
|---|
| 62 | mode: c++
|
|---|
| 63 | End:
|
|---|
| 64 | */
|
|---|