36 lines
913 B
C++
36 lines
913 B
C++
#include "ast_basic.h"
|
|
#include <QDebug>
|
|
|
|
using namespace ast_basic;
|
|
using namespace lib_token;
|
|
using namespace lib_syntax;
|
|
|
|
ExprInstance::ExprInstance(std::shared_ptr<const ExprRule> bind) : _expr_rule(bind) {}
|
|
|
|
std::shared_ptr<const ExprRule> ExprInstance::definedRule() const {
|
|
return _expr_rule;
|
|
}
|
|
|
|
QString ExprInstance::filePath() const {
|
|
if (!tokens_bind.size())
|
|
throw new SyntaxException(u8"InternalError[0x0002]Ò»¸ö¿ÕµÄ·Ç·¨ÎÞЧ½Úµã");
|
|
|
|
return tokens_bind.first()->file();
|
|
}
|
|
|
|
void ExprInstance::addToken(std::shared_ptr<const IToken> token_inst) {
|
|
this->tokens_bind.append(token_inst);
|
|
}
|
|
|
|
QList<std::shared_ptr<const IExprInst>> ExprInstance::children() const {
|
|
return this->children_store;
|
|
}
|
|
|
|
void ExprInstance::addChild(std::shared_ptr<const IExprInst> inst) {
|
|
this->children_store.append(inst);
|
|
}
|
|
|
|
QList<std::shared_ptr<const IToken>> ExprInstance::tokens() const {
|
|
return this->tokens_bind;
|
|
}
|