Skip to content

script compare with negative number exception #832

Open
@jiezenghuang

Description

@jiezenghuang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions