vihaco-parser 0.1.1

Derive macro (#[derive(Parse)]) that generates chumsky parsers for vihaco syntax types.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// SPDX-FileCopyrightText: 2026 The vihaco Authors
// SPDX-License-Identifier: MIT

extern crate proc_macro;
mod attr;
mod codegen;

use proc_macro::TokenStream;
use syn::{parse_macro_input, DeriveInput};

#[proc_macro_derive(Parse, attributes(head, token, delimiters, delegate, parse_with))]
pub fn derive_parse(input: TokenStream) -> TokenStream {
    let input = parse_macro_input!(input as DeriveInput);
    codegen::expand(input).unwrap_or_else(|e| e.to_compile_error().into())
}