summaryrefslogtreecommitdiff
path: root/src/syntax/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-01-18 15:58:36 +0100
committerLaurenz <laurmaedje@gmail.com>2020-01-18 15:58:36 +0100
commit277f2d2176f5e98305870f90b16af3feae1bb3d1 (patch)
treea267216f67ebed87cbf83f021bfb01e9b79feae4 /src/syntax/mod.rs
parent70878885f5d169f2c5d9e66d3919ee56d5f9f9ca (diff)
ColorToken serialization + function fix 🚧
Diffstat (limited to 'src/syntax/mod.rs')
-rw-r--r--src/syntax/mod.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs
index e9725f04..f644f051 100644
--- a/src/syntax/mod.rs
+++ b/src/syntax/mod.rs
@@ -2,6 +2,7 @@
use std::fmt::{self, Display, Formatter};
use unicode_xid::UnicodeXID;
+use serde::Serialize;
use crate::func::LayoutFunc;
use crate::size::{Size, ScaleSize};
@@ -257,7 +258,7 @@ fn expect<E: ExpressionKind>(opt: ParseResult<Option<E>>) -> ParseResult<E> {
}
}
-#[derive(Debug, Clone, Eq, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
pub struct Colorization {
pub tokens: Vec<Spanned<ColorToken>>,
}
@@ -277,7 +278,8 @@ impl Colorization {
}
/// Entities which can be colored by syntax highlighting.
-#[derive(Debug, Copy, Clone, Eq, PartialEq)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
pub enum ColorToken {
Comment,
Bracket,
@@ -299,7 +301,7 @@ pub enum ColorToken {
Invalid,
}
-#[derive(Debug, Clone, Eq, PartialEq)]
+#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
pub struct ErrorMap {
pub errors: Vec<Spanned<String>>,
}