Skip to main content

vihaco_parser/
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(head, token, delimiters, delegate, parse_with))]
12pub fn derive_parse(input: TokenStream) -> TokenStream {
13    let input = parse_macro_input!(input as DeriveInput);
14    codegen::expand(input).unwrap_or_else(|e| e.to_compile_error().into())
15}