From 5afb42ad89abb518a01a09051f0f9b6f75bd383e Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 9 Jun 2021 00:37:13 +0200 Subject: Lists with indent-based parsing - Unordered lists with indent-based parsing and basic layout using stacks - Headings are now also indent based - Removes syntax functions since they will be superseded by select & transform --- src/eval/value.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/eval/value.rs') diff --git a/src/eval/value.rs b/src/eval/value.rs index e2ff5383..94f7f569 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -9,7 +9,7 @@ use super::EvalContext; use crate::color::{Color, RgbaColor}; use crate::exec::ExecContext; use crate::geom::{Angle, Length, Linear, Relative}; -use crate::syntax::{Node, Span, Spanned, Tree}; +use crate::syntax::{Expr, Span, Spanned, Tree}; /// A computational value. #[derive(Debug, Clone, PartialEq)] @@ -148,7 +148,7 @@ pub enum TemplateNode { /// The syntax tree of the corresponding template expression. tree: Rc, /// The evaluated expressions for the `tree`. - map: NodeMap, + map: ExprMap, }, /// A template that was converted from a string. Str(String), @@ -163,13 +163,13 @@ impl PartialEq for TemplateNode { } } -/// A map from nodes to the values they evaluated to. +/// A map from expressions to the values they evaluated to. /// -/// The raw pointers point into the nodes contained in some [`Tree`]. Since the -/// lifetime is erased, the tree could go out of scope while the hash map still -/// lives. Although this could lead to lookup panics, it is not unsafe since the -/// pointers are never dereferenced. -pub type NodeMap = HashMap<*const Node, Value>; +/// The raw pointers point into the expressions contained in some [`Tree`]. +/// Since the lifetime is erased, the tree could go out of scope while the hash +/// map still lives. Although this could lead to lookup panics, it is not unsafe +/// since the pointers are never dereferenced. +pub type ExprMap = HashMap<*const Expr, Value>; /// A reference-counted dynamic template node that can implement custom /// behaviour. -- cgit v1.2.3