From 4dd05d46eb8a8ca0330ea2364a9dde6f2b4c22df Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Mon, 14 Oct 2024 17:12:31 -0700 Subject: [PATCH] feat: stream toggle keyword (#167) --- ecsact/detail/grammar.hh | 8 +++++++- test/MODULE.bazel | 5 +++++ test/parse_test_system_component_statement.cc | 9 +++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ecsact/detail/grammar.hh b/ecsact/detail/grammar.hh index c20df41..f35085a 100644 --- a/ecsact/detail/grammar.hh +++ b/ecsact/detail/grammar.hh @@ -645,6 +645,11 @@ struct system_component_statement { static constexpr auto value = lexy::constant(ECSACT_SYS_CAP_REMOVES); }; + struct stream_toggle_keyword : lexy::token_production { + static constexpr auto rule = LEXY_LIT("stream_toggle"); + static constexpr auto value = lexy::constant(ECSACT_SYS_CAP_STREAM_TOGGLE); + }; + struct filter { static constexpr auto rule = lexy::dsl::p | lexy::dsl::p; @@ -695,7 +700,8 @@ struct system_component_statement { }; static constexpr auto capability = lexy::dsl::p | - lexy::dsl::p | lexy::dsl::p; + lexy::dsl::p | lexy::dsl::p | + lexy::dsl::p; static constexpr auto rule = capability >> lexy::dsl::p >> lexy::dsl::opt(lexy::dsl::p >> lexy::dsl::p); diff --git a/test/MODULE.bazel b/test/MODULE.bazel index 225b4d7..bd2f9b7 100644 --- a/test/MODULE.bazel +++ b/test/MODULE.bazel @@ -26,3 +26,8 @@ register_toolchains( "@llvm_toolchain//:all", dev_dependency = True, ) + +local_path_override( + module_name = "ecsact_runtime", + path = "../../ecsact_runtime", +) diff --git a/test/parse_test_system_component_statement.cc b/test/parse_test_system_component_statement.cc index 8ecad58..8707b44 100644 --- a/test/parse_test_system_component_statement.cc +++ b/test/parse_test_system_component_statement.cc @@ -165,6 +165,15 @@ TEST(Parse, RemovesSystemComponent) { ); } +TEST(Parse, StreamToggleSystemComponent) { + TestValidSystemComponent( + "stream_toggle ExampleComponent;"s, + ECSACT_SYS_CAP_STREAM_TOGGLE, + "ExampleComponent", + empty_list + ); +} + /////////////////////////////////// // 'with' keyword // ///////////////////////////////////