diff options
Diffstat (limited to 'src/syntax')
| -rw-r--r-- | src/syntax/ast.rs | 40 | ||||
| -rw-r--r-- | src/syntax/kind.rs | 14 | ||||
| -rw-r--r-- | src/syntax/parser.rs | 8 |
3 files changed, 31 insertions, 31 deletions
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), |
