summaryrefslogtreecommitdiff
path: root/src/syntax/ast/lit.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-10-10 22:41:56 +0200
committerLaurenz <laurmaedje@gmail.com>2020-10-10 22:41:56 +0200
commitc216a4fc26c72938ddad60bc5fe4fa9e45263b30 (patch)
tree0a563e3076a8d0724d0361b5d81a2b8d07d15cbe /src/syntax/ast/lit.rs
parent51bf3268ddf5db1bdd61e59bfb4a30f0463a4bfb (diff)
Flatten ast module back into syntax module 🌪
Diffstat (limited to 'src/syntax/ast/lit.rs')
-rw-r--r--src/syntax/ast/lit.rs56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/syntax/ast/lit.rs b/src/syntax/ast/lit.rs
deleted file mode 100644
index 40b360da..00000000
--- a/src/syntax/ast/lit.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-//! Literals.
-
-use super::*;
-use crate::color::RgbaColor;
-use crate::eval::DictKey;
-use crate::geom::Unit;
-
-/// A literal.
-#[derive(Debug, Clone, PartialEq)]
-pub enum Lit {
- /// A identifier literal: `left`.
- Ident(Ident),
- /// A boolean literal: `true`, `false`.
- Bool(bool),
- /// An integer literal: `120`.
- Int(i64),
- /// A floating-point literal: `1.2`, `10e-4`.
- Float(f64),
- /// A length literal: `12pt`, `3cm`.
- Length(f64, Unit),
- /// A percent literal: `50%`.
- ///
- /// _Note_: `50%` is stored as `50.0` here, but as `0.5` in the
- /// corresponding [value].
- ///
- /// [value]: ../../geom/struct.Relative.html
- Percent(f64),
- /// A color literal: `#ffccee`.
- Color(RgbaColor),
- /// A string literal: `"hello!"`.
- Str(String),
- /// A dictionary literal: `(false, 12cm, greeting = "hi")`.
- Dict(LitDict),
- /// A content literal: `{*Hello* there!}`.
- Content(SynTree),
-}
-
-/// A dictionary literal: `(false, 12cm, greeting = "hi")`.
-#[derive(Debug, Default, Clone, PartialEq)]
-pub struct LitDict(pub Vec<LitDictEntry>);
-
-/// An entry in a dictionary literal: `false` or `greeting = "hi"`.
-#[derive(Debug, Clone, PartialEq)]
-pub struct LitDictEntry {
- /// The key of the entry if there was one: `greeting`.
- pub key: Option<Spanned<DictKey>>,
- /// The value of the entry: `"hi"`.
- pub expr: Spanned<Expr>,
-}
-
-impl LitDict {
- /// Create an empty dict literal.
- pub fn new() -> Self {
- Self::default()
- }
-}