summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-17 16:24:29 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-17 16:24:29 +0100
commit35b16e545b4fce299edbc00c9a9754179fa51634 (patch)
treeeb1081e55187e59ff6482abc1ac2f1932606ef59 /src/model
parentb6202b646a0d5ecced301d9bac8bfcaf977d7ee4 (diff)
Document parameters in comment
Diffstat (limited to 'src/model')
-rw-r--r--src/model/cast.rs2
-rw-r--r--src/model/eval.rs2
-rw-r--r--src/model/func.rs17
-rw-r--r--src/model/library.rs4
4 files changed, 17 insertions, 8 deletions
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<V = Value>: 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::<SourceResult<_>>()?,
- 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<Content>, display: bool) -> Content,
+ pub math: fn(children: Vec<Content>, 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 {