From 35b16e545b4fce299edbc00c9a9754179fa51634 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 17 Dec 2022 16:24:29 +0100 Subject: Document parameters in comment --- src/model/cast.rs | 2 +- src/model/eval.rs | 2 +- src/model/func.rs | 17 +++++++++++++---- src/model/library.rs | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src/model') diff --git a/src/model/cast.rs b/src/model/cast.rs index 833b9e9e..5c95fe4b 100644 --- a/src/model/cast.rs +++ b/src/model/cast.rs @@ -33,7 +33,7 @@ pub trait Cast: Sized { } /// Describes a possible value for a cast. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Hash)] pub enum CastInfo { /// Any value is okay. Any, diff --git a/src/model/eval.rs b/src/model/eval.rs index d54acf0a..a9fa2e14 100644 --- a/src/model/eval.rs +++ b/src/model/eval.rs @@ -411,7 +411,7 @@ impl Eval for ast::Math { self.children() .map(|node| node.eval(vm)) .collect::>()?, - self.display(), + self.block(), )) } } diff --git a/src/model/func.rs b/src/model/func.rs index 5b38b700..46befd77 100644 --- a/src/model/func.rs +++ b/src/model/func.rs @@ -232,12 +232,21 @@ pub struct ParamInfo { pub name: &'static str, /// Documentation for the parameter. pub docs: &'static str, - /// Is the parameter settable with a set rule? - pub settable: bool, - /// Can the name be omitted? - pub shorthand: bool, /// Valid values for the parameter. pub cast: CastInfo, + /// Is the parameter positional? + pub positional: bool, + /// Is the parameter named? + /// + /// Can be true even if `positional` is true if the parameter can be given + /// in both variants. + pub named: bool, + /// Is the parameter required? + pub required: bool, + /// Can the parameter be given any number of times? + pub variadic: bool, + /// Is the parameter settable with a set rule? + pub settable: bool, } /// A user-defined closure. diff --git a/src/model/library.rs b/src/model/library.rs index 02eb9179..83310610 100644 --- a/src/model/library.rs +++ b/src/model/library.rs @@ -66,7 +66,7 @@ pub struct LangItems { /// An item in a description list: `/ Term: Details`. pub desc_item: fn(term: Content, body: Content) -> Content, /// A mathematical formula: `$x$`, `$ x^2 $`. - pub math: fn(children: Vec, display: bool) -> Content, + pub math: fn(children: Vec, block: bool) -> Content, /// An atom in a formula: `x`, `+`, `12`. pub math_atom: fn(atom: EcoString) -> Content, /// A base with optional sub- and superscripts in a formula: `a_1^2`. @@ -75,7 +75,7 @@ pub struct LangItems { /// A fraction in a formula: `x/2`. pub math_frac: fn(num: Content, denom: Content) -> Content, /// An alignment point in a formula: `&`, `&&`. - pub math_align_point: fn(count: usize) -> Content, + pub math_align_point: fn(count: NonZeroUsize) -> Content, } impl Debug for LangItems { -- cgit v1.2.3