slash-0725
This commit is contained in:
parent
0df0e77df5
commit
c277af9c36
|
@ -22,6 +22,10 @@ QList<ParseFork> TokenMatch::parse(const ParseFork& context) const
|
|||
return QList<ParseFork>{result};
|
||||
}
|
||||
|
||||
if (head->content() == u8"SDK·´À’O") {
|
||||
qDebug() << true;
|
||||
}
|
||||
|
||||
QList<ParseFork> result_list;
|
||||
auto match_result = define_peer->analysis(head);
|
||||
if (get<0>(match_result)) {
|
||||
|
@ -34,6 +38,7 @@ QList<ParseFork> TokenMatch::parse(const ParseFork& context) const
|
|||
else {
|
||||
success_fork.next = head->nextWord();
|
||||
}
|
||||
result_list << success_fork;
|
||||
}
|
||||
else {
|
||||
if (context.occurs != ErrDeals::None) {
|
||||
|
@ -121,6 +126,7 @@ QList<ParseFork> Rept::parse(const ParseFork& context) const {
|
|||
if (!times_remains)
|
||||
return retvs << context;
|
||||
|
||||
auto result_present = rule_peer->token_present();
|
||||
auto result_forks = rule_peer->parse(context);
|
||||
for (auto it : result_forks) {
|
||||
switch (it.occurs) {
|
||||
|
@ -136,7 +142,7 @@ QList<ParseFork> Rept::parse(const ParseFork& context) const {
|
|||
|
||||
return retvs;
|
||||
};
|
||||
|
||||
|
||||
std::function<QList<ParseFork>(const ParseFork&, int)> max_match_calc =
|
||||
[&](const ParseFork& context, int times_remains) -> QList<ParseFork> {
|
||||
QList<ParseFork> retvs;
|
||||
|
@ -144,6 +150,7 @@ QList<ParseFork> Rept::parse(const ParseFork& context) const {
|
|||
if (!times_remains)
|
||||
return retvs << context;
|
||||
|
||||
auto result_present = rule_peer->token_present();
|
||||
auto result_forks = rule_peer->parse(context);
|
||||
for (auto rst : result_forks) {
|
||||
switch (rst.occurs) {
|
||||
|
@ -166,17 +173,17 @@ QList<ParseFork> Rept::parse(const ParseFork& context) const {
|
|||
return retvs;;
|
||||
};
|
||||
|
||||
|
||||
|
||||
auto temp_results = min_match_calc(context, min_match);
|
||||
auto rst_itor = std::find_if(temp_results.begin(), temp_results.end(), [](ParseFork e) -> bool {
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
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<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> {
|
||||
QList<ParseFork> retvs;
|
||||
|
||||
auto cendx = mbrs_store.cend();
|
||||
if(rule_it == mbrs_store.cend())
|
||||
if (rule_it == mbrs_store.cend())
|
||||
return retvs << context;
|
||||
|
||||
auto rule_present = (*rule_it)->token_present();
|
||||
|
@ -352,4 +359,4 @@ ParseFork::ParseFork(const ParseFork& other)
|
|||
: occurs(other.occurs),
|
||||
error_messages(other.error_messages),
|
||||
mbrs_list(other.mbrs_list),
|
||||
tokens_list(other.tokens_list) {}
|
||||
tokens_list(other.tokens_list), next(other.next) {}
|
||||
|
|
Loading…
Reference in New Issue