로딩중...
검색중...
일치하는것 없음
node.hpp
이 파일의 문서화 페이지로 가기
1
2#pragma once
3
6#include "core/type/ntype.hpp"
10
11namespace by {
12
13 class ases;
14 class args;
15 class visitor;
16 class visitInfo;
17 class baseObj;
18 class src;
19 class modifier;
20 template <typename K, typename V, typename defaultContainer> class tnchain;
21
23
24 template <typename T> class tmock;
25
195 class _nout node: public instance, public frameInteractable {
196 BY(ADT(node, instance))
197 friend class coreInternal;
198
199 public:
200 me& operator[](const std::string& name);
201 const me& operator[](const std::string& name) const BY_CONST_FUNC(operator[](name));
202 me& operator[](const std::string* it);
203 const me& operator[](const std::string* it) const BY_CONST_FUNC(operator[](it));
204 me& operator[](const nchar* name);
205 const me& operator[](const nchar* name) const BY_CONST_FUNC(operator[](name));
206
207 public:
208 nbool in(const node& elem) const;
209 nbool in(const node* elem) const;
210
211 virtual scope& subs() = 0;
212 const scope& subs() const BY_CONST_FUNC(subs())
219 virtual tstr<nbicontainer> mySubs() const;
220
227 const node* promote(const node& it) const;
228 const node* promote(const node* it) const BY_SIDE_FUNC(promote);
229
230 template <typename T> T* sub(std::function<nbool(const std::string&, const T&)> l);
232 const T* sub(std::function<nbool(const std::string&, const T&)> l) const BY_CONST_FUNC(sub<T>(l))
233 template <typename T = me> T* sub();
234 template <typename T = me> const T* sub() const BY_CONST_FUNC(sub<T>())
235 template <typename T = me> T* sub(const std::string& name);
236 template <typename T = me> T* sub(const std::string* it) BY_SIDE_FUNC(sub);
237 template <typename T = me> const T* sub(const std::string& name) const BY_CONST_FUNC(sub<T>(name))
238 template <typename T = me> const T* sub(const std::string* name) const BY_CONST_FUNC(sub<T>(name))
239 template <typename T = me> T* sub(const std::string& name, const args& a);
240 template <typename T = me>
241 T* sub(const std::string* name, const args& a) BY_SIDE_FUNC(name, sub(*name, a), nullptr);
242 template <typename T = me>
243 const T* sub(const std::string& name, const args& a) const BY_CONST_FUNC(sub<T>(name, a))
244 template <typename T = me>
245 const T* sub(const std::string* name, const args& a) const BY_CONST_FUNC(sub<T>(name, a))
246
247 template <typename T> tnarr<T, strTactic> subAll(std::function<nbool(const std::string&, const T&)> l) const;
248 template <typename T = me> tnarr<T, strTactic> subAll() const;
249 template <typename T = me> tpriorities<T> subAll(const std::string& name) const;
250 template <typename T = me>
251 tpriorities<T> subAll(const std::string* it) const BY_SIDE_FUNC(subAll<T>)
252
253
264 template <typename T = me>
265 tpriorities<T> subAll(const std::string& name, const args* a) const;
266 template <typename T = me> tpriorities<T> subAll(const std::string& name, const args& a) const;
267 template <typename T = me>
268 tpriorities<T> subAll(const std::string* name, const args* a) const
269 BY_SIDE_FUNC(name, subAll<T>(*name, a), tpriorities<T>());
270 template <typename T = me>
271 tpriorities<T> subAll(const std::string* name, const args& a) const
272 BY_SIDE_FUNC(name, subAll<T>(*name, a), tpriorities<T>());
273
274 bool canEval(const args& a) const;
275 virtual priorType prioritize(const args& a) const = 0;
276 priorType prioritize(const args* it) const BY_SIDE_FUNC(it, prioritize(*it), NO_MATCH);
277
278 virtual str eval(const args& a) = 0;
279 str eval(const args* it) BY_SIDE_FUNC(eval);
280 str eval(const std::string& name, const args& a);
281 str eval(const std::string& name, const args* a) BY_SIDE_FUNC(a, eval(name, a), str());
282 str eval(const std::string* name, const args& a) BY_SIDE_FUNC(name, eval(*name, a), str());
283 str eval(const std::string* name, const args* a) BY_SIDE_FUNC(name&& a, eval(*name, *a), str());
284 str eval(const std::string& name);
285 str eval(const std::string* it) BY_SIDE_FUNC(eval);
286 str eval();
287
292 virtual void rel() {}
293
294 template <typename T> nbool is() const { return is(ttype<T>::get()); }
295
296 nbool is(const typeProvidable& to) const;
297 nbool is(const typeProvidable* it) const BY_SIDE_FUNC(is);
298 nbool is(const type& to) const;
299 nbool is(const type* it) const BY_SIDE_FUNC(is);
300
301 template <typename T> tstr<T> as() const { return as(ttype<T>::get()); }
302
303 str as(const typeProvidable& to) const;
304 str as(const typeProvidable* it) const BY_SIDE_FUNC(as);
305 str as(const type& to) const;
306 str as(const type* it) const BY_SIDE_FUNC(as);
307
308 template <typename T> nbool isImpli() const { return isImpli(ttype<T>::get()); }
309
310 virtual nbool isImpli(const type& to) const;
311 nbool isImpli(const typeProvidable& to) const;
312 nbool isImpli(const typeProvidable* it) const BY_SIDE_FUNC(isImpli);
313
314 template <typename T> tstr<T> asImpli() const { return asImpli(ttype<T>::get()); }
315
316 virtual str asImpli(const type& to) const;
317 str asImpli(const typeProvidable& to) const;
318 str asImpli(const typeProvidable* it) const BY_SIDE_FUNC(asImpli);
319
320 virtual const src& getSrc() const;
321
327 virtual nbool isComplete() const;
328
345 virtual str infer() const;
346
347 virtual void accept(const visitInfo& i, visitor& v);
348
349 using frameInteractable::inFrame;
350 void inFrame(const bicontainable* args) const override;
351 using frameInteractable::outFrame;
352 void outFrame() const override;
353
354 virtual const modifier& getModifier() const;
355
356 protected:
366 virtual str _onEvalSub(node& sub, const args& a);
367 virtual void _setSrc(const src& s);
368 void _setSrc(const src* it) BY_SIDE_FUNC(_setSrc);
369 };
370
371 extern template class tnmap<std::string, node>;
373} // namespace by
Function or object evaluation arguments
Definition args.hpp:22
Definition coreInternal.hpp:39
Interface for frame interaction
Definition frameInteractable.hpp:16
Access modifier for type members
Definition modifier.hpp:13
Base class for all AST nodes in the byeol language
Definition node.hpp:195
virtual str infer() const
virtual str _onEvalSub(node &sub, const args &a)
Protected virtual method for evaluating a sub-node.
virtual nbool isComplete() const
const scope & subs() const BY_CONST_FUNC(subs()) virtual tstr< nbicontainer > mySubs() const
Returns a tstr to a container of immediate sub-nodes (excluding inherited or chained ones).
Source location information
Definition src.hpp:15
Proxy template for type parameter T
Definition tmock.hpp:19
Definition tnarr.hpp:9
Collection of prioritized elements
Definition tpriorities.hpp:59
Visitor context information
Definition visitInfo.hpp:11
Base visitor class for AST traversal
Definition visitor.hpp:61
tnchain< std::string, node, tnmap< std::string, node, immutableTactic > > scope
Symbol scope container
Definition node.hpp:22
priorType
Definition tpriorities.hpp:10
to Top