Skip to main content

melior_macro/parse/
dialect_operation_set.rs

1use super::IdentifierList;
2use proc_macro2::Ident;
3use syn::{
4    bracketed,
5    parse::{Parse, ParseStream},
6    Result, Token,
7};
8
9pub struct DialectOperationSet {
10    dialect: Ident,
11    identifiers: IdentifierList,
12}
13
14impl DialectOperationSet {
15    pub const fn dialect(&self) -> &Ident {
16        &self.dialect
17    }
18
19    pub fn identifiers(&self) -> &[Ident] {
20        self.identifiers.identifiers()
21    }
22}
23
24impl Parse for DialectOperationSet {
25    fn parse(input: ParseStream) -> Result<Self> {
26        let dialect = Ident::parse(input)?;
27        <Token![,]>::parse(input)?;
28
29        Ok(Self {
30            dialect,
31            identifiers: {
32                let content;
33                bracketed!(content in input);
34                content.parse::<IdentifierList>()?
35            },
36        })
37    }
38}