BehaviorTree / BehaviorTree.CPP

Behavior Trees Library in C++. Batteries included.
https://www.behaviortree.dev
MIT License
3.03k stars 665 forks source link

script compare with negative number exception #832

Open jiezenghuang opened 5 months ago

jiezenghuang commented 5 months ago

version: 4.6.1

example as below:

static const char* xml_text = R"(
 <root BTCPP_format="4">
     <BehaviorTree>
        <Sequence>
            <Script code=" A:=0 " />
            <AlwaysSuccess _failureIf="A!=-1"/>
        </Sequence>
     </BehaviorTree>
 </root>
 )";

int main(int argc, char** argv)
{
    BT::BehaviorTreeFactory factory;

    try
    {
        auto tree = factory.createTreeFromText(xml_text);
        tree.tickWhileRunning();
    }
    catch(const std::exception& e)
    {
        std::cerr << e.what() << '\n';
    }  

    return 0;    
}

output: Error in the script "A!=-1" error: while parsing Grammar::Expression | 1 | A!=-1 | ^ operator cannot be mixed with previous operators