Mana
mana::SemanticAnalyzer Class Reference

#include <SemanticAnalyzer.h>

Inheritance diagram for mana::SemanticAnalyzer:
mana::Noncopyable mana::GlobalSemanticAnalyzer mana::LocalSemanticAnalyzer

Public Member Functions

 SemanticAnalyzer (const std::shared_ptr< SymbolFactory > &symbolFactory, const std::shared_ptr< TypeDescriptorFactory > &typeDescriptorFactory)
 
virtual ~SemanticAnalyzer ()=default
 
void SetCurrentFileInformation (const std::shared_ptr< SyntaxNode > &node)
 
bool SearchSymbolFromName (const std::shared_ptr< SyntaxNode > &node)
 
void ResolveTypeDescription (const std::shared_ptr< SyntaxNode > &node)
 
std::shared_ptr< TypeDescriptorResolveVariableSize (const std::shared_ptr< SyntaxNode > &node)
 
void ResolveDeclarator (const std::shared_ptr< SyntaxNode > &node, const bool isStaticVariable)
 
void ResolveVariableDescription (const std::shared_ptr< SyntaxNode > &node, const Symbol::MemoryTypeId memoryTypeId, const bool isStaticVariable)
 
void ResolveTypeFromChildNode (const std::shared_ptr< SyntaxNode > &node) const
 

Protected Member Functions

std::shared_ptr< SymbolLookup (const std::string_view name) const
 
const std::shared_ptr< SymbolFactory > & GetSymbolFactory ()
 
const std::shared_ptr< TypeDescriptorFactory > & GetTypeDescriptorFactory ()
 

Constructor & Destructor Documentation

◆ SemanticAnalyzer()

mana::SemanticAnalyzer::SemanticAnalyzer ( const std::shared_ptr< SymbolFactory > &  symbolFactory,
const std::shared_ptr< TypeDescriptorFactory > &  typeDescriptorFactory 
)
explicit

◆ ~SemanticAnalyzer()

virtual mana::SemanticAnalyzer::~SemanticAnalyzer ( )
virtualdefault

Member Function Documentation

◆ GetSymbolFactory()

const std::shared_ptr< SymbolFactory > & mana::SemanticAnalyzer::GetSymbolFactory ( )
protected

◆ GetTypeDescriptorFactory()

const std::shared_ptr< TypeDescriptorFactory > & mana::SemanticAnalyzer::GetTypeDescriptorFactory ( )
protected

◆ Lookup()

std::shared_ptr< Symbol > mana::SemanticAnalyzer::Lookup ( const std::string_view  name) const
protected

◆ ResolveDeclarator()

void mana::SemanticAnalyzer::ResolveDeclarator ( const std::shared_ptr< SyntaxNode > &  node,
const bool  isStaticVariable 
)

Symbol::CreateVariableを呼び出し Symbolをnewしてnodeに設定します

Parameters
[in]nodeDeclaratorノード
[in]isStaticVariable静的変数

◆ ResolveTypeDescription()

void mana::SemanticAnalyzer::ResolveTypeDescription ( const std::shared_ptr< SyntaxNode > &  node)

nodeに登録されたtypeが無ければシンボルを検索してそのtypeをnodeに設定します

Parameters
[in]nodeTypeDescriptionノード

◆ ResolveTypeFromChildNode()

void mana::SemanticAnalyzer::ResolveTypeFromChildNode ( const std::shared_ptr< SyntaxNode > &  node) const

子ノードから型を継承する

Parameters
[in]nodeノード

◆ ResolveVariableDescription()

void mana::SemanticAnalyzer::ResolveVariableDescription ( const std::shared_ptr< SyntaxNode > &  node,
const Symbol::MemoryTypeId  memoryTypeId,
const bool  isStaticVariable 
)

両辺のTypeDescriptionとDeclaratorを解決して SymbolFactory::AllocateMemoryを使ってメモリを割り当てます

Parameters
[in]nodeDeclareVariableノード
[in]memoryTypeIdメモリタイプ
[in]isStaticVariable静的変数

◆ ResolveVariableSize()

std::shared_ptr< TypeDescriptor > mana::SemanticAnalyzer::ResolveVariableSize ( const std::shared_ptr< SyntaxNode > &  node)

type_create_arrayを使って配列の型をnewします

Parameters
[in]nodeVariableSizeノード
Returns
配列type_description

◆ SearchSymbolFromName()

bool mana::SemanticAnalyzer::SearchSymbolFromName ( const std::shared_ptr< SyntaxNode > &  node)

Lookupを呼び出しSymbolを検索してNodeに設定します

Parameters
nodeIdentifierノード

◆ SetCurrentFileInformation()

void mana::SemanticAnalyzer::SetCurrentFileInformation ( const std::shared_ptr< SyntaxNode > &  node)

The documentation for this class was generated from the following files: