1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
3 | // |
---|
4 | // The contents of this file are covered under the licence agreement in the |
---|
5 | // file "LICENCE" distributed with Cforall. |
---|
6 | // |
---|
7 | // XXX.cc -- |
---|
8 | // |
---|
9 | // Author : Richard C. Bilson |
---|
10 | // Created On : Mon May 18 07:44:20 2015 |
---|
11 | // Last Modified By : |
---|
12 | // Last Modified On : |
---|
13 | // Update Count : 0 |
---|
14 | // |
---|
15 | #include "SynTree/Declaration.h" |
---|
16 | #include "SynTree/Expression.h" |
---|
17 | #include "SynTree/Type.h" |
---|
18 | #include "ResolvExpr/AlternativeFinder.h" |
---|
19 | |
---|
20 | #include <vector> |
---|
21 | #include <string> |
---|
22 | #include <list> |
---|
23 | #include <map> |
---|
24 | |
---|
25 | namespace Designators { |
---|
26 | class Matcher; |
---|
27 | class GenSym; |
---|
28 | |
---|
29 | template < class OutputIterator > bool extractNames( std::list< DeclarationWithType * > &, OutputIterator ); |
---|
30 | template < class OutputIterator > bool extractNames( Expression *, OutputIterator, Matcher ); |
---|
31 | void check_alternative( FunctionType *, ResolvExpr::AltList & ); |
---|
32 | ObjectDecl *extractTupleV( Matcher, TupleExpr *names ); |
---|
33 | bool fixDesignations( ResolvExpr::AlternativeFinder &finder, Expression *designation ); |
---|
34 | DeclarationWithType *gensym( GenSym &, DeclarationWithType * ); |
---|
35 | |
---|
36 | class GenSym { |
---|
37 | public: |
---|
38 | GenSym( std::string prefix = "" ) : gensym_count(0) {} |
---|
39 | GenSym( GenSym &other ) { gensym_count = other.gensym_count; } |
---|
40 | |
---|
41 | // std::string get_symbol() { } |
---|
42 | private: |
---|
43 | std::string prefix; |
---|
44 | int gensym_count; |
---|
45 | }; |
---|
46 | |
---|
47 | // template< typename Key > |
---|
48 | class Matcher { |
---|
49 | public: |
---|
50 | typedef std::vector< std::string >::iterator iterator; |
---|
51 | |
---|
52 | Matcher( const std::list< DeclarationWithType * > & ); |
---|
53 | ~Matcher() {} |
---|
54 | |
---|
55 | template< class OutputIterator > bool get_reorderedCall( OutputIterator ); |
---|
56 | template< class InputIterator > bool add(InputIterator, InputIterator, ResolvExpr::Alternative &); |
---|
57 | template< class InputIterator, class OutputIterator > bool slice(InputIterator begin, InputIterator end, OutputIterator ); |
---|
58 | //std::vector<std::string> &get_order() const { return order; } |
---|
59 | |
---|
60 | iterator begin() { return order.begin(); } |
---|
61 | iterator end() { return order.end(); } |
---|
62 | |
---|
63 | //Expression *operator[]( int idx ) { return table( order[ idx ] ); } |
---|
64 | private: |
---|
65 | std::map< std::string, int > table; |
---|
66 | std::vector<std::string> order; |
---|
67 | std::vector<DeclarationWithType *> declarations; |
---|
68 | std::vector<ResolvExpr::Alternative *> alternatives; |
---|
69 | }; |
---|
70 | // void pruneAlternatives( Expression *expr, ResolvExpr::AlternativeFinder & ); |
---|
71 | |
---|
72 | } // namespace Designators |
---|
73 | |
---|
74 | /* |
---|
75 | Local Variables: |
---|
76 | mode: c++ |
---|
77 | End: |
---|
78 | */ |
---|
79 | // Local Variables: // |
---|
80 | // tab-width: 4 // |
---|
81 | // mode: c++ // |
---|
82 | // compile-command: "make install" // |
---|
83 | // End: // |
---|