File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
include/behaviortree_cpp/scripting Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -806,7 +806,7 @@ struct stmt
806
806
// This is because we can't easily know whether we need to request more input when seeing a
807
807
// newline or not. Once we're having a e.g. parenthesized expression, we know that we need more
808
808
// input until we've reached ), so then change the whitespace rule.
809
- static constexpr auto whitespace = dsl::ascii::blank | escaped_newline;
809
+ static constexpr auto whitespace = dsl::ascii::blank | escaped_newline | dsl::newline ;
810
810
811
811
static constexpr auto rule = [] {
812
812
// We can't use `dsl::eol` as our terminator directly,
Original file line number Diff line number Diff line change @@ -381,3 +381,23 @@ TEST(ParserTest, Issue595)
381
381
ASSERT_EQ (status, BT::NodeStatus::SUCCESS);
382
382
ASSERT_EQ (0 , counters[0 ]);
383
383
}
384
+
385
+ TEST (ParserTest, NewLine)
386
+ {
387
+ BT::BehaviorTreeFactory factory;
388
+
389
+ const std::string xml_text = R"(
390
+ <root BTCPP_format="4" >
391
+ <BehaviorTree ID="Main">
392
+ <Script code="A:=5; B:=6"/>
393
+ </BehaviorTree>
394
+ </root> )" ;
395
+
396
+
397
+ auto tree = factory.createTreeFromText (xml_text);
398
+ const auto status = tree.tickWhileRunning ();
399
+
400
+ ASSERT_EQ (status, BT::NodeStatus::SUCCESS);
401
+ ASSERT_EQ (tree.rootBlackboard ()->get <int >(" A" ), 5 );
402
+ ASSERT_EQ (tree.rootBlackboard ()->get <int >(" B" ), 6 );
403
+ }
You can’t perform that action at this time.
0 commit comments