summaryrefslogtreecommitdiff
path: root/src/syntax
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2021-06-01 14:56:02 +0200
committerLaurenz <laurmaedje@gmail.com>2021-06-09 22:44:40 +0200
commit73fa2eda2c23bd3baeb9e22b99eb0bfb183fc638 (patch)
treede42d0b6807b862cc28db5197751d5c503663c3c /src/syntax
parent9983634cd59b75a5842a096cc5fbf6472e65b5cb (diff)
Introduce `fr`s
Diffstat (limited to 'src/syntax')
-rw-r--r--src/syntax/expr.rs3
-rw-r--r--src/syntax/token.rs3
-rw-r--r--src/syntax/visit.rs1
3 files changed, 7 insertions, 0 deletions
diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs
index e0135d1c..4dac9c59 100644
--- a/src/syntax/expr.rs
+++ b/src/syntax/expr.rs
@@ -24,6 +24,8 @@ pub enum Expr {
/// _Note_: `50%` is stored as `50.0` here, but as `0.5` in the
/// corresponding [value](crate::geom::Relative).
Percent(Span, f64),
+ /// A fraction unit literal: `1fr`.
+ Fractional(Span, f64),
/// A color literal: `#ffccee`.
Color(Span, RgbaColor),
/// A string literal: `"hello!"`.
@@ -73,6 +75,7 @@ impl Expr {
Self::Length(span, _, _) => span,
Self::Angle(span, _, _) => span,
Self::Percent(span, _) => span,
+ Self::Fractional(span, _) => span,
Self::Color(span, _) => span,
Self::Str(span, _) => span,
Self::Ident(ref v) => v.span,
diff --git a/src/syntax/token.rs b/src/syntax/token.rs
index 9098f176..56ab3dd6 100644
--- a/src/syntax/token.rs
+++ b/src/syntax/token.rs
@@ -133,6 +133,8 @@ pub enum Token<'s> {
/// _Note_: `50%` is stored as `50.0` here, as in the corresponding
/// [literal](super::Expr::Percent).
Percent(f64),
+ /// A fraction unit: `3fr`.
+ Fraction(f64),
/// A color value: `#20d82a`.
Color(RgbaColor),
/// A quoted string: `"..."`.
@@ -258,6 +260,7 @@ impl<'s> Token<'s> {
Self::Length(_, _) => "length",
Self::Angle(_, _) => "angle",
Self::Percent(_) => "percentage",
+ Self::Fraction(_) => "`fr` value",
Self::Color(_) => "color",
Self::Str(_) => "string",
Self::LineComment(_) => "line comment",
diff --git a/src/syntax/visit.rs b/src/syntax/visit.rs
index 86481d4e..ba7555f2 100644
--- a/src/syntax/visit.rs
+++ b/src/syntax/visit.rs
@@ -80,6 +80,7 @@ visit! {
Expr::Length(_, _, _) => {}
Expr::Angle(_, _, _) => {}
Expr::Percent(_, _) => {}
+ Expr::Fractional(_, _) => {}
Expr::Color(_, _) => {}
Expr::Str(_, _) => {}
Expr::Ident(_) => {}