Skip to content

Commit 40d535d

Browse files
Aglargilwangzheng
and
wangzheng
authored
fix script parse error while 'A==-1' (#896)
Co-authored-by: wangzheng <[email protected]>
1 parent f5e98fd commit 40d535d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

examples/t09_scripting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ static const char* xml_text = R"(
1010
<Sequence>
1111
<Script code=" msg:='hello world' " />
1212
<Script code=" A:=THE_ANSWER; B:=3.14; color:=RED " />
13-
<Precondition if="A>B && color != BLUE" else="FAILURE">
13+
<Precondition if="A>-B && color != BLUE" else="FAILURE">
1414
<Sequence>
1515
<SaySomething message="{A}"/>
1616
<SaySomething message="{B}"/>

include/behaviortree_cpp/scripting/operators.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,9 @@ struct Expression : lexy::expression_production
796796
dsl::op<Ast::ExprComparison::greater_equal>(LEXY_LIT(">"
797797
"="));
798798

799-
// The use of dsl::groups ensures that an expression can either contain math or bit
799+
// The use of dsl::groups ensures that an expression can either contain math or bit or string
800800
// operators. Mixing requires parenthesis.
801-
using operand = dsl::groups<math_sum, bit_or>;
801+
using operand = dsl::groups<math_sum, bit_or, string_concat>;
802802
};
803803

804804
// Logical operators, || and &&
@@ -808,7 +808,7 @@ struct Expression : lexy::expression_production
808808
dsl::op<Ast::ExprBinaryArithmetic::logic_or>(LEXY_LIT("||")) /
809809
dsl::op<Ast::ExprBinaryArithmetic::logic_and>(LEXY_LIT("&&"));
810810

811-
using operand = dsl::groups<string_concat, comparison>;
811+
using operand = comparison;
812812
};
813813

814814
// x ? y : z

0 commit comments

Comments
 (0)