本文整理汇总了C++中TClass::AnalyzeSyntax方法的典型用法代码示例。如果您正苦于以下问题:C++ TClass::AnalyzeSyntax方法的具体用法?C++ TClass::AnalyzeSyntax怎么用?C++ TClass::AnalyzeSyntax使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TClass
的用法示例。
在下文中一共展示了TClass::AnalyzeSyntax方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegisterEnum
TSClass* RegisterEnum(TClassRegistryParams& params, const char* source)
{
auto syntax = params.syntax;
TClass* cl = new TClass(syntax->base_class.get());
syntax->base_class->AddNested(cl);
syntax->lexer.ParseSource(source);
cl->AnalyzeSyntax(syntax->lexer);
syntax->lexer.GetToken(TTokenType::Done);
TSClass* scl = new TSClass(syntax->sem_base_class.get(), cl);
syntax->sem_base_class->AddClass(scl);
scl->Build();
std::vector<TSClassField*> static_fields;
std::vector<TSLocalVar*> static_variables;
TGlobalBuildContext global_build_context(&static_fields, &static_variables);
scl->LinkSignature(global_build_context);
scl->InitAutoMethods();
scl->LinkBody(global_build_context);
scl->CheckForErrors();
std::vector<TSClass*> owners;
scl->CalculateSizes(owners);
scl->CalculateMethodsSizes();
owners.clear();
syntax->sem_base_class->CalculateSizes(owners);//т.к. в этом классе могут использоваться другие шаблонные класса, реализацию которых нужно обновить
InitializeStaticClassFields(static_fields, *params.static_objects);
InitializeStaticVariables(static_variables, *params.static_objects);
return scl;
}
示例2: DeclareExternClass
void DeclareExternClass(TClassRegistryParams& params, TClassBinding* binding)
{
std::string source = BuildExternClassSource(binding->class_name, binding->methods);
auto& syntax = params.syntax;
TClass* cl = new TClass(syntax->base_class.get());
syntax->base_class->AddNested(cl);
syntax->lexer.ParseSource(source.c_str());
cl->AnalyzeSyntax(syntax->lexer);
syntax->lexer.GetToken(TTokenType::Done);
binding->compiled = new TSClass(syntax->sem_base_class.get(), cl);
syntax->sem_base_class->AddClass(binding->compiled);
binding->compiled->Build();
binding->compiled->SetSize(LexerIntSizeOf(binding->size) / sizeof(int));
//binding->compiled->SetAutoMethodsInitialized();
}