代码拉取完成,页面将自动刷新
同步操作将从 RonxBulld/ftrpc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//
// Created by Rexfield on 2018/5/3.
//
#include <exception>
#include "symman.h"
TokenManage::TokenManage(std::initializer_list<std::pair<std::string, TokenID>> initToken) {
for(const auto & [literal,id] : initToken) {
this->i2s.insert(std::make_pair(id, literal));
this->s2i.insert(std::make_pair(literal, id));
this->indexReg = id >= this->indexReg ? id + 1 : this->indexReg;
}
}
TokenID TokenManage::operator[](const std::string &Token) {
if (this->s2i.find(Token) != this->s2i.end()) {
return this->s2i[Token];
}
TokenID i = this->indexReg++;
this->s2i.insert(std::make_pair(Token, i));
this->i2s.insert(std::make_pair(i, Token));
return i;
}
const std::string &TokenManage::operator[](const TokenID &ID) {
if (this->i2s.find(ID) != this->i2s.end()) {
return this->i2s[ID];
}
}
TypeManage::TypeManage(std::initializer_list<std::pair<TypeID, TokenID>> initBaseType) {
for(auto member : initBaseType) {
this->tk2ty.insert(std::make_pair(member.second, member.first));
this->ty2tk.insert(std::make_pair(member.first, member.second));
this->indexReg = member.first >= this->indexReg ? member.first + 1 : this->indexReg;
}
}
TypeID TypeManage::getTypeID(TokenID Name) {
if (this->tk2ty.find(Name) == this->tk2ty.end()) {
throw std::runtime_error("Referenced an undefined type.");
}
return this->tk2ty[Name];
}
void TypeManage::registType(TokenID Name, enum typeDefType DeclareType, MemberLists &MemberList) {
if (this->tk2ty.find(Name) != this->tk2ty.end()) {
throw std::runtime_error("Redefine the type.");
}
TypeID i = this->indexReg++;
this->tk2ty.insert(std::make_pair(Name, i));
this->ty2tk.insert(std::make_pair(i, Name));
switch (DeclareType)
{
case typeDefType::DeclareStruct: {
this->StructsMap[i] = MemberList;
break;
}
case typeDefType::DeclareBase: {
// If *MemberList is nullptr, it means that the underlying type is being defined.
// No extra work needs to be done.
break;
}
default:
throw std::runtime_error("DeclareType was set to an inappropriate value.");
}
}
bool TypeManage::isType(TokenID Name) {
return this->tk2ty.find(Name) != this->tk2ty.end();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。