diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-09-30 12:49:30 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-09-30 12:49:30 +0200 |
| commit | 3e791e3337b912ebc1f1771c4a1c0e4ed5723198 (patch) | |
| tree | b2c54ba4f24111423c60c4a32e1616fedecce58d /src/syntax | |
| parent | bc1b4216a802d09e8d00dd277a0e204d49bcaa7f (diff) | |
Move decoration into mod.rs 🔙
Diffstat (limited to 'src/syntax')
| -rw-r--r-- | src/syntax/decoration.rs | 26 | ||||
| -rw-r--r-- | src/syntax/mod.rs | 19 | ||||
| -rw-r--r-- | src/syntax/span.rs | 9 | ||||
| -rw-r--r-- | src/syntax/tree.rs | 2 |
4 files changed, 21 insertions, 35 deletions
diff --git a/src/syntax/decoration.rs b/src/syntax/decoration.rs deleted file mode 100644 index fe961be3..00000000 --- a/src/syntax/decoration.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! Decorations for semantic syntax highlighting. - -#[cfg(feature = "serialize")] -use serde::Serialize; - -use super::span::SpanVec; - -/// A list of spanned decorations. -pub type Decorations = SpanVec<Decoration>; - -/// Decorations for semantic syntax highlighting. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[cfg_attr(feature = "serialize", derive(Serialize))] -#[cfg_attr(feature = "serialize", serde(rename_all = "camelCase"))] -pub enum Decoration { - /// Text in italics. - Italic, - /// Text in bold. - Bold, - /// A valid, successfully resolved name. - Resolved, - /// An invalid, unresolved name. - Unresolved, - /// The key part of a key-value entry in a table. - TableKey, -} diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 1b9f8ba8..fe887c2f 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -1,11 +1,26 @@ //! Syntax types. -mod decoration; mod span; mod token; mod tree; -pub use decoration::*; pub use span::*; pub use token::*; pub use tree::*; + +/// Decorations for semantic syntax highlighting. +#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[cfg_attr(feature = "serialize", derive(serde::Serialize))] +#[cfg_attr(feature = "serialize", serde(rename_all = "camelCase"))] +pub enum Decoration { + /// Text in italics. + Italic, + /// Text in bold. + Bold, + /// A valid, successfully resolved name. + Resolved, + /// An invalid, unresolved name. + Unresolved, + /// The key part of a key-value entry in a table. + TableKey, +} diff --git a/src/syntax/span.rs b/src/syntax/span.rs index 9357c345..6f5420d4 100644 --- a/src/syntax/span.rs +++ b/src/syntax/span.rs @@ -6,9 +6,6 @@ use std::ops::{Add, Sub}; #[cfg(test)] use std::cell::Cell; -#[cfg(feature = "serialize")] -use serde::Serialize; - #[cfg(test)] thread_local! { static CMP_SPANS: Cell<bool> = Cell::new(true); @@ -34,7 +31,7 @@ impl<T> Offset for SpanVec<T> { /// A value with the span it corresponds to in the source code. #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[cfg_attr(feature = "serialize", derive(Serialize))] +#[cfg_attr(feature = "serialize", derive(serde::Serialize))] pub struct Spanned<T> { pub span: Span, pub v: T, @@ -92,7 +89,7 @@ impl<T: Debug> Debug for Spanned<T> { /// Locates a slice of source code. #[derive(Copy, Clone, Ord, PartialOrd, Hash)] -#[cfg_attr(feature = "serialize", derive(Serialize))] +#[cfg_attr(feature = "serialize", derive(serde::Serialize))] pub struct Span { /// The inclusive start position. pub start: Pos, @@ -164,7 +161,7 @@ impl Debug for Span { /// Zero-indexed line-column position in source code. #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[cfg_attr(feature = "serialize", derive(Serialize))] +#[cfg_attr(feature = "serialize", derive(serde::Serialize))] pub struct Pos { /// The zero-indexed line. pub line: usize, diff --git a/src/syntax/tree.rs b/src/syntax/tree.rs index f243e67a..8c4270e2 100644 --- a/src/syntax/tree.rs +++ b/src/syntax/tree.rs @@ -2,8 +2,8 @@ use std::fmt::{self, Debug, Formatter}; -use super::decoration::Decoration; use super::span::{SpanVec, Spanned}; +use super::Decoration; use crate::color::RgbaColor; use crate::compute::table::{SpannedEntry, Table}; use crate::compute::value::{TableValue, Value}; |
