Modules |
Files |
Inheritance Tree |
Inheritance Graph |
Name Index |
Config
File: Synopsis/Parser/C++/syn/lookup.hh
1| // Synopsis C++ Parser: lookup.hh header file
2| // The Lookup class, which uses Builder's state (including search
3| // dictionaries) to find names using the proper lookup rules.
4|
5| // $Id: lookup.hh,v 1.4 2002/11/17 12:11:44 chalky Exp $
6| //
7| // This file is a part of Synopsis.
8| // Copyright (C) 2002 Stephen Davies
9| //
10| // Synopsis is free software; you can redistribute it and/or modify it
11| // under the terms of the GNU General Public License as published by
12| // the Free Software Foundation; either version 2 of the License, or
13| // (at your option) any later version.
14| //
15| // This program is distributed in the hope that it will be useful,
16| // but WITHOUT ANY WARRANTY; without even the implied warranty of
17| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18| // General Public License for more details.
19| //
20| // You should have received a copy of the GNU General Public License
21| // along with this program; if not, write to the Free Software
22| // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23| // 02111-1307, USA.
24|
25| #ifndef H_SYNOPSIS_CPP_LOOKUP
26| #define H_SYNOPSIS_CPP_LOOKUP
27|
28| #include "ast.hh"
29|
30|
31| namespace Types
32| {
33| class Type;
34| class Base;
35| class Named;
36| class Unknown;
37| class TemplateType;
38| class FuncPtr;
39| }
40|
41|
42| class Builder;
43|
44| class ScopeInfo;
45| typedef std::vector<ScopeInfo*> ScopeSearch;
46|
47|
48|
49|
50|
51| class Lookup
52| {
53| public:
54|
55| Lookup(Builder*);
56|
57|
58| ~Lookup();
59|
60|
61| void set_access(AST::Access);
62|
63|
64|
65|
66|
67|
68|
69| AST::Scope* scope();
70|
71|
72| AST::Scope* global();
73|
74|
75|
76|
77|
78|
79|
80|
81| Types::Named* lookupType(const std::string& name, bool func_okay = false);
82|
83|
84|
85|
86|
87|
88|
89| Types::Named* lookupType(const ScopedName& names, bool func_okay=false, AST::Scope* scope=NULL);
90|
91|
92|
93| Types::Named* lookupType(const std::string& name, AST::Scope* scope);
94|
95|
96| AST::Function* lookupFunc(const std::string& , AST::Scope*, const std::vector<Types::Type*>&);
97|
98|
99|
100| AST::Function* lookupOperator(const std::string& oper, Types::Type* left_type, Types::Type* right_type);
101|
102|
103|
104| bool mapName(const ScopedName& name, std::vector<AST::Scope*>&, Types::Named*&);
105|
106|
107|
108|
109| Types::Type* arrayOperator(Types::Type* object, Types::Type* arg, AST::Function*&);
110|
111|
112|
113|
114| Types::Named* resolveType(Types::Named* maybe_unknown);
115|
116| private:
117|
118|
119| Types::Named* lookup(const std::string& name, bool func_okay = false);
120|
121|
122|
123| Types::Named* lookup(const std::string& name, const ScopeSearch&, bool func_okay = false) throw ();
124|
125|
126|
127|
128|
129| Types::Named* lookupQual(const std::string& name, const ScopeInfo*, bool func_okay = false);
130|
131|
132|
133| ScopeInfo* find_info(AST::Scope*);
134|
135|
136|
137|
138| void findFunctions(const std::string&, ScopeInfo*, std::vector<AST::Function*>&);
139|
140|
141|
142| AST::Function* bestFunction(const std::vector<AST::Function*>&, const std::vector<Types::Type*>&, int& cost);
143|
144|
145| std::string dumpSearch(ScopeInfo* scope);
146|
147|
148| Builder* m_builder;
149|
150| };
151|
152| #endif
153|