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;
|
|
|
|
|
|
2024-07-12 04:53:43 +00:00
|
|
|
|
ExpressionElement::ExpressionElement(std::shared_ptr<const ExprRule> bind) : _expr_rule(bind) {}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2024-07-12 04:53:43 +00:00
|
|
|
|
std::shared_ptr<const ExprRule> ExpressionElement::definedRule() const {
|
2024-06-27 04:55:07 +00:00
|
|
|
|
return _expr_rule;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-20 14:13:06 +00:00
|
|
|
|
QString ExpressionElement::filePath() const {
|
2024-06-27 04:55:07 +00:00
|
|
|
|
if (!tokens_bind.size())
|
|
|
|
|
throw new SyntaxException(u8"InternalError[0x0002]һ<><D2BB><EFBFBD>յķǷ<C4B7><C7B7><EFBFBD>Ч<EFBFBD>ڵ<EFBFBD>");
|
|
|
|
|
|
|
|
|
|
return tokens_bind.first()->file();
|
2024-06-18 03:54:36 +00:00
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2024-06-20 14:13:06 +00:00
|
|
|
|
void ExpressionElement::addToken(std::shared_ptr<const IToken> token_inst) {
|
2024-06-27 04:55:07 +00:00
|
|
|
|
this->tokens_bind.append(token_inst);
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-12 21:52:32 +00:00
|
|
|
|
QList<std::shared_ptr<const IExprInst>> ExpressionElement::children() const {
|
2024-06-27 04:55:07 +00:00
|
|
|
|
return this->children_store;
|
2024-06-18 03:54:36 +00:00
|
|
|
|
}
|
2024-03-17 07:58:28 +00:00
|
|
|
|
|
2024-07-12 21:52:32 +00:00
|
|
|
|
void ExpressionElement::addChild(std::shared_ptr<const IExprInst> inst) {
|
2024-06-27 04:55:07 +00:00
|
|
|
|
this->children_store.append(inst);
|
2024-06-18 03:54:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-20 13:36:46 +00:00
|
|
|
|
QList<std::shared_ptr<const IToken>> ExpressionElement::tokens() const {
|
2024-06-27 04:55:07 +00:00
|
|
|
|
return this->tokens_bind;
|
2024-03-17 07:58:28 +00:00
|
|
|
|
}
|