blob: e04f447ba0ca983c99735d7e7532e5bbfe5871e5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#pragma once
#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>
#include <lexy/dsl.hpp>
#include "ModifierGrammar.hpp"
namespace ovdl::v2script::grammar {
struct AiBehaviorList {
static constexpr auto rule = lexy::dsl::list(lexy::dsl::p<FactorStatement> | lexy::dsl::p<ModifierStatement>);
static constexpr auto value =
lexy::as_list<std::vector<ast::NodePtr>> >>
lexy::callback<ast::NodePtr>(
[](auto&& list) {
return ast::make_node_ptr<ast::BehaviorListNode>(LEXY_MOV(list));
});
};
struct AiBehaviorBlock {
static constexpr auto rule = lexy::dsl::curly_bracketed.opt(lexy::dsl::p<AiBehaviorList>);
static constexpr auto value = lexy::callback<ast::NodePtr>(
[](auto&& list) {
return LEXY_MOV(list);
},
[](lexy::nullopt = {}) {
return lexy::nullopt {};
});
};
}
|