From 648acb7fe3c21faec56e11d08c306aa29e0c694a Mon Sep 17 00:00:00 2001 From: collin Date: Wed, 5 Aug 2020 14:36:37 -0700 Subject: [PATCH] add updated values to inputs --- input/src/errors/parser.rs | 8 +-- input/src/leo-input.pest | 63 +++++++++++------ input/src/types/array_type.rs | 8 +-- input/src/types/integer_type.rs | 80 +++------------------- input/src/types/mod.rs | 6 ++ input/src/types/signed_integer_type.rs | 46 +++++++++++++ input/src/types/unsigned_integer_type.rs | 46 +++++++++++++ input/src/values/field_value.rs | 11 --- input/src/values/integer_value.rs | 25 ++++--- input/src/values/mod.rs | 13 +++- input/src/values/negative_number.rs | 20 ++++++ input/src/values/number_implicit_value.rs | 19 ----- input/src/values/number_value.rs | 27 ++++++-- input/src/values/positive_number.rs | 20 ++++++ input/src/values/signed_integer_value.rs | 20 ++++++ input/src/values/unsigned_integer_value.rs | 20 ++++++ input/src/values/value.rs | 8 +-- 17 files changed, 285 insertions(+), 155 deletions(-) create mode 100644 input/src/types/signed_integer_type.rs create mode 100644 input/src/types/unsigned_integer_type.rs create mode 100644 input/src/values/negative_number.rs delete mode 100644 input/src/values/number_implicit_value.rs create mode 100644 input/src/values/positive_number.rs create mode 100644 input/src/values/signed_integer_value.rs create mode 100644 input/src/values/unsigned_integer_value.rs diff --git a/input/src/errors/parser.rs b/input/src/errors/parser.rs index 0b9c81cb4d..9de6563ef2 100644 --- a/input/src/errors/parser.rs +++ b/input/src/errors/parser.rs @@ -5,7 +5,7 @@ use crate::{ sections::Header, tables::Table, types::{DataType, Type}, - values::{NumberImplicitValue, NumberValue, Value}, + values::{NumberValue, PositiveNumber, Value}, }; use pest::{ @@ -42,10 +42,10 @@ impl InputParserError { InputParserError::SyntaxError(InputSyntaxError::from(error)) } - pub fn implicit_type(data_type: DataType, implicit: NumberImplicitValue) -> Self { + pub fn implicit_type(data_type: DataType, implicit: NumberValue) -> Self { let message = format!("expected `{}`, found `{}`", data_type.to_string(), implicit.to_string()); - Self::new_from_span(message, implicit.span) + Self::new_from_span(message, implicit.span().clone()) } pub fn data_type_mismatch(data_type: DataType, value: Value) -> Self { @@ -73,7 +73,7 @@ impl InputParserError { Self::new_from_span(message, span) } - pub fn array_init_length(number: NumberValue, array: ArrayInitializerExpression) -> Self { + pub fn array_init_length(number: PositiveNumber, array: ArrayInitializerExpression) -> Self { let message = format!( "expected an array with a fixed size of {} elements, found one with {} elements", number.to_string(), diff --git a/input/src/leo-input.pest b/input/src/leo-input.pest index 986548f78f..637fe2679e 100644 --- a/input/src/leo-input.pest +++ b/input/src/leo-input.pest @@ -37,32 +37,40 @@ type_ = { type_array | type_data } // Declared in types/integer_type.rs type_integer = { - type_u8 - | type_u16 - | type_u32 - | type_u64 - | type_u128 - | type_i8 - | type_i16 - | type_i32 - | type_i64 - | type_i128 + type_integer_signed + | type_integer_unsigned } -// Declared in types/integer_type.rs +// Declared in types/unsigned_integer_type.rs type_u8 = { "u8" } type_u16 = { "u16" } type_u32 = { "u32" } type_u64 = { "u64" } type_u128 = { "u128" } -// Declared in types/integer_type.rs +type_integer_unsigned = { + type_u8 + | type_u16 + | type_u32 + | type_u64 + | type_u128 +} + +// Declared in types/signed_integer_type.rs type_i8 = { "i8" } type_i16 = { "i16" } type_i32 = { "i32" } type_i64 = { "i64" } type_i128 = { "i128" } +type_integer_signed = { + type_i8 + | type_i16 + | type_i32 + | type_i64 + | type_i128 +} + // Declared in types/field_type.rs type_field = { "field" } @@ -90,33 +98,44 @@ value = { | value_field | value_group | value_integer - | value_implicit // must be last as a catch all + | value_number // must be last as a catch all } // Declared in values/number_value.rs -value_number = @{ (("-" ~ ASCII_NONZERO_DIGIT) | "0" | ASCII_NONZERO_DIGIT) ~ ASCII_DIGIT* } +value_number = { number_negative | number_positive } + +// Declared in values/number_negative.rs +number_negative = @{ "-" ~ ASCII_DIGIT+ } + +// Declared in values/number_positive.rs +number_positive = @{ ASCII_DIGIT+ } -// Declared in values/number_implicit_value.rs -value_implicit = { value_number } // Declared in values/integer_value.rs -value_integer = { value_number ~ type_integer } +value_integer = { value_integer_signed | value_integer_unsigned} + +// Declared in values/signed_integer_value.rs +value_integer_signed = @{ value_number ~ type_integer_signed } + +// Declared in values/unsigned_integer_value.rs +value_integer_unsigned = @{ number_positive ~ type_integer_unsigned } // Declared in values/boolean_value.rs value_boolean = { "true" | "false" } // Declared in values/field_value.rs -value_field = { value_number ~ type_field } +value_field = @{ value_number ~ type_field } // Declared in values/group_value.rs -value_group = { group_tuple ~ type_group } -group_tuple = { "(" ~ NEWLINE* ~ value_number ~ "," ~ NEWLINE* ~ value_number ~ NEWLINE* ~")" } +value_group = @{ group_single_or_tuple ~ type_group } +group_tuple = !{"(" ~ value_number ~ "," ~ value_number ~ ")"} +group_single_or_tuple = {value_number | group_tuple} // Declared in values/address.rs -address = @{ (LOWERCASE_LETTER | ASCII_DIGIT)* } +address = @{ "aleo" ~ ASCII_DIGIT ~ (LOWERCASE_LETTER | ASCII_DIGIT){58} } // Declared in values/address_value.rs -value_address = { type_address ~ "(" ~ address ~ ")" } +value_address = @{ type_address ~ "(" ~ address ~ ")" } /// Expressions diff --git a/input/src/types/array_type.rs b/input/src/types/array_type.rs index fd1ca18dbe..bf621ebd02 100644 --- a/input/src/types/array_type.rs +++ b/input/src/types/array_type.rs @@ -1,19 +1,19 @@ -use crate::{ast::Rule, types::DataType, values::NumberValue}; +use crate::{ast::Rule, types::DataType, values::PositiveNumber}; use pest::Span; use pest_ast::FromPest; -#[derive(Clone, Debug, FromPest, PartialEq)] +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] #[pest_ast(rule(Rule::type_array))] pub struct ArrayType<'ast> { pub _type: DataType, - pub dimensions: Vec>, + pub dimensions: Vec>, #[pest_ast(outer())] pub span: Span<'ast>, } impl<'ast> ArrayType<'ast> { - pub fn next_dimension(&mut self) -> Option> { + pub fn next_dimension(&mut self) -> Option> { self.dimensions.pop() } } diff --git a/input/src/types/integer_type.rs b/input/src/types/integer_type.rs index c49cb11562..1be043689a 100644 --- a/input/src/types/integer_type.rs +++ b/input/src/types/integer_type.rs @@ -1,81 +1,23 @@ -use crate::ast::Rule; +use crate::{ + ast::Rule, + types::{SignedIntegerType, UnsignedIntegerType}, +}; use pest_ast::FromPest; +use std::fmt; #[derive(Clone, Debug, FromPest, PartialEq, Eq)] #[pest_ast(rule(Rule::type_integer))] pub enum IntegerType { - U8Type(U8Type), - U16Type(U16Type), - U32Type(U32Type), - U64Type(U64Type), - U128Type(U128Type), - - I8Type(I8Type), - I16Type(I16Type), - I32Type(I32Type), - I64Type(I64Type), - I128Type(I128Type), + Signed(UnsignedIntegerType), + Unsigned(SignedIntegerType), } -// Unsigned - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_u8))] -pub struct U8Type {} - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_u16))] -pub struct U16Type {} - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_u32))] -pub struct U32Type {} - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_u64))] -pub struct U64Type {} - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_u128))] -pub struct U128Type {} - -// Signed - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_i8))] -pub struct I8Type {} - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_i16))] -pub struct I16Type {} - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_i32))] -pub struct I32Type {} - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_i64))] -pub struct I64Type {} - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::type_i128))] -pub struct I128Type {} - -impl std::fmt::Display for IntegerType { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl fmt::Display for IntegerType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - IntegerType::U8Type(_) => write!(f, "u8"), - IntegerType::U16Type(_) => write!(f, "u16"), - IntegerType::U32Type(_) => write!(f, "u32"), - IntegerType::U64Type(_) => write!(f, "u64"), - IntegerType::U128Type(_) => write!(f, "u128"), - - IntegerType::I8Type(_) => write!(f, "i8"), - IntegerType::I16Type(_) => write!(f, "i16"), - IntegerType::I32Type(_) => write!(f, "i32"), - IntegerType::I64Type(_) => write!(f, "i64"), - IntegerType::I128Type(_) => write!(f, "i128"), + IntegerType::Signed(integer) => write!(f, "{}", integer), + IntegerType::Unsigned(integer) => write!(f, "{}", integer), } } } diff --git a/input/src/types/mod.rs b/input/src/types/mod.rs index 5985694f99..364b8f9150 100644 --- a/input/src/types/mod.rs +++ b/input/src/types/mod.rs @@ -19,5 +19,11 @@ pub use group_type::*; pub mod integer_type; pub use integer_type::*; +pub mod signed_integer_type; +pub use signed_integer_type::*; + pub mod type_; pub use type_::*; + +pub mod unsigned_integer_type; +pub use unsigned_integer_type::*; diff --git a/input/src/types/signed_integer_type.rs b/input/src/types/signed_integer_type.rs new file mode 100644 index 0000000000..03d6f36038 --- /dev/null +++ b/input/src/types/signed_integer_type.rs @@ -0,0 +1,46 @@ +use crate::ast::Rule; + +use pest_ast::FromPest; +use std::fmt; + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_integer_signed))] +pub enum SignedIntegerType { + I8Type(I8Type), + I16Type(I16Type), + I32Type(I32Type), + I64Type(I64Type), + I128Type(I128Type), +} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_i8))] +pub struct I8Type {} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_i16))] +pub struct I16Type {} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_i32))] +pub struct I32Type {} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_i64))] +pub struct I64Type {} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_i128))] +pub struct I128Type {} + +impl fmt::Display for SignedIntegerType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + SignedIntegerType::I8Type(_) => write!(f, "i8"), + SignedIntegerType::I16Type(_) => write!(f, "i16"), + SignedIntegerType::I32Type(_) => write!(f, "i32"), + SignedIntegerType::I64Type(_) => write!(f, "i64"), + SignedIntegerType::I128Type(_) => write!(f, "i128"), + } + } +} diff --git a/input/src/types/unsigned_integer_type.rs b/input/src/types/unsigned_integer_type.rs new file mode 100644 index 0000000000..b50e1ff88e --- /dev/null +++ b/input/src/types/unsigned_integer_type.rs @@ -0,0 +1,46 @@ +use crate::ast::Rule; + +use pest_ast::FromPest; +use std::fmt; + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_integer_unsigned))] +pub enum UnsignedIntegerType { + U8Type(U8Type), + U16Type(U16Type), + U32Type(U32Type), + U64Type(U64Type), + U128Type(U128Type), +} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_u8))] +pub struct U8Type {} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_u16))] +pub struct U16Type {} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_u32))] +pub struct U32Type {} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_u64))] +pub struct U64Type {} + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::type_u128))] +pub struct U128Type {} + +impl fmt::Display for UnsignedIntegerType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + UnsignedIntegerType::U8Type(_) => write!(f, "u8"), + UnsignedIntegerType::U16Type(_) => write!(f, "u16"), + UnsignedIntegerType::U32Type(_) => write!(f, "u32"), + UnsignedIntegerType::U64Type(_) => write!(f, "u64"), + UnsignedIntegerType::U128Type(_) => write!(f, "u128"), + } + } +} diff --git a/input/src/values/field_value.rs b/input/src/values/field_value.rs index fba97c8873..a8f6b39337 100644 --- a/input/src/values/field_value.rs +++ b/input/src/values/field_value.rs @@ -1,6 +1,5 @@ use crate::{ast::Rule, types::FieldType, values::NumberValue}; -use crate::values::NumberImplicitValue; use pest::Span; use pest_ast::FromPest; use std::fmt; @@ -14,16 +13,6 @@ pub struct FieldValue<'ast> { pub span: Span<'ast>, } -impl<'ast> FieldValue<'ast> { - pub fn from_implicit(number: NumberImplicitValue<'ast>, type_: FieldType) -> Self { - Self { - number: number.number, - type_, - span: number.span, - } - } -} - impl<'ast> fmt::Display for FieldValue<'ast> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.number) diff --git a/input/src/values/integer_value.rs b/input/src/values/integer_value.rs index b627ecc05f..08ff98e8b3 100644 --- a/input/src/values/integer_value.rs +++ b/input/src/values/integer_value.rs @@ -1,7 +1,6 @@ use crate::{ ast::Rule, - types::IntegerType, - values::{NumberImplicitValue, NumberValue}, + values::{SignedIntegerValue, UnsignedIntegerValue}, }; use pest::Span; @@ -10,25 +9,25 @@ use std::fmt; #[derive(Clone, Debug, FromPest, PartialEq, Eq)] #[pest_ast(rule(Rule::value_integer))] -pub struct IntegerValue<'ast> { - pub number: NumberValue<'ast>, - pub type_: IntegerType, - #[pest_ast(outer())] - pub span: Span<'ast>, +pub enum IntegerValue<'ast> { + Signed(SignedIntegerValue<'ast>), + Unsigned(UnsignedIntegerValue<'ast>), } impl<'ast> IntegerValue<'ast> { - pub fn from_implicit(number: NumberImplicitValue<'ast>, type_: IntegerType) -> Self { - Self { - number: number.number, - type_, - span: number.span, + pub fn span(&self) -> &Span<'ast> { + match self { + IntegerValue::Signed(integer) => &integer.span, + IntegerValue::Unsigned(integer) => &integer.span, } } } impl<'ast> fmt::Display for IntegerValue<'ast> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}{}", self.number, self.type_) + match self { + IntegerValue::Signed(integer) => write!(f, "{}", integer), + IntegerValue::Unsigned(integer) => write!(f, "{}", integer), + } } } diff --git a/input/src/values/mod.rs b/input/src/values/mod.rs index 5df20a08c1..290bb372c4 100644 --- a/input/src/values/mod.rs +++ b/input/src/values/mod.rs @@ -16,11 +16,20 @@ pub use group_value::*; pub mod integer_value; pub use integer_value::*; -pub mod number_implicit_value; -pub use number_implicit_value::*; +pub mod negative_number; +pub use negative_number::*; pub mod number_value; pub use number_value::*; +pub mod positive_number; +pub use positive_number::*; + +pub mod signed_integer_value; +pub use signed_integer_value::*; + pub mod value; pub use value::*; + +pub mod unsigned_integer_value; +pub use unsigned_integer_value::*; diff --git a/input/src/values/negative_number.rs b/input/src/values/negative_number.rs new file mode 100644 index 0000000000..98d51c40a6 --- /dev/null +++ b/input/src/values/negative_number.rs @@ -0,0 +1,20 @@ +use crate::ast::{span_into_string, Rule}; + +use pest::Span; +use pest_ast::FromPest; +use std::fmt; + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::number_negative))] +pub struct NegativeNumber<'ast> { + #[pest_ast(outer(with(span_into_string)))] + pub value: String, + #[pest_ast(outer())] + pub span: Span<'ast>, +} + +impl<'ast> fmt::Display for NegativeNumber<'ast> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.value) + } +} diff --git a/input/src/values/number_implicit_value.rs b/input/src/values/number_implicit_value.rs deleted file mode 100644 index e4b3fb3f54..0000000000 --- a/input/src/values/number_implicit_value.rs +++ /dev/null @@ -1,19 +0,0 @@ -use crate::{ast::Rule, values::NumberValue}; - -use pest::Span; -use pest_ast::FromPest; -use std::fmt; - -#[derive(Clone, Debug, FromPest, PartialEq, Eq)] -#[pest_ast(rule(Rule::value_implicit))] -pub struct NumberImplicitValue<'ast> { - pub number: NumberValue<'ast>, - #[pest_ast(outer())] - pub span: Span<'ast>, -} - -impl<'ast> fmt::Display for NumberImplicitValue<'ast> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.number) - } -} diff --git a/input/src/values/number_value.rs b/input/src/values/number_value.rs index d241f9068f..89438c0471 100644 --- a/input/src/values/number_value.rs +++ b/input/src/values/number_value.rs @@ -1,4 +1,7 @@ -use crate::ast::{span_into_string, Rule}; +use crate::{ + ast::Rule, + values::{NegativeNumber, PositiveNumber}, +}; use pest::Span; use pest_ast::FromPest; @@ -6,15 +9,25 @@ use std::fmt; #[derive(Clone, Debug, FromPest, PartialEq, Eq)] #[pest_ast(rule(Rule::value_number))] -pub struct NumberValue<'ast> { - #[pest_ast(outer(with(span_into_string)))] - pub value: String, - #[pest_ast(outer())] - pub span: Span<'ast>, +pub enum NumberValue<'ast> { + Negative(NegativeNumber<'ast>), + Positive(PositiveNumber<'ast>), +} + +impl<'ast> NumberValue<'ast> { + pub fn span(&self) -> &Span<'ast> { + match self { + NumberValue::Negative(number) => &number.span, + NumberValue::Positive(number) => &number.span, + } + } } impl<'ast> fmt::Display for NumberValue<'ast> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.value) + match self { + NumberValue::Negative(number) => write!(f, "{}", number), + NumberValue::Positive(number) => write!(f, "{}", number), + } } } diff --git a/input/src/values/positive_number.rs b/input/src/values/positive_number.rs new file mode 100644 index 0000000000..e104eccc83 --- /dev/null +++ b/input/src/values/positive_number.rs @@ -0,0 +1,20 @@ +use crate::ast::{span_into_string, Rule}; + +use pest::Span; +use pest_ast::FromPest; +use std::fmt; + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::number_positive))] +pub struct PositiveNumber<'ast> { + #[pest_ast(outer(with(span_into_string)))] + pub value: String, + #[pest_ast(outer())] + pub span: Span<'ast>, +} + +impl<'ast> fmt::Display for PositiveNumber<'ast> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.value) + } +} diff --git a/input/src/values/signed_integer_value.rs b/input/src/values/signed_integer_value.rs new file mode 100644 index 0000000000..0da70b71e6 --- /dev/null +++ b/input/src/values/signed_integer_value.rs @@ -0,0 +1,20 @@ +use crate::{ast::Rule, types::SignedIntegerType, values::NumberValue}; + +use pest::Span; +use pest_ast::FromPest; +use std::fmt; + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::value_integer_signed))] +pub struct SignedIntegerValue<'ast> { + pub number: NumberValue<'ast>, + pub type_: SignedIntegerType, + #[pest_ast(outer())] + pub span: Span<'ast>, +} + +impl<'ast> fmt::Display for SignedIntegerValue<'ast> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}{}", self.number, self.type_) + } +} diff --git a/input/src/values/unsigned_integer_value.rs b/input/src/values/unsigned_integer_value.rs new file mode 100644 index 0000000000..89f1948988 --- /dev/null +++ b/input/src/values/unsigned_integer_value.rs @@ -0,0 +1,20 @@ +use crate::{ast::Rule, types::UnsignedIntegerType, values::PositiveNumber}; + +use pest::Span; +use pest_ast::FromPest; +use std::fmt; + +#[derive(Clone, Debug, FromPest, PartialEq, Eq)] +#[pest_ast(rule(Rule::value_integer_unsigned))] +pub struct UnsignedIntegerValue<'ast> { + pub number: PositiveNumber<'ast>, + pub type_: UnsignedIntegerType, + #[pest_ast(outer())] + pub span: Span<'ast>, +} + +impl<'ast> fmt::Display for UnsignedIntegerValue<'ast> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}{}", self.number, self.type_) + } +} diff --git a/input/src/values/value.rs b/input/src/values/value.rs index 819936a57c..2ecc60870e 100644 --- a/input/src/values/value.rs +++ b/input/src/values/value.rs @@ -1,6 +1,6 @@ use crate::{ ast::Rule, - values::{BooleanValue, FieldValue, GroupValue, IntegerValue, NumberImplicitValue}, + values::{BooleanValue, FieldValue, GroupValue, IntegerValue, NumberValue}, }; use crate::values::AddressValue; @@ -15,7 +15,7 @@ pub enum Value<'ast> { Boolean(BooleanValue<'ast>), Field(FieldValue<'ast>), Group(GroupValue<'ast>), - Implicit(NumberImplicitValue<'ast>), + Implicit(NumberValue<'ast>), Integer(IntegerValue<'ast>), } @@ -26,8 +26,8 @@ impl<'ast> Value<'ast> { Value::Boolean(value) => &value.span, Value::Field(value) => &value.span, Value::Group(value) => &value.span, - Value::Implicit(value) => &value.span, - Value::Integer(value) => &value.span, + Value::Implicit(value) => &value.span(), + Value::Integer(value) => &value.span(), } } }