WsParser_VS/libSyntax/ast_basic.cpp

36 lines
913 B
C++
Raw Normal View History

2024-03-17 07:58:28 +00:00
#include "ast_basic.h"
2024-06-18 17:09:45 +00:00
#include <QDebug>
2024-03-17 07:58:28 +00:00
using namespace ast_basic;
using namespace lib_token;
using namespace lib_syntax;
2025-02-04 14:26:34 +00:00
ExprInstance::ExprInstance(std::shared_ptr<const ExprRule> bind) : _expr_rule(bind) {}
2024-03-17 07:58:28 +00:00
2025-02-04 14:26:34 +00:00
std::shared_ptr<const ExprRule> ExprInstance::definedRule() const {
return _expr_rule;
2024-03-17 07:58:28 +00:00
}
2025-02-04 14:26:34 +00:00
QString ExprInstance::filePath() const {
if (!tokens_bind.size())
throw new SyntaxException(u8"InternalError[0x0002]һ<><D2BB><EFBFBD>յķǷ<C4B7><C7B7><EFBFBD>Ч<EFBFBD>ڵ<EFBFBD>");
return tokens_bind.first()->file();
}
2024-03-17 07:58:28 +00:00
2025-02-04 14:26:34 +00:00
void ExprInstance::addToken(std::shared_ptr<const IToken> token_inst) {
this->tokens_bind.append(token_inst);
2024-03-17 07:58:28 +00:00
}
2025-02-04 14:26:34 +00:00
QList<std::shared_ptr<const IExprInst>> ExprInstance::children() const {
return this->children_store;
}
2024-03-17 07:58:28 +00:00
2025-02-04 14:26:34 +00:00
void ExprInstance::addChild(std::shared_ptr<const IExprInst> inst) {
this->children_store.append(inst);
}
2025-02-04 14:26:34 +00:00
QList<std::shared_ptr<const IToken>> ExprInstance::tokens() const {
return this->tokens_bind;
2024-03-17 07:58:28 +00:00
}