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;
7mod legacy_codegen;
8
9use proc_macro::TokenStream;
10use syn::{parse_macro_input, DeriveInput};
11
12#[proc_macro_derive(
13    Parse,
14    attributes(head, syntax_class, token, delimiters, delegate, parse_with, pattern)
15)]
16pub fn derive_parse(input: TokenStream) -> TokenStream {
17    let input = parse_macro_input!(input as DeriveInput);
18    codegen::expand(input).unwrap_or_else(|error| error.into_compile_error().into())
19}