blob: 2b28712e3daf6d746818a1d5ed876bd511d29e37 (
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
|
#pragma once
#include "SimpleGrammar.hpp"
#include "TriggerGrammar.hpp"
#include <lexy/dsl.hpp>
namespace ovdl::v2script::grammar {
constexpr auto modifier_keyword = LEXY_KEYWORD("modifier", lexy::dsl::inline_<Identifier>);
constexpr auto factor_keyword = LEXY_KEYWORD("factor", lexy::dsl::inline_<Identifier>);
struct FactorStatement {
static constexpr auto rule = factor_keyword >> lexy::dsl::equal_sign + lexy::dsl::p<Identifier>;
static constexpr auto value = lexy::forward<ast::NodePtr>;
};
struct ModifierStatement {
static constexpr auto rule =
modifier_keyword >>
lexy::dsl::curly_bracketed.list(
lexy::dsl::p<FactorStatement> |
lexy::dsl::p<TriggerStatement>);
static constexpr auto value =
lexy::as_list<std::vector<ast::NodePtr>> >>
lexy::callback<ast::NodePtr>(
[](auto&& list) {
return make_node_ptr<ast::ModifierNode>(LEXY_MOV(list));
});
};
}
|