From 16f3cbd3ddb385bfad51a439877d7ca289783eca Mon Sep 17 00:00:00 2001 From: collin Date: Wed, 2 Sep 2020 14:07:19 -0700 Subject: [PATCH] rename circuit_field -> circuit_variable in ast --- ast/src/circuits/circuit_member.rs | 4 ++-- .../{circuit_field.rs => circuit_variable.rs} | 4 ++-- ...efinition.rs => circuit_variable_definition.rs} | 4 ++-- ast/src/circuits/mod.rs | 8 ++++---- ast/src/expressions/circuit_inline_expression.rs | 4 ++-- ast/src/leo.pest | 14 +++++++------- typed/src/circuits/circuit_member.rs | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) rename ast/src/circuits/{circuit_field.rs => circuit_variable.rs} (93%) rename ast/src/circuits/{circuit_field_definition.rs => circuit_variable_definition.rs} (91%) diff --git a/ast/src/circuits/circuit_member.rs b/ast/src/circuits/circuit_member.rs index 37c33f9689..d3d949e99b 100644 --- a/ast/src/circuits/circuit_member.rs +++ b/ast/src/circuits/circuit_member.rs @@ -16,7 +16,7 @@ use crate::{ ast::Rule, - circuits::{CircuitFieldDefinition, CircuitFunction}, + circuits::{CircuitFunction, CircuitVariableDefinition}, }; use pest_ast::FromPest; @@ -25,6 +25,6 @@ use serde::Serialize; #[derive(Clone, Debug, FromPest, PartialEq, Serialize)] #[pest_ast(rule(Rule::circuit_member))] pub enum CircuitMember<'ast> { - CircuitFieldDefinition(CircuitFieldDefinition<'ast>), + CircuitVariableDefinition(CircuitVariableDefinition<'ast>), CircuitFunction(CircuitFunction<'ast>), } diff --git a/ast/src/circuits/circuit_field.rs b/ast/src/circuits/circuit_variable.rs similarity index 93% rename from ast/src/circuits/circuit_field.rs rename to ast/src/circuits/circuit_variable.rs index d141ae718f..0f14fa43e0 100644 --- a/ast/src/circuits/circuit_field.rs +++ b/ast/src/circuits/circuit_variable.rs @@ -21,8 +21,8 @@ use pest_ast::FromPest; use serde::Serialize; #[derive(Clone, Debug, FromPest, PartialEq, Serialize)] -#[pest_ast(rule(Rule::circuit_field))] -pub struct CircuitField<'ast> { +#[pest_ast(rule(Rule::circuit_variable))] +pub struct CircuitVariable<'ast> { pub identifier: Identifier<'ast>, pub expression: Expression<'ast>, #[pest_ast(outer())] diff --git a/ast/src/circuits/circuit_field_definition.rs b/ast/src/circuits/circuit_variable_definition.rs similarity index 91% rename from ast/src/circuits/circuit_field_definition.rs rename to ast/src/circuits/circuit_variable_definition.rs index a919786a4f..533fff7455 100644 --- a/ast/src/circuits/circuit_field_definition.rs +++ b/ast/src/circuits/circuit_variable_definition.rs @@ -21,8 +21,8 @@ use pest_ast::FromPest; use serde::Serialize; #[derive(Clone, Debug, FromPest, PartialEq, Serialize)] -#[pest_ast(rule(Rule::circuit_field_definition))] -pub struct CircuitFieldDefinition<'ast> { +#[pest_ast(rule(Rule::circuit_variable_definition))] +pub struct CircuitVariableDefinition<'ast> { pub identifier: Identifier<'ast>, pub _type: Type<'ast>, #[pest_ast(outer())] diff --git a/ast/src/circuits/mod.rs b/ast/src/circuits/mod.rs index dcb5aae1e8..768a36fd7e 100644 --- a/ast/src/circuits/mod.rs +++ b/ast/src/circuits/mod.rs @@ -17,11 +17,11 @@ pub mod circuit; pub use circuit::*; -pub mod circuit_field; -pub use circuit_field::*; +pub mod circuit_variable; +pub use circuit_variable::*; -pub mod circuit_field_definition; -pub use circuit_field_definition::*; +pub mod circuit_variable_definition; +pub use circuit_variable_definition::*; pub mod circuit_function; pub use circuit_function::*; diff --git a/ast/src/expressions/circuit_inline_expression.rs b/ast/src/expressions/circuit_inline_expression.rs index d829f66fd1..22fdd7074a 100644 --- a/ast/src/expressions/circuit_inline_expression.rs +++ b/ast/src/expressions/circuit_inline_expression.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . -use crate::{ast::Rule, circuits::CircuitField, common::Identifier, SpanDef}; +use crate::{ast::Rule, circuits::CircuitVariable, common::Identifier, SpanDef}; use pest::Span; use pest_ast::FromPest; @@ -24,7 +24,7 @@ use serde::Serialize; #[pest_ast(rule(Rule::expression_circuit_inline))] pub struct CircuitInlineExpression<'ast> { pub identifier: Identifier<'ast>, - pub members: Vec>, + pub members: Vec>, #[pest_ast(outer())] #[serde(with = "SpanDef")] pub span: Span<'ast>, diff --git a/ast/src/leo.pest b/ast/src/leo.pest index dc350cd0f4..f8add90224 100644 --- a/ast/src/leo.pest +++ b/ast/src/leo.pest @@ -285,17 +285,17 @@ access_static_member = ${ "::" ~ identifier } // Declared in circuits/circuit_definition.rs circuit = { "circuit " ~ identifier ~ "{" ~ NEWLINE* ~ circuit_member* ~ NEWLINE* ~ "}" ~ NEWLINE* } -// Declared in circuits/circuit_field.rs -circuit_field = { identifier ~ ":" ~ expression } +// Declared in circuits/circuit_variable.rs +circuit_variable = { identifier ~ ":" ~ expression } -// Declared in circuits/circuit_field_definition.rs -circuit_field_definition = { identifier ~ ":" ~ type_ ~ ","?} +// Declared in circuits/circuit_variable_definition.rs +circuit_variable_definition = { identifier ~ ":" ~ type_ ~ ","?} // Declared in circuits/circuit_function.rs circuit_function = { static_? ~ function } // Declared in circuits/circuit_member.rs -circuit_member = { circuit_function | circuit_field_definition ~ NEWLINE*} +circuit_member = { circuit_function | circuit_variable_definition ~ NEWLINE*} /// Conditionals @@ -331,8 +331,8 @@ expression_array_inline = { "[" ~ NEWLINE* ~ inline_array_inner ~ NEWLINE* ~ "]" inline_array_inner = _{(spread_or_expression ~ ("," ~ NEWLINE* ~ spread_or_expression)*)?} // Declared in expressions/circuit_inline_expression.rs -expression_circuit_inline = { identifier ~ "{" ~ NEWLINE* ~ circuit_field_list ~ NEWLINE* ~ "}" } -circuit_field_list = _{ (circuit_field ~ ("," ~ NEWLINE* ~ circuit_field)*)? ~ ","? } +expression_circuit_inline = { identifier ~ "{" ~ NEWLINE* ~ circuit_variable_list ~ NEWLINE* ~ "}" } +circuit_variable_list = _{ (circuit_variable ~ ("," ~ NEWLINE* ~ circuit_variable)*)? ~ ","? } // Declared in expressions/unary_expression.rs expression_unary = { operation_unary ~ expression_term } diff --git a/typed/src/circuits/circuit_member.rs b/typed/src/circuits/circuit_member.rs index 54d170be33..f09afd975a 100644 --- a/typed/src/circuits/circuit_member.rs +++ b/typed/src/circuits/circuit_member.rs @@ -16,9 +16,9 @@ use crate::{Function, Identifier, Type}; use leo_ast::circuits::{ - CircuitFieldDefinition as AstCircuitFieldDefinition, CircuitFunction as AstCircuitFunction, CircuitMember as AstCircuitMember, + CircuitVariableDefinition as AstCircuitFieldDefinition, }; use serde::{Deserialize, Serialize}; @@ -51,7 +51,7 @@ impl<'ast> From> for CircuitMember { impl<'ast> From> for CircuitMember { fn from(object: AstCircuitMember<'ast>) -> Self { match object { - AstCircuitMember::CircuitFieldDefinition(circuit_value) => CircuitMember::from(circuit_value), + AstCircuitMember::CircuitVariableDefinition(circuit_value) => CircuitMember::from(circuit_value), AstCircuitMember::CircuitFunction(circuit_function) => CircuitMember::from(circuit_function), } }