diff options
Diffstat (limited to 'src/syntax/expr.rs')
| -rw-r--r-- | src/syntax/expr.rs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/syntax/expr.rs b/src/syntax/expr.rs index fe24c655..b4c0dfaa 100644 --- a/src/syntax/expr.rs +++ b/src/syntax/expr.rs @@ -1,4 +1,10 @@ -use super::*; +use std::fmt::{self, Display, Formatter}; + +use crate::error::Errors; +use crate::size::Size; +use super::func::{keys::Key, values::Value}; +use super::span::{Span, Spanned}; +use super::tokens::is_identifier; /// An argument or return value. @@ -91,6 +97,13 @@ pub struct Object { pub pairs: Vec<Pair>, } +/// A key-value pair in an object. +#[derive(Clone, PartialEq)] +pub struct Pair { + pub key: Spanned<Ident>, + pub value: Spanned<Expr>, +} + impl Object { pub fn new() -> Object { Object { pairs: vec![] } @@ -162,13 +175,6 @@ impl Object { } } -/// A key-value pair in an object. -#[derive(Clone, PartialEq)] -pub struct Pair { - pub key: Spanned<Ident>, - pub value: Spanned<Expr>, -} - impl Display for Expr { fn fmt(&self, f: &mut Formatter) -> fmt::Result { use Expr::*; |
