Python异步报错总在‘跑完之后’?揭秘AgentScope与pydantic-ai的时序陷阱
2026/11/2 20:19:14
https://github.com/r35382/bnflite
#include "bnflite/bnflite.h" #include <iostream> typedef bnf::Interface<double> Calc; /* pass number result */ Calc DoNumber(std::vector<Calc>& res) { char* lst; double value = strtod(res[0].text, &lst); // formaly it is not correct for not 0-terminated strings Calc ret(value, res); if (lst - res[0].text - ret.length != 0) { std::cout << "number parse error:"; std::cout.write(ret.text, ret.length); } return ret; } int main_bnflite(int argc, char* argv[]) { //int argc1 = 3; //char* argv1[3] = { "sjijasd", "测试", "。,.,,.." }; //main_prettyprint(argc1, argv1); bnf::Token token('0', '9'); bnf::Lexem number = 6 * token; bnf::Rule positiveNum = !bnf::Token('-') | number; bnf::Bind(positiveNum, DoNumber); const char* tail = 0; typedef bnf::Interface<double> Calc; Calc result; std::string clc("123456"); int tst = bnf::Analyze(positiveNum, clc.c_str(), &tail, result); if (tst > 0) std::cout << "Result of " << clc << " = " << result.data << std::endl; else std::cout << "Parsing errors detected, status = " << std::hex << tst << std::endl << "stopped at: " << tail << std::endl; return 0; }