summaryrefslogtreecommitdiff
path: root/src/syntax/ast.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-06 15:37:17 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-06 15:37:17 +0100
commitb2572f9d48a8f0efd30014302dcc271cd89fa91e (patch)
treed355df33cd125389b582274ae3fed6e7bcabcacb /src/syntax/ast.rs
parent3ecb0c754bc1777e002a43e4c34b27e676f9a95c (diff)
Math shorthands
Diffstat (limited to 'src/syntax/ast.rs')
-rw-r--r--src/syntax/ast.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs
index 55586feb..3661c156 100644
--- a/src/syntax/ast.rs
+++ b/src/syntax/ast.rs
@@ -441,6 +441,9 @@ pub enum MathNode {
Linebreak(Linebreak),
/// An escape sequence: `\#`, `\u{1F5FA}`.
Escape(Escape),
+ /// A shorthand for a unicode codepoint. For example, `->` for a right
+ /// arrow.
+ Shorthand(Shorthand),
/// An atom: `x`, `+`, `12`.
Atom(Atom),
/// Symbol notation: `:arrow:l:` or `arrow:l`. Notations without any colons
@@ -464,6 +467,7 @@ impl AstNode for MathNode {
SyntaxKind::Space { .. } => node.cast().map(Self::Space),
SyntaxKind::Linebreak => node.cast().map(Self::Linebreak),
SyntaxKind::Escape(_) => node.cast().map(Self::Escape),
+ SyntaxKind::Shorthand(_) => node.cast().map(Self::Shorthand),
SyntaxKind::Atom(_) => node.cast().map(Self::Atom),
SyntaxKind::Symbol(_) => node.cast().map(Self::Symbol),
SyntaxKind::Script => node.cast().map(Self::Script),
@@ -479,6 +483,7 @@ impl AstNode for MathNode {
Self::Space(v) => v.as_untyped(),
Self::Linebreak(v) => v.as_untyped(),
Self::Escape(v) => v.as_untyped(),
+ Self::Shorthand(v) => v.as_untyped(),
Self::Atom(v) => v.as_untyped(),
Self::Symbol(v) => v.as_untyped(),
Self::Script(v) => v.as_untyped(),