vihaco_parser_derive/lib.rs
1// SPDX-FileCopyrightText: 2026 The vihaco Authors
2// SPDX-License-Identifier: MIT
3
4extern crate proc_macro;
5mod attr;
6mod codegen;
7
8use proc_macro::TokenStream;
9use syn::{parse_macro_input, DeriveInput};
10
11#[proc_macro_derive(Parse, attributes(syntax_class, pattern))]
12pub fn derive_parse(input: TokenStream) -> TokenStream {
13 let input = parse_macro_input!(input as DeriveInput);
14 codegen::expand(input).unwrap_or_else(|error| error.into_compile_error().into())
15}