Skip to content

Commit

Permalink
feat: stream toggle keyword (with tests)
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Sep 18, 2024
1 parent f4531dd commit a697167
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ register_toolchains(
"@llvm_toolchain//:all",
dev_dependency = True,
)

local_path_override(
module_name = "ecsact_runtime",
path = "../ecsact_runtime",
)
3 changes: 2 additions & 1 deletion ecsact/detail/grammar.hh
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,8 @@ struct system_component_statement {
};

static constexpr auto capability = lexy::dsl::p<filter> |
lexy::dsl::p<access> | lexy::dsl::p<assignment>;
lexy::dsl::p<access> | lexy::dsl::p<assignment> |
lexy::dsl::p<stream_toggle_keyword>;

static constexpr auto rule = capability >> lexy::dsl::p<type_name> >>
lexy::dsl::opt(lexy::dsl::p<with_keyword> >> lexy::dsl::p<with_fields>);
Expand Down
5 changes: 5 additions & 0 deletions test/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ register_toolchains(
"@llvm_toolchain//:all",
dev_dependency = True,
)

local_path_override(
module_name = "ecsact_runtime",
path = "../../ecsact_runtime",
)
9 changes: 9 additions & 0 deletions test/parse_test_system_component_statement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 //
///////////////////////////////////
Expand Down

0 comments on commit a697167

Please sign in to comment.