aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/v2script/AiBehaviorGrammar.hpp
blob: 30f535aac8e818fec0dd120652823e00756a613a (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
#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 AiModifierStatement {
      static constexpr auto rule =
         modifier_keyword >>
         (lexy::dsl::equal_sign +
            lexy::dsl::curly_bracketed.list(
               (factor_keyword >> lexy::dsl::p<Identifier>) |
               lexy::dsl::p<TriggerStatement>));
   };

   struct AiBehaviorList {
      static constexpr auto rule = lexy::dsl::list((factor_keyword >> lexy::dsl::p<Identifier>) | lexy::dsl::p<AiModifierStatement>);
   };
}