From 650c712eabc6f665a0a0cc2a47fb5b90cf715d87 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 14 Aug 2020 20:19:50 +0200 Subject: [PATCH] =?UTF-8?q?Add=20a=20syntax=20tree=20expression=20kind=20?= =?UTF-8?q?=F0=9F=8E=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows bodies to be passed as regular arguments. --- src/syntax/expr.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs index dd23ea610..e7e262bc0 100644 --- a/src/syntax/expr.rs +++ b/src/syntax/expr.rs @@ -9,6 +9,7 @@ use crate::length::Length; use crate::Feedback; use super::span::{SpanVec, Spanned}; use super::tokens::is_identifier; +use super::tree::SyntaxTree; use super::value::Value; /// An expression. @@ -26,6 +27,8 @@ pub enum Expr { Length(Length), /// A color value with alpha channel: `#f79143ff`. Color(RgbaColor), + /// A syntax tree containing typesetting content. + Tree(SyntaxTree), /// A tuple: `(false, 12cm, "hi")`. Tuple(Tuple), /// A named tuple: `cmyk(37.7, 0, 3.9, 1.1)`. @@ -56,6 +59,7 @@ impl Expr { Number(_) => "number", Length(_) => "length", Color(_) => "color", + Tree(_) => "syntax tree", Tuple(_) => "tuple", NamedTuple(_) => "named tuple", Object(_) => "object", @@ -78,6 +82,7 @@ impl Debug for Expr { Number(n) => n.fmt(f), Length(s) => s.fmt(f), Color(c) => c.fmt(f), + Tree(t) => t.fmt(f), Tuple(t) => t.fmt(f), NamedTuple(t) => t.fmt(f), Object(o) => o.fmt(f),