summaryrefslogtreecommitdiff
path: root/src/eval/value.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-03-21 17:46:09 +0100
committerLaurenz <laurmaedje@gmail.com>2021-03-21 17:50:56 +0100
commit5e08028fb36aa766957cba64c5c665edf9b96fb7 (patch)
tree912799dad3c1e25b7032f3e3bee009537c6f555b /src/eval/value.rs
parent898728f260923a91444eb23b522d0abf01a4299b (diff)
Syntax functions 🚀
This adds overridable functions that markup desugars into. Specifically: - \ desugars into linebreak - Two newlines desugar into parbreak - * desugars into strong - _ desugars into emph - = .. desugars into heading - `..` desugars into raw
Diffstat (limited to 'src/eval/value.rs')
-rw-r--r--src/eval/value.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/eval/value.rs b/src/eval/value.rs
index 485829f3..288e5ed7 100644
--- a/src/eval/value.rs
+++ b/src/eval/value.rs
@@ -4,7 +4,7 @@ use std::fmt::{self, Debug, Display, Formatter};
use std::ops::Deref;
use std::rc::Rc;
-use super::{EvalContext, ExprMap};
+use super::{EvalContext, NodeMap};
use crate::color::Color;
use crate::diag::DiagSet;
use crate::exec::ExecContext;
@@ -107,7 +107,7 @@ pub type TemplateValue = Vec<TemplateNode>;
///
/// Evaluating a template expression creates only a single node. Adding multiple
/// templates can yield multi-node templates.
-#[derive(Debug, Clone, PartialEq)]
+#[derive(Debug, Clone)]
pub enum TemplateNode {
/// A template that consists of a syntax tree plus already evaluated
/// expression.
@@ -115,7 +115,7 @@ pub enum TemplateNode {
/// The syntax tree of the corresponding template expression.
tree: Rc<Tree>,
/// The evaluated expressions for the `tree`.
- map: ExprMap,
+ map: NodeMap,
},
/// A template that was converted from a string.
Str(String),
@@ -123,6 +123,13 @@ pub enum TemplateNode {
Func(TemplateFunc),
}
+impl PartialEq for TemplateNode {
+ fn eq(&self, _: &Self) -> bool {
+ // TODO: Figure out what we want here.
+ false
+ }
+}
+
/// A reference-counted dynamic template node that can implement custom
/// behaviour.
#[derive(Clone)]