sieve/compiler/grammar/tests/
test_extlists.rs

1/*
2 * SPDX-FileCopyrightText: 2020 Stalwart Labs Ltd <hello@stalw.art>
3 *
4 * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
5 */
6
7
8
9use crate::compiler::grammar::instruction::CompilerState;
10use crate::compiler::CompileError;
11use crate::compiler::Value;
12
13use crate::compiler::grammar::test::Test;
14
15#[derive(Debug, Clone, PartialEq, Eq)]
16#[cfg_attr(
17    any(test, feature = "serde"),
18    derive(serde::Serialize, serde::Deserialize)
19)]
20#[cfg_attr(
21    feature = "rkyv",
22    derive(rkyv::Serialize, rkyv::Deserialize, rkyv::Archive)
23)]
24pub(crate) struct TestValidExtList {
25    pub list_names: Vec<Value>,
26    pub is_not: bool,
27}
28
29impl CompilerState<'_> {
30    pub(crate) fn parse_test_valid_ext_list(&mut self) -> Result<Test, CompileError> {
31        Ok(Test::ValidExtList(TestValidExtList {
32            list_names: self.parse_strings(false)?,
33            is_not: false,
34        }))
35    }
36}