diff --git a/libSyntax/libsyntax.cpp b/libSyntax/libsyntax.cpp index 6d97856..7c6b4c0 100644 --- a/libSyntax/libsyntax.cpp +++ b/libSyntax/libsyntax.cpp @@ -22,6 +22,10 @@ QList TokenMatch::parse(const ParseFork& context) const return QList{result}; } + if (head->content() == u8"SDK·´À­’O") { + qDebug() << true; + } + QList result_list; auto match_result = define_peer->analysis(head); if (get<0>(match_result)) { @@ -34,6 +38,7 @@ QList 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 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 Rept::parse(const ParseFork& context) const { return retvs; }; - + std::function(const ParseFork&, int)> max_match_calc = [&](const ParseFork& context, int times_remains) -> QList { QList retvs; @@ -144,6 +150,7 @@ QList 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 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::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> mbrs) : mbrs_store(mbrs) {} QList> Seqs::children() const { return mbrs_store; } QList Seqs::parse(const ParseFork& context) const { - function(const ParseFork &, QList>::const_iterator)> match_seqs = + function(const ParseFork&, QList>::const_iterator)> match_seqs = [&](const ParseFork& context, QList>::const_iterator rule_it) -> QList { QList 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) {}