Skip to main content

malt_index/
config.rs

1//! Parser configuration: where the docstring of a declaration may sit, and whether
2//! live scripts on the path are read.
3
4use serde::{Deserialize, Serialize};
5
6/// Which comment block belongs to a declaration, and what the path holds.
7///
8/// By default (`false`) a comment block after a property, argument or enumeration
9/// documents the declaration before it, as maxx does. With `true` the block before
10/// the declaration documents it.
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
12#[serde(default)]
13pub struct ParserConfig {
14    /// Comment blocks before a property document that property (default: after).
15    pub docstring_before_properties: bool,
16    /// Comment blocks before an argument document that argument (default: after).
17    pub docstring_before_arguments: bool,
18    /// Comment blocks before an enumeration member document that member (default: after).
19    pub docstring_before_enumerations: bool,
20    /// Whether `.mlx` files on the path are live scripts (default: no, as maxx).
21    /// Plain-text live code is never picked up from its `.m` file: it is read with
22    /// [`crate::parse_live_text_file`] when the caller knows it is one.
23    pub parse_live_scripts: bool,
24}