aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/v2script/TriggerGrammar.hpp
blob: 095d11526f951674040fcd76ea61ace8df9d7e24 (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
#pragma once

#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>

#include <lexy/callback.hpp>
#include <lexy/dsl.hpp>

#include "SimpleGrammar.hpp"
#include "detail/dsl.hpp"

namespace ovdl::v2script::grammar {
   struct TriggerStatement {
      static constexpr auto rule = lexy::dsl::p<SAssignStatement<StringEscapeOption>>;

      static constexpr auto value = lexy::forward<ast::AssignStatement*>;
   };

   struct TriggerList {
      static constexpr auto rule = lexy::dsl::list(lexy::dsl::p<TriggerStatement>);

      static constexpr auto value = lexy::as_list<ast::AssignStatementList>;
   };

   struct TriggerBlock {
      static constexpr auto rule = dsl::curly_bracketed.opt(lexy::dsl::p<TriggerList>);

      static constexpr auto value = construct_list<ast::ListValue>;
   };
}