9 #include "../runner/common/Setup.h"
16 class TypeDescriptorFactory;
21 class SyntaxNode final :
public std::enable_shared_from_this<SyntaxNode>
25 enum class Id : uint8_t
124 std::shared_ptr<SyntaxNode>
Clone()
const;
126 bool Is(
const Id id)
const;
133 void SetLeftNode(
const std::shared_ptr<SyntaxNode>& left);
136 void SetRightNode(
const std::shared_ptr<SyntaxNode>& right);
142 void SetNextNode(
const std::shared_ptr<SyntaxNode>& next);
144 std::shared_ptr<Symbol>
GetSymbol()
const;
150 const std::string_view&
GetString()
const;
155 void Set(
const std::shared_ptr<Symbol>& symbol);
156 void Set(
const std::shared_ptr<TypeDescriptor>& type);
160 void Set(
const std::string_view text);
162 std::shared_ptr<SyntaxNode>
Cast(
const std::shared_ptr<TypeDescriptor>& type,
const std::shared_ptr<TypeDescriptorFactory>& typeDescriptorFactory);
164 void Dump(std::ofstream& output)
const;
169 std::shared_ptr<SyntaxNode> CreateCast(
const std::shared_ptr<TypeDescriptor>& type,
const std::shared_ptr<TypeDescriptorFactory>& typeDescriptorFactory);
171 std::string GetMagic()
const;
172 void DumpRecursive(std::ofstream& output)
const;
174 #if defined(MANA_MEMORY_LEAK_ANALYSIS)
178 std::shared_ptr<SyntaxNode> mLeft;
179 std::shared_ptr<SyntaxNode> mRight;
180 std::shared_ptr<SyntaxNode> mBody;
181 std::shared_ptr<SyntaxNode> mNext;
183 std::shared_ptr<Symbol> mSymbol;
184 std::shared_ptr<TypeDescriptor> mType;
192 int16_t mLineNo = -1;
196 std::string_view mString;
198 std::string_view mFilename;
Definition: SyntaxNode.h:22
const std::string_view & GetString() const
Definition: SyntaxNode.cpp:182
void SetBodyNode(const std::shared_ptr< SyntaxNode > &body)
Definition: SyntaxNode.cpp:142
Id
構文木識別子
Definition: SyntaxNode.h:26
@ IntegerToFloat
整数から実数へ変換
@ Array
variable[argument] =
@ Priority
priority (integer)
@ FloatToInteger
実数から整数へ変換
std::shared_ptr< SyntaxNode > GetBodyNode() const
Definition: SyntaxNode.cpp:137
int_t GetInt() const
Definition: SyntaxNode.cpp:172
float_t GetFloat() const
Definition: SyntaxNode.cpp:177
std::shared_ptr< Symbol > GetSymbol() const
Definition: SyntaxNode.cpp:157
address_t GetMemorySize() const
Definition: SyntaxNode.cpp:64
std::shared_ptr< TypeDescriptor > GetTypeDescriptor() const
Definition: SyntaxNode.cpp:162
std::shared_ptr< SyntaxNode > Cast(const std::shared_ptr< TypeDescriptor > &type, const std::shared_ptr< TypeDescriptorFactory > &typeDescriptorFactory)
Definition: SyntaxNode.cpp:252
void SetLeftNode(const std::shared_ptr< SyntaxNode > &left)
Definition: SyntaxNode.cpp:122
void SetRightNode(const std::shared_ptr< SyntaxNode > &right)
Definition: SyntaxNode.cpp:132
static constexpr size_t IdSize
Definition: SyntaxNode.h:118
std::shared_ptr< SyntaxNode > GetLeftNode() const
Definition: SyntaxNode.cpp:117
void Dump(std::ofstream &output) const
Definition: SyntaxNode.cpp:310
std::shared_ptr< SyntaxNode > GetRightNode() const
Definition: SyntaxNode.cpp:127
bool Is(const Id id) const
Definition: SyntaxNode.cpp:49
void Set(const std::shared_ptr< Symbol > &symbol)
Definition: SyntaxNode.cpp:197
bool IsNot(const Id id) const
Definition: SyntaxNode.cpp:54
Id GetId() const
Definition: SyntaxNode.cpp:59
int32_t GetLineno() const
Definition: SyntaxNode.cpp:192
const std::string_view & GetFilename() const
Definition: SyntaxNode.cpp:187
std::shared_ptr< SyntaxNode > Clone() const
Definition: SyntaxNode.cpp:28
IntermediateLanguage GetOpecode() const
std::shared_ptr< SyntaxNode > GetNextNode() const
Definition: SyntaxNode.cpp:147
void SetNextNode(const std::shared_ptr< SyntaxNode > &next)
Definition: SyntaxNode.cpp:152
string body
Definition: Version.py:24
Definition: CodeBuffer.cpp:12
std::uint32_t address_t
Definition: Type.h:30
IntermediateLanguage
Definition: FileFormat.h:79
std::int32_t int_t
Definition: Type.h:28
float float_t
Definition: Type.h:27