Context接口改进
This commit is contained in:
parent
740e7b0bef
commit
5fea845666
|
@ -41,7 +41,7 @@ std::shared_ptr<const ast_gen::ElementAccess> NovelParser::parse(const QFileInfo
|
|||
this->syntax_defines->parse(context, words);
|
||||
}
|
||||
|
||||
forst_root = context->getDocs();
|
||||
forst_root = context->getDocInsts();
|
||||
auto current_stamp = QTime::currentTime();
|
||||
qDebug().noquote() << QString(u8"%词法解析+语法解析消耗时间:%1 ms。").arg(time_stamp.msecsTo(current_stamp));
|
||||
|
||||
|
|
|
@ -96,15 +96,15 @@ void ExpressionContext::clearErrors(const QString &file_path, int start) {
|
|||
}
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<const IBasicRule>> ExpressionContext::currentExpressionRuleStack() const {
|
||||
QList<std::shared_ptr<const IBasicRule>> ExpressionContext::currentExprRuleStack() const {
|
||||
return rule_stack;
|
||||
}
|
||||
|
||||
|
||||
void ExpressionContext::appendDoc(std::shared_ptr<ast_basic::IExprInst> inst) {
|
||||
void ExpressionContext::appendDocInst(std::shared_ptr<ast_basic::IExprInst> inst) {
|
||||
this->document_store.append(inst);
|
||||
}
|
||||
|
||||
QList<std::shared_ptr<const ast_basic::IExprInst>> ExpressionContext::getDocs() const {
|
||||
QList<std::shared_ptr<const ast_basic::IExprInst>> ExpressionContext::getDocInsts() const {
|
||||
return this->document_store;
|
||||
}
|
|
@ -99,10 +99,10 @@ namespace ast_basic {
|
|||
std::shared_ptr<const lib_syntax::IBasicRule> currentExprRule() const override;
|
||||
void pushExprRule(std::shared_ptr<const lib_syntax::IBasicRule> inst) override;
|
||||
std::shared_ptr<const lib_syntax::IBasicRule> popExprRule() override;
|
||||
virtual QList<std::shared_ptr<const lib_syntax::IBasicRule>> currentExpressionRuleStack() const;
|
||||
virtual QList<std::shared_ptr<const lib_syntax::IBasicRule>> currentExprRuleStack() const;
|
||||
|
||||
virtual void appendDoc(std::shared_ptr<ast_basic::IExprInst> inst) override;
|
||||
virtual QList<std::shared_ptr<const ast_basic::IExprInst>> getDocs() const override;
|
||||
virtual void appendDocInst(std::shared_ptr<ast_basic::IExprInst> inst) override;
|
||||
virtual QList<std::shared_ptr<const ast_basic::IExprInst>> getDocInsts() const override;
|
||||
|
||||
void appendParseErrors(const QString& file_path, int start, const QString& error_msg) override;
|
||||
QStringList errors() const override;
|
||||
|
|
|
@ -228,7 +228,7 @@ ExprRule::parse(std::shared_ptr<IContext> rt_inst, std::shared_ptr<const IWordBa
|
|||
rt_inst->currentExprInst()->addChild(elm_ast);
|
||||
}
|
||||
else {
|
||||
rt_inst->appendDoc(elm_ast);
|
||||
rt_inst->appendDocInst(elm_ast);
|
||||
}
|
||||
}break;
|
||||
default:
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace lib_syntax {
|
|||
virtual QStringList errors() const = 0;
|
||||
virtual void clearErrors(const QString &file_path, int start) = 0;
|
||||
|
||||
virtual void appendDoc(std::shared_ptr<ast_basic::IExprInst> inst) = 0;
|
||||
virtual QList<std::shared_ptr<const ast_basic::IExprInst>> getDocs() const = 0;
|
||||
virtual void appendDocInst(std::shared_ptr<ast_basic::IExprInst> inst) = 0;
|
||||
virtual QList<std::shared_ptr<const ast_basic::IExprInst>> getDocInsts() const = 0;
|
||||
|
||||
/**
|
||||
* \brief µ±Ç°±í´ïÊ½ÔªËØ.
|
||||
|
@ -57,7 +57,7 @@ namespace lib_syntax {
|
|||
virtual std::shared_ptr<const IBasicRule> currentExprRule() const = 0;
|
||||
virtual void pushExprRule(std::shared_ptr<const IBasicRule> inst) = 0;
|
||||
virtual std::shared_ptr<const IBasicRule> popExprRule() = 0;
|
||||
virtual QList<std::shared_ptr<const IBasicRule>> currentExpressionRuleStack() const = 0;
|
||||
virtual QList<std::shared_ptr<const IBasicRule>> currentExprRuleStack() const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue