diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-10-10 22:19:36 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-10-10 22:19:36 +0200 |
| commit | 92c01da36016e94ff20163806ddcbcf7e33d4031 (patch) | |
| tree | 1a900b3c11edcc93e9153fada3ce92310db5768b /src/syntax | |
| parent | 42500d5ed85539c5ab04dd3544beaf802da29be9 (diff) | |
Switch back to custom geometry types, unified with layout primitives 🏞
Diffstat (limited to 'src/syntax')
| -rw-r--r-- | src/syntax/ast/lit.rs | 8 | ||||
| -rw-r--r-- | src/syntax/token.rs | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/syntax/ast/lit.rs b/src/syntax/ast/lit.rs index 4370345a..40b360da 100644 --- a/src/syntax/ast/lit.rs +++ b/src/syntax/ast/lit.rs @@ -3,7 +3,7 @@ use super::*; use crate::color::RgbaColor; use crate::eval::DictKey; -use crate::length::Length; +use crate::geom::Unit; /// A literal. #[derive(Debug, Clone, PartialEq)] @@ -17,13 +17,13 @@ pub enum Lit { /// A floating-point literal: `1.2`, `10e-4`. Float(f64), /// A length literal: `12pt`, `3cm`. - Length(Length), + Length(f64, Unit), /// A percent literal: `50%`. /// - /// _Note_: `50%` is represented as `50.0` here, but as `0.5` in the + /// _Note_: `50%` is stored as `50.0` here, but as `0.5` in the /// corresponding [value]. /// - /// [value]: ../../eval/enum.Value.html#variant.Relative + /// [value]: ../../geom/struct.Relative.html Percent(f64), /// A color literal: `#ffccee`. Color(RgbaColor), diff --git a/src/syntax/token.rs b/src/syntax/token.rs index cb0526c1..5b055e39 100644 --- a/src/syntax/token.rs +++ b/src/syntax/token.rs @@ -1,6 +1,6 @@ //! Token definition. -use crate::length::Length; +use crate::geom::Unit; /// A minimal semantic entity of source code. #[derive(Debug, Copy, Clone, PartialEq)] @@ -72,10 +72,10 @@ pub enum Token<'s> { /// A floating-point number: `1.2`, `10e-4`. Float(f64), /// A length: `12pt`, `3cm`. - Length(Length), + Length(f64, Unit), /// A percentage: `50%`. /// - /// _Note_: `50%` is represented as `50.0` here, as in the corresponding + /// _Note_: `50%` is stored as `50.0` here, as in the corresponding /// [literal]. /// /// [literal]: ../ast/enum.Lit.html#variant.Percent @@ -159,7 +159,7 @@ impl<'s> Token<'s> { Self::Bool(_) => "bool", Self::Int(_) => "integer", Self::Float(_) => "float", - Self::Length(_) => "length", + Self::Length(..) => "length", Self::Percent(_) => "percentage", Self::Hex(_) => "hex value", Self::Str { .. } => "string", |
