Skip to main content

aranya_policy_text_macro/
lib.rs

1//! A set of proc macros used for policy lang text and identifier literals.
2//!
3//! Do not use this crate directly. Use the macros from `aranya-policy-text`
4//! or a re-export from e.g. `aranya-policy-ast` or `aranya-policy-vm`.
5
6use proc_macro::TokenStream;
7use syn::Error;
8
9mod imp;
10
11#[proc_macro]
12pub fn validate_text(item: TokenStream) -> TokenStream {
13    imp::validate_text(item.into())
14        .unwrap_or_else(Error::into_compile_error)
15        .into()
16}
17
18#[proc_macro]
19pub fn validate_identifier(item: TokenStream) -> TokenStream {
20    imp::validate_identifier(item.into())
21        .unwrap_or_else(Error::into_compile_error)
22        .into()
23}