slash-0725

This commit is contained in:
codeboss 2024-07-25 11:28:03 +08:00
parent 0df0e77df5
commit c277af9c36
1 changed files with 14 additions and 7 deletions

View File

@ -22,6 +22,10 @@ QList<ParseFork> TokenMatch::parse(const ParseFork& context) const
return QList<ParseFork>{result}; return QList<ParseFork>{result};
} }
if (head->content() == u8"SDK·´À­O") {
qDebug() << true;
}
QList<ParseFork> result_list; QList<ParseFork> result_list;
auto match_result = define_peer->analysis(head); auto match_result = define_peer->analysis(head);
if (get<0>(match_result)) { if (get<0>(match_result)) {
@ -34,6 +38,7 @@ QList<ParseFork> TokenMatch::parse(const ParseFork& context) const
else { else {
success_fork.next = head->nextWord(); success_fork.next = head->nextWord();
} }
result_list << success_fork;
} }
else { else {
if (context.occurs != ErrDeals::None) { if (context.occurs != ErrDeals::None) {
@ -121,6 +126,7 @@ QList<ParseFork> Rept::parse(const ParseFork& context) const {
if (!times_remains) if (!times_remains)
return retvs << context; return retvs << context;
auto result_present = rule_peer->token_present();
auto result_forks = rule_peer->parse(context); auto result_forks = rule_peer->parse(context);
for (auto it : result_forks) { for (auto it : result_forks) {
switch (it.occurs) { switch (it.occurs) {
@ -144,6 +150,7 @@ QList<ParseFork> Rept::parse(const ParseFork& context) const {
if (!times_remains) if (!times_remains)
return retvs << context; return retvs << context;
auto result_present = rule_peer->token_present();
auto result_forks = rule_peer->parse(context); auto result_forks = rule_peer->parse(context);
for (auto rst : result_forks) { for (auto rst : result_forks) {
switch (rst.occurs) { switch (rst.occurs) {
@ -172,11 +179,11 @@ QList<ParseFork> Rept::parse(const ParseFork& context) const {
return QList<ErrDeals>{ ErrDeals::None, ErrDeals::Surplus, ErrDeals::Absence, ErrDeals::Replace }.contains(e.occurs); return QList<ErrDeals>{ ErrDeals::None, ErrDeals::Surplus, ErrDeals::Absence, ErrDeals::Replace }.contains(e.occurs);
}); });
if(rst_itor == temp_results.end()) if (rst_itor == temp_results.end())
return temp_results; return temp_results;
decltype(temp_results) result_x2; decltype(temp_results) result_x2;
for(auto xit : temp_results) for (auto xit : temp_results)
result_x2 << max_match_calc(xit, max_match - min_match); result_x2 << max_match_calc(xit, max_match - min_match);
return tidy_results(result_x2); return tidy_results(result_x2);
@ -192,12 +199,12 @@ Seqs::Seqs(const QList<shared_ptr<const IBasicRule>> mbrs) : mbrs_store(mbrs) {}
QList<shared_ptr<const IBasicRule>> Seqs::children() const { return mbrs_store; } QList<shared_ptr<const IBasicRule>> Seqs::children() const { return mbrs_store; }
QList<ParseFork> Seqs::parse(const ParseFork& context) const { QList<ParseFork> Seqs::parse(const ParseFork& context) const {
function<QList<ParseFork>(const ParseFork &, QList<shared_ptr<const IBasicRule>>::const_iterator)> match_seqs = function<QList<ParseFork>(const ParseFork&, QList<shared_ptr<const IBasicRule>>::const_iterator)> match_seqs =
[&](const ParseFork& context, QList<shared_ptr<const IBasicRule>>::const_iterator rule_it) -> QList<ParseFork> { [&](const ParseFork& context, QList<shared_ptr<const IBasicRule>>::const_iterator rule_it) -> QList<ParseFork> {
QList<ParseFork> retvs; QList<ParseFork> retvs;
auto cendx = mbrs_store.cend(); auto cendx = mbrs_store.cend();
if(rule_it == mbrs_store.cend()) if (rule_it == mbrs_store.cend())
return retvs << context; return retvs << context;
auto rule_present = (*rule_it)->token_present(); auto rule_present = (*rule_it)->token_present();
@ -352,4 +359,4 @@ ParseFork::ParseFork(const ParseFork& other)
: occurs(other.occurs), : occurs(other.occurs),
error_messages(other.error_messages), error_messages(other.error_messages),
mbrs_list(other.mbrs_list), mbrs_list(other.mbrs_list),
tokens_list(other.tokens_list) {} tokens_list(other.tokens_list), next(other.next) {}