microcad_lang/parse/module.rs
1// Copyright © 2025 The µcad authors <info@ucad.xyz>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4use crate::{parse::*, parser::*, rc::*, syntax::*};
5
6impl Parse for Rc<ModuleDefinition> {
7 fn parse(pair: Pair) -> ParseResult<Self> {
8 Ok(Rc::new(ModuleDefinition {
9 visibility: crate::find_rule!(pair, visibility)?,
10 id: crate::find_rule!(pair, identifier)?,
11 body: crate::find_rule!(pair, body)?,
12 src_ref: pair.clone().into(),
13 }))
14 }
15}