diff --git a/src/language/specs.rs b/src/language/specs.rs index 09b6520..714430b 100644 --- a/src/language/specs.rs +++ b/src/language/specs.rs @@ -3,6 +3,7 @@ use serde::{Deserialize, Serialize}; /// A kind of node that can appear in a document. #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub struct ConstructSpec { pub name: String, pub arity: AritySpec, @@ -15,10 +16,12 @@ pub struct ConstructSpec { /// A set of constructs. Can both include and be included by other sorts. #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Hash)] +#[serde(deny_unknown_fields)] pub struct SortSpec(pub Vec); /// The sorts of children that a node is allowed to contain. #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub enum AritySpec { /// Designates a pure text node. Texty, @@ -33,6 +36,7 @@ pub enum AritySpec { /// Describes the structure of a language, e.g. which constructs can appear /// in which positions. #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub struct GrammarSpec { pub constructs: Vec, pub sorts: Vec<(String, SortSpec)>, @@ -41,6 +45,7 @@ pub struct GrammarSpec { /// Describes how to display every construct in a language. #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub struct NotationSetSpec { /// A unqiue name for this set of notations pub name: String, @@ -51,6 +56,7 @@ pub struct NotationSetSpec { /// A single notation, with a grammar describing its structure and a notation describing how to /// display it. #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub struct LanguageSpec { pub name: String, pub grammar: GrammarSpec, diff --git a/src/style.rs b/src/style.rs index 584dc2b..050a1ab 100644 --- a/src/style.rs +++ b/src/style.rs @@ -44,6 +44,7 @@ pub struct Style { } #[derive(Debug, Clone, Copy, Default, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub enum Priority { #[default] Low, @@ -57,6 +58,7 @@ pub enum CursorHalf { } #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub enum StyleLabel { Open, Close, @@ -77,6 +79,7 @@ pub enum StyleLabel { // TODO: doc #[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub enum Condition { IsEmptyText, IsCommentOrWs, @@ -95,6 +98,7 @@ pub struct Rgb { } #[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub enum Base16Color { /// Default Background Base00, @@ -232,9 +236,9 @@ impl ColorTheme { /// The "default dark" Base16 colorscheme, by Chris Kempson (http://chriskempson.com) pub fn default_dark() -> ColorTheme { ColorTheme { - base00: Rgb::from_hex("#181818").bug(), - base01: Rgb::from_hex("#282828").bug(), - base02: Rgb::from_hex("#383838").bug(), + base00: Rgb::from_hex("#312121").bug(), + base01: Rgb::from_hex("#111111").bug(), + base02: Rgb::from_hex("#103030").bug(), base03: Rgb::from_hex("#585858").bug(), base04: Rgb::from_hex("#b8b8b8").bug(), base05: Rgb::from_hex("#d8d8d8").bug(),