From 277f2d2176f5e98305870f90b16af3feae1bb3d1 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 18 Jan 2020 15:58:36 +0100 Subject: =?UTF-8?q?ColorToken=20serialization=20+=20function=20fix=20?= =?UTF-8?q?=F0=9F=9A=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/syntax/mod.rs') 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(opt: ParseResult>) -> ParseResult { } } -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, Serialize)] pub struct Colorization { pub tokens: Vec>, } @@ -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>, } -- cgit v1.2.3