diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/eval/library.rs | 14 | ||||
| -rw-r--r-- | src/eval/mod.rs | 6 | ||||
| -rw-r--r-- | src/eval/scope.rs | 2 | ||||
| -rw-r--r-- | src/ide/complete.rs | 12 | ||||
| -rw-r--r-- | src/ide/highlight.rs | 6 | ||||
| -rw-r--r-- | src/syntax/ast.rs | 40 | ||||
| -rw-r--r-- | src/syntax/kind.rs | 14 | ||||
| -rw-r--r-- | src/syntax/parser.rs | 8 |
8 files changed, 51 insertions, 51 deletions
diff --git a/src/eval/library.rs b/src/eval/library.rs index 0e0b38aa..485a766b 100644 --- a/src/eval/library.rs +++ b/src/eval/library.rs @@ -77,18 +77,18 @@ pub struct LangItems { pub enum_item: fn(number: Option<NonZeroUsize>, body: Content) -> Content, /// An item in a term list: `/ Term: Details`. pub term_item: fn(term: Content, description: Content) -> Content, - /// A mathematical formula: `$x$`, `$ x^2 $`. - pub formula: fn(body: Content, block: bool) -> Content, - /// An alignment point in a formula: `&`. + /// A mathematical equation: `$x$`, `$ x^2 $`. + pub equation: fn(body: Content, block: bool) -> Content, + /// An alignment point in math: `&`. pub math_align_point: fn() -> Content, - /// Matched delimiters surrounding math in a formula: `[x + y]`. + /// Matched delimiters in math: `[x + y]`. pub math_delimited: fn(open: Content, body: Content, close: Content) -> Content, - /// A base with optional attachments in a formula: `a_1^2`. + /// A base with optional attachments in math: `a_1^2`. pub math_attach: fn(base: Content, bottom: Option<Content>, top: Option<Content>) -> Content, /// A base with an accent: `arrow(x)`. pub math_accent: fn(base: Content, accent: char) -> Content, - /// A fraction in a formula: `x/2`. + /// A fraction in math: `x/2`. pub math_frac: fn(num: Content, denom: Content) -> Content, /// Dispatch a method on a library value. pub library_method: fn( @@ -126,7 +126,7 @@ impl Hash for LangItems { self.list_item.hash(state); self.enum_item.hash(state); self.term_item.hash(state); - self.formula.hash(state); + self.equation.hash(state); self.math_align_point.hash(state); self.math_delimited.hash(state); self.math_attach.hash(state); diff --git a/src/eval/mod.rs b/src/eval/mod.rs index 27ed85e5..74c5f0b3 100644 --- a/src/eval/mod.rs +++ b/src/eval/mod.rs @@ -426,7 +426,7 @@ impl Eval for ast::Expr { Self::List(v) => v.eval(vm).map(Value::Content), Self::Enum(v) => v.eval(vm).map(Value::Content), Self::Term(v) => v.eval(vm).map(Value::Content), - Self::Formula(v) => v.eval(vm).map(Value::Content), + Self::Equation(v) => v.eval(vm).map(Value::Content), Self::Math(v) => v.eval(vm).map(Value::Content), Self::MathIdent(v) => v.eval(vm), Self::MathAlignPoint(v) => v.eval(vm).map(Value::Content), @@ -626,13 +626,13 @@ impl Eval for ast::TermItem { } } -impl Eval for ast::Formula { +impl Eval for ast::Equation { type Output = Content; fn eval(&self, vm: &mut Vm) -> SourceResult<Self::Output> { let body = self.body().eval(vm)?; let block = self.block(); - Ok((vm.items.formula)(body, block)) + Ok((vm.items.equation)(body, block)) } } diff --git a/src/eval/scope.rs b/src/eval/scope.rs index d1590063..d4338b5c 100644 --- a/src/eval/scope.rs +++ b/src/eval/scope.rs @@ -45,7 +45,7 @@ impl<'a> Scopes<'a> { .ok_or("unknown variable")?) } - /// Try to access a variable immutably from within a math formula. + /// Try to access a variable immutably in math. pub fn get_in_math(&self, var: &str) -> StrResult<&Value> { Ok(std::iter::once(&self.top) .chain(self.scopes.iter().rev()) diff --git a/src/ide/complete.rs b/src/ide/complete.rs index 66590160..4a1f0216 100644 --- a/src/ide/complete.rs +++ b/src/ide/complete.rs @@ -237,13 +237,13 @@ fn markup_completions(ctx: &mut CompletionContext) { ctx.snippet_completion( "math (inline)", "$${x}$", - "Inserts an inline-level mathematical formula.", + "Inserts an inline-level mathematical equation.", ); ctx.snippet_completion( "math (block)", "$ ${sum_x^2} $", - "Inserts a block-level mathematical formula.", + "Inserts a block-level mathematical equation.", ); } @@ -251,7 +251,7 @@ fn markup_completions(ctx: &mut CompletionContext) { fn complete_math(ctx: &mut CompletionContext) -> bool { if !matches!( ctx.leaf.parent_kind(), - Some(SyntaxKind::Formula) + Some(SyntaxKind::Equation) | Some(SyntaxKind::Math) | Some(SyntaxKind::MathFrac) | Some(SyntaxKind::MathAttach) @@ -935,10 +935,10 @@ impl<'a> CompletionContext<'a> { /// Add completions for all font families. fn font_completions(&mut self) { - let formula = self.before[self.cursor.saturating_sub(25)..].contains("formula"); + let equation = self.before[self.cursor.saturating_sub(25)..].contains("equation"); for (family, iter) in self.world.book().families() { let detail = summarize_font_family(iter); - if !formula || family.contains("Math") { + if !equation || family.contains("Math") { self.value_completion( None, &Value::Str(family.into()), @@ -1121,7 +1121,7 @@ impl<'a> CompletionContext<'a> { let in_math = matches!( self.leaf.parent_kind(), - Some(SyntaxKind::Formula) + Some(SyntaxKind::Equation) | Some(SyntaxKind::Math) | Some(SyntaxKind::MathFrac) | Some(SyntaxKind::MathAttach) diff --git a/src/ide/highlight.rs b/src/ide/highlight.rs index 6214328b..e948975b 100644 --- a/src/ide/highlight.rs +++ b/src/ide/highlight.rs @@ -27,9 +27,9 @@ pub enum Tag { ListMarker, /// A term in a term list. ListTerm, - /// The delimiters of a math formula. + /// The delimiters of an equation. MathDelimiter, - /// An operator with special meaning in a math formula. + /// An operator with special meaning in an equation. MathOperator, /// A keyword. Keyword, @@ -138,7 +138,7 @@ pub fn highlight(node: &LinkedNode) -> Option<Tag> { SyntaxKind::EnumMarker => Some(Tag::ListMarker), SyntaxKind::TermItem => None, SyntaxKind::TermMarker => Some(Tag::ListMarker), - SyntaxKind::Formula => None, + SyntaxKind::Equation => None, SyntaxKind::Math => None, SyntaxKind::MathIdent => highlight_ident(node), diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs index 59205efb..9b76d292 100644 --- a/src/syntax/ast.rs +++ b/src/syntax/ast.rs @@ -112,19 +112,19 @@ pub enum Expr { Enum(EnumItem), /// An item in a term list: `/ Term: Details`. Term(TermItem), - /// A math formula: `$x$`, `$ x^2 $`. - Formula(Formula), - /// A math formula: `$x$`, `$ x^2 $`. + /// A mathematical equation: `$x$`, `$ x^2 $`. + Equation(Equation), + /// The contents of a mathematical equation: `x^2 + 1`. Math(Math), - /// An identifier in a math formula: `pi`. + /// An identifier in math: `pi`. MathIdent(MathIdent), - /// An alignment point in a math formula: `&`. + /// An alignment point in math: `&`. MathAlignPoint(MathAlignPoint), - /// Matched delimiters surrounding math in a formula: `[x + y]`. + /// Matched delimiters in math: `[x + y]`. MathDelimited(MathDelimited), - /// A base with optional attachments in a formula: `a_1^2`. + /// A base with optional attachments in math: `a_1^2`. MathAttach(MathAttach), - /// A fraction in a math formula: `x/2`. + /// A fraction in math: `x/2`. MathFrac(MathFrac), /// An identifier: `left`. Ident(Ident), @@ -214,7 +214,7 @@ impl AstNode for Expr { SyntaxKind::ListItem => node.cast().map(Self::List), SyntaxKind::EnumItem => node.cast().map(Self::Enum), SyntaxKind::TermItem => node.cast().map(Self::Term), - SyntaxKind::Formula => node.cast().map(Self::Formula), + SyntaxKind::Equation => node.cast().map(Self::Equation), SyntaxKind::Math => node.cast().map(Self::Math), SyntaxKind::MathIdent => node.cast().map(Self::MathIdent), SyntaxKind::MathAlignPoint => node.cast().map(Self::MathAlignPoint), @@ -273,7 +273,7 @@ impl AstNode for Expr { Self::List(v) => v.as_untyped(), Self::Enum(v) => v.as_untyped(), Self::Term(v) => v.as_untyped(), - Self::Formula(v) => v.as_untyped(), + Self::Equation(v) => v.as_untyped(), Self::Math(v) => v.as_untyped(), Self::MathIdent(v) => v.as_untyped(), Self::MathAlignPoint(v) => v.as_untyped(), @@ -696,17 +696,17 @@ impl TermItem { } node! { - /// A math formula: `$x$`, `$ x^2 $`. - Formula + /// A mathemathical equation: `$x$`, `$ x^2 $`. + Equation } -impl Formula { +impl Equation { /// The contained math. pub fn body(&self) -> Math { self.0.cast_first_match().unwrap_or_default() } - /// Whether the formula should be displayed as a separate block. + /// Whether the equation should be displayed as a separate block. pub fn block(&self) -> bool { let is_space = |node: Option<&SyntaxNode>| { node.map(SyntaxNode::kind) == Some(SyntaxKind::Space) @@ -716,7 +716,7 @@ impl Formula { } node! { - /// Math markup. + /// The contents of a mathematical equation: `x^2 + 1`. Math } @@ -728,7 +728,7 @@ impl Math { } node! { - /// An identifier in a math formula: `pi`. + /// An identifier in math: `pi`. MathIdent } @@ -758,12 +758,12 @@ impl Deref for MathIdent { } node! { - /// An alignment point in a formula: `&`. + /// An alignment point in math: `&`. MathAlignPoint } node! { - /// Matched delimiters surrounding math in a formula: `[x + y]`. + /// Matched delimiters in math: `[x + y]`. MathDelimited } @@ -785,7 +785,7 @@ impl MathDelimited { } node! { - /// A base with optional attachments in a formula: `a_1^2`. + /// A base with optional attachments in math: `a_1^2`. MathAttach } @@ -813,7 +813,7 @@ impl MathAttach { } node! { - /// A fraction in a formula: `x/2` + /// A fraction in math: `x/2` MathFrac } diff --git a/src/syntax/kind.rs b/src/syntax/kind.rs index ce3ae744..869d77af 100644 --- a/src/syntax/kind.rs +++ b/src/syntax/kind.rs @@ -56,18 +56,18 @@ pub enum SyntaxKind { TermItem, /// Introduces a term item: `/`. TermMarker, - /// A mathematical formula: `$x$`, `$ x^2 $`. - Formula, + /// A mathematical equation: `$x$`, `$ x^2 $`. + Equation, - /// Mathematical markup. + /// The contents of a mathematical equation: `x^2 + 1`. Math, /// An identifier in math: `pi`. MathIdent, /// An alignment point in math: `&`. MathAlignPoint, - /// Matched delimiters surrounding math in a formula: `[x + y]`. + /// Matched delimiters in math: `[x + y]`. MathDelimited, - /// A base with optional attachments in a formula: `a_1^2`. + /// A base with optional attachments in math: `a_1^2`. MathAttach, /// A fraction in math: `x/2`. MathFrac, @@ -100,7 +100,7 @@ pub enum SyntaxKind { Star, /// Toggles emphasized text and indicates a subscript in math: `_`. Underscore, - /// Starts and ends a math formula: `$`. + /// Starts and ends a mathematical equation: `$`. Dollar, /// The unary plus and binary addition operator: `+`. Plus, @@ -342,7 +342,7 @@ impl SyntaxKind { Self::EnumMarker => "enum marker", Self::TermItem => "term list item", Self::TermMarker => "term marker", - Self::Formula => "math formula", + Self::Equation => "equation", Self::Math => "math", Self::MathIdent => "math identifier", Self::MathAlignPoint => "math alignment point", diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs index 127a89d5..c44e8cb3 100644 --- a/src/syntax/parser.rs +++ b/src/syntax/parser.rs @@ -114,7 +114,7 @@ fn markup_expr(p: &mut Parser, at_start: &mut bool) { SyntaxKind::EnumMarker if *at_start => enum_item(p), SyntaxKind::TermMarker if *at_start => term_item(p), SyntaxKind::RefMarker => reference(p), - SyntaxKind::Dollar => formula(p), + SyntaxKind::Dollar => equation(p), SyntaxKind::LeftBracket | SyntaxKind::RightBracket @@ -213,14 +213,14 @@ fn whitespace_line(p: &mut Parser) { } } -fn formula(p: &mut Parser) { +fn equation(p: &mut Parser) { let m = p.marker(); p.enter(LexMode::Math); p.assert(SyntaxKind::Dollar); math(p, |kind| kind == SyntaxKind::Dollar); p.expect(SyntaxKind::Dollar); p.exit(); - p.wrap(m, SyntaxKind::Formula); + p.wrap(m, SyntaxKind::Equation); } fn math(p: &mut Parser, mut stop: impl FnMut(SyntaxKind) -> bool) { @@ -631,7 +631,7 @@ fn code_primary(p: &mut Parser, atomic: bool) { SyntaxKind::LeftBrace => code_block(p), SyntaxKind::LeftBracket => content_block(p), SyntaxKind::LeftParen => with_paren(p), - SyntaxKind::Dollar => formula(p), + SyntaxKind::Dollar => equation(p), SyntaxKind::Let => let_binding(p), SyntaxKind::Set => set_rule(p), SyntaxKind::Show => show_rule(p), |
