로딩중...
검색중...
일치하는것 없음
exprMaker.hpp
이 파일의 문서화 페이지로 가기
1
2#pragma once
3
4#include "core/ast/expr.hpp"
5
6namespace by {
7
8 class func;
9 class defBlock;
10 class assignExpr;
11 class defVarExpr;
12
18 class _nout exprMaker: public typeProvidable, public clonable {
19 BY(CLASS(exprMaker))
20
21 public:
22 exprMaker();
23 exprMaker(const srcFile& s, ncnt row, ncnt col);
24
25 public:
26 me& addRow();
27 me& addRow(ncnt step);
28 me& addCol();
29 me& addCol(ncnt step);
30
31 me& setRow(ncnt row);
32 me& setCol(ncnt col);
33 me& setSrcFile(const srcFile& s);
34
35 void rel();
36
37 const point& getPos() const;
38 const srcFile& getSrcFile() const;
39
40 tstr<src> makeSrc(const std::string& name) const;
41
45 template <typename T, typename... Args> T* birth(const std::string& name, const Args&... args) const {
46 T* ret = new T(args...);
47 if(_file) _setSrc(*ret, *makeSrc(name));
48 return ret;
49 }
50
58 template <typename T, typename... Args> T* make(const Args&... args) const {
59 T* ret = new T(args...);
60 if(_file) _setSrc(*ret, *makeSrc(""));
61 return ret;
62 }
63
82
83 private:
84 func* _makeFunc(const std::string& name, const narr& stmts) const;
85 void _setSrc(node& me, const src& newSrc) const;
86
87 private:
88 tstr<srcFile> _file;
89 point _pos;
90 };
91} // namespace by
Function or object evaluation arguments
Definition args.hpp:22
Assignment expression
Definition assignExpr.hpp:19
Definition block for organizing object definitions
Definition defBlock.hpp:16
Variable definition expression base class
Definition defVarExpr.hpp:18
Factory for creating expressions with source location information
Definition exprMaker.hpp:18
T * make(const Args &... args) const
Creates a new expression object without a specific name and sets its source location.
Definition exprMaker.hpp:58
func * makeCommonFunc(const defBlock &blk) const
Creates a "common" function associated with a definition block.
T * birth(const std::string &name, const Args &... args) const
Definition exprMaker.hpp:45
func * makeExpandFunc(const defBlock &blk) const
Creates a function specifically for handling "expand" logic within definition blocks.
assignExpr * makeAssignExprFrom(const defVarExpr &e) const
Creates an assignment expression from a variable definition expression.
Function definition in byeol language
Definition func.hpp:38
Base class for all AST nodes in the byeol language
Definition node.hpp:195
Source code file information
Definition srcFile.hpp:14
Source location information
Definition src.hpp:15
Definition tnarr.hpp:9
to Top