blob: a772a7c81314498e08ea061d473ac89f0de248b0 (
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 "ModifierGrammar.hpp"
#include "SimpleGrammar.hpp"
#include "TriggerGrammar.hpp"
#include <lexy/dsl.hpp>
#include <openvic-dataloader/v2script/AbstractSyntaxTree.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 nullptr;
});
};
}
|