9 #include "../runner/common/Setup.h"
17 class TypeDescriptorFactory;
22 class SyntaxNode final :
public std::enable_shared_from_this<SyntaxNode>
26 enum class Id : uint8_t
122 std::shared_ptr<SyntaxNode>
Clone()
const;
124 bool Is(
const Id id)
const;
131 void SetLeftNode(
const std::shared_ptr<SyntaxNode>& left);
134 void SetRightNode(
const std::shared_ptr<SyntaxNode>& right);
140 void SetNextNode(
const std::shared_ptr<SyntaxNode>& next);
142 std::shared_ptr<Symbol>
GetSymbol()
const;
148 const std::string_view&
GetString()
const;
153 void Set(
const std::shared_ptr<Symbol>& symbol);
154 void Set(
const std::shared_ptr<TypeDescriptor>& type);
158 void Set(
const std::string_view text);
160 std::shared_ptr<SyntaxNode>
Cast(
const std::shared_ptr<TypeDescriptor>& type,
const std::shared_ptr<TypeDescriptorFactory>& typeDescriptorFactory);
162 #if MANA_BUILD_TARGET < MANA_BUILD_RELEASE
169 std::shared_ptr<SyntaxNode> CreateCast(
const std::shared_ptr<TypeDescriptor>& type,
const std::shared_ptr<TypeDescriptorFactory>& typeDescriptorFactory);
171 #if MANA_BUILD_TARGET < MANA_BUILD_RELEASE
172 void OnDump(FILE* file)
const;
176 #if MANA_BUILD_TARGET < MANA_BUILD_RELEASE
180 std::shared_ptr<SyntaxNode> mLeft;
181 std::shared_ptr<SyntaxNode> mRight;
182 std::shared_ptr<SyntaxNode> mBody;
183 std::shared_ptr<SyntaxNode> mNext;
185 std::shared_ptr<Symbol> mSymbol;
186 std::shared_ptr<TypeDescriptor> mType;
191 std::string_view mString;
193 std::string_view mFilename;
194 int32_t mLineNo = -1;
Definition: SyntaxNode.h:23
const std::string_view & GetString() const
Definition: SyntaxNode.cpp:187
void SetBodyNode(const std::shared_ptr< SyntaxNode > &body)
Definition: SyntaxNode.cpp:147
Id
構文木識別子
Definition: SyntaxNode.h:27
@ IntegerToFloat
整数から実数へ変換
@ Array
variable[argument] =
@ Priority
priority (integer)
@ FloatToInteger
実数から整数へ変換
std::shared_ptr< SyntaxNode > GetBodyNode() const
Definition: SyntaxNode.cpp:142
int_t GetInt() const
Definition: SyntaxNode.cpp:177
float_t GetFloat() const
Definition: SyntaxNode.cpp:182
std::shared_ptr< Symbol > GetSymbol() const
Definition: SyntaxNode.cpp:162
address_t GetMemorySize() const
Definition: SyntaxNode.cpp:69
std::shared_ptr< TypeDescriptor > GetTypeDescriptor() const
Definition: SyntaxNode.cpp:167
std::shared_ptr< SyntaxNode > Cast(const std::shared_ptr< TypeDescriptor > &type, const std::shared_ptr< TypeDescriptorFactory > &typeDescriptorFactory)
Definition: SyntaxNode.cpp:257
void SetLeftNode(const std::shared_ptr< SyntaxNode > &left)
Definition: SyntaxNode.cpp:127
void SetRightNode(const std::shared_ptr< SyntaxNode > &right)
Definition: SyntaxNode.cpp:137
static constexpr size_t IdSize
Definition: SyntaxNode.h:116
std::shared_ptr< SyntaxNode > GetLeftNode() const
Definition: SyntaxNode.cpp:122
std::shared_ptr< SyntaxNode > GetRightNode() const
Definition: SyntaxNode.cpp:132
bool Is(const Id id) const
Definition: SyntaxNode.cpp:54
void Set(const std::shared_ptr< Symbol > &symbol)
Definition: SyntaxNode.cpp:202
bool IsNot(const Id id) const
Definition: SyntaxNode.cpp:59
Id GetId() const
Definition: SyntaxNode.cpp:64
int32_t GetLineno() const
Definition: SyntaxNode.cpp:197
const std::string_view & GetFilename() const
Definition: SyntaxNode.cpp:192
std::shared_ptr< SyntaxNode > Clone() const
Definition: SyntaxNode.cpp:33
IntermediateLanguage GetOpecode() const
std::shared_ptr< SyntaxNode > GetNextNode() const
Definition: SyntaxNode.cpp:152
void SetNextNode(const std::shared_ptr< SyntaxNode > &next)
Definition: SyntaxNode.cpp:157
string body
Definition: Version.py:24
Definition: CodeBuffer.cpp:12
std::uint32_t address_t
Definition: Type.h:31
IntermediateLanguage
Definition: FileFormat.h:80
std::int32_t int_t
Definition: Type.h:29
float float_t
Definition: Type.h:28