mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-17 16:58:21 +03:00
Format and clean up, enable default on snarkvm_algorithms
This commit is contained in:
parent
689dbad8fe
commit
2e7b542b8b
@ -10,7 +10,7 @@ use_try_shorthand = true
|
||||
# Nightly configurations
|
||||
imports_layout = "HorizontalVertical"
|
||||
license_template_path = ".resources/license_header"
|
||||
imports_granularity = "Item"
|
||||
imports_granularity = "Crate"
|
||||
overflow_delimited_expr = true
|
||||
reorder_impl_items = true
|
||||
version = "Two"
|
||||
|
@ -1,5 +1,5 @@
|
||||
[hooks]
|
||||
#pre-commit = "cargo clippy && cargo +nightly fmt --all -- --check"
|
||||
pre-commit = "cargo clippy && cargo +nightly fmt --all -- --check"
|
||||
|
||||
[logging]
|
||||
verbose = true
|
||||
|
@ -73,7 +73,7 @@ version = "1.2.3"
|
||||
|
||||
[dependencies.snarkvm-algorithms]
|
||||
version = "0.2.0"
|
||||
default-features = false
|
||||
#default-features = false
|
||||
|
||||
[dependencies.snarkvm-curves]
|
||||
version = "0.2.0"
|
||||
|
@ -14,14 +14,16 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::statement::*;
|
||||
use crate::BoolAnd;
|
||||
use crate::Expression;
|
||||
use crate::Monoid;
|
||||
use crate::MonoidalReducerExpression;
|
||||
use crate::MonoidalReducerStatement;
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::{
|
||||
statement::*,
|
||||
BoolAnd,
|
||||
Expression,
|
||||
Monoid,
|
||||
MonoidalReducerExpression,
|
||||
MonoidalReducerStatement,
|
||||
Node,
|
||||
Span,
|
||||
};
|
||||
|
||||
pub struct ReturnPathReducer {
|
||||
pub errors: Vec<(Span, String)>,
|
||||
|
@ -14,14 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::IntegerType;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, IntegerType, Span, Type};
|
||||
|
||||
use num_bigint::BigInt;
|
||||
use std::convert::TryInto;
|
||||
use std::fmt;
|
||||
use std::{convert::TryInto, fmt};
|
||||
|
||||
/// Constant integer values in a program.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
|
@ -14,8 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::unimplemented;
|
||||
use std::{cell::Cell, unimplemented};
|
||||
|
||||
use typed_arena::Arena;
|
||||
|
||||
|
@ -17,8 +17,7 @@
|
||||
//! Errors encountered when attempting to convert to an asg from an ast.
|
||||
|
||||
use crate::Span;
|
||||
use leo_ast::AstError;
|
||||
use leo_ast::Error as FormattedError;
|
||||
use leo_ast::{AstError, Error as FormattedError};
|
||||
use leo_grammar::ParserError;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
use leo_ast::IntegerType;
|
||||
|
||||
use std::cell::Cell;
|
||||
|
@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
use leo_ast::SpreadOrExpression;
|
||||
|
||||
use std::cell::Cell;
|
||||
|
@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
use leo_ast::IntegerType;
|
||||
|
||||
use std::cell::Cell;
|
||||
|
@ -14,18 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
pub use leo_ast::BinaryOperation;
|
||||
pub use leo_ast::BinaryOperationClass;
|
||||
use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
pub use leo_ast::{BinaryOperation, BinaryOperationClass};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -14,21 +14,22 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::CircuitMember;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Function;
|
||||
use crate::FunctionQualifier;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
pub use leo_ast::BinaryOperation;
|
||||
pub use leo_ast::Node as AstNode;
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
CircuitMember,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Function,
|
||||
FunctionQualifier,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Type,
|
||||
};
|
||||
pub use leo_ast::{BinaryOperation, Node as AstNode};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -14,19 +14,21 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::Circuit;
|
||||
use crate::CircuitMember;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Identifier;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
Circuit,
|
||||
CircuitMember,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Identifier,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Type,
|
||||
};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -14,22 +14,23 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::Circuit;
|
||||
use crate::CircuitMember;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Identifier;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
Circuit,
|
||||
CircuitMember,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Identifier,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Type,
|
||||
};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use indexmap::IndexSet;
|
||||
use indexmap::{IndexMap, IndexSet};
|
||||
use std::cell::Cell;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -14,18 +14,20 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstInt;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::GroupValue;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
ConstInt,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
GroupValue,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Type,
|
||||
};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -62,14 +62,7 @@ pub use unary::*;
|
||||
mod variable_ref;
|
||||
pub use variable_ref::*;
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, ConstValue, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Expression<'a> {
|
||||
|
@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
|
||||
pub use leo_ast::UnaryOperation;
|
||||
|
||||
use std::cell::Cell;
|
||||
|
@ -14,20 +14,22 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::ConstValue;
|
||||
use crate::Constant;
|
||||
use crate::DefinitionStatement;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::Type;
|
||||
use crate::Variable;
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
ConstValue,
|
||||
Constant,
|
||||
DefinitionStatement,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Type,
|
||||
Variable,
|
||||
};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -18,10 +18,7 @@
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::AsgContext;
|
||||
use crate::AsgConvertError;
|
||||
use crate::Program;
|
||||
use crate::Span;
|
||||
use crate::{AsgContext, AsgConvertError, Program, Span};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
|
@ -14,12 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Circuit;
|
||||
use crate::CircuitMember;
|
||||
use crate::Identifier;
|
||||
use crate::Scope;
|
||||
use crate::Type;
|
||||
use crate::Variable;
|
||||
use crate::{Circuit, CircuitMember, Identifier, Scope, Type, Variable};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::cell::RefCell;
|
||||
|
@ -74,9 +74,7 @@ pub use pass::*;
|
||||
pub mod context;
|
||||
pub use context::*;
|
||||
|
||||
pub use leo_ast::Ast;
|
||||
pub use leo_ast::Identifier;
|
||||
pub use leo_ast::Span;
|
||||
pub use leo_ast::{Ast, Identifier, Span};
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
|
@ -14,16 +14,18 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgContextInner;
|
||||
use crate::AsgConvertError;
|
||||
use crate::Circuit;
|
||||
use crate::Expression;
|
||||
use crate::Function;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::Variable;
|
||||
use crate::{
|
||||
AsgContextInner,
|
||||
AsgConvertError,
|
||||
Circuit,
|
||||
Expression,
|
||||
Function,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Variable,
|
||||
};
|
||||
|
||||
/// A node in the abstract semantic graph.
|
||||
pub trait Node {
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
// TODO (protryon): We should merge this with core
|
||||
|
||||
use crate::AsgContext;
|
||||
use crate::AsgConvertError;
|
||||
use crate::Program;
|
||||
use crate::{AsgContext, AsgConvertError, Program};
|
||||
|
||||
// TODO (protryon): Make asg deep copy so we can cache resolved core modules
|
||||
// TODO (protryon): Figure out how to do headers without bogus returns
|
||||
|
@ -14,13 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::Function;
|
||||
use crate::Identifier;
|
||||
use crate::Node;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, Function, Identifier, Node, Scope, Span, Type};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::cell::RefCell;
|
||||
|
@ -14,23 +14,24 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::BlockStatement;
|
||||
use crate::Circuit;
|
||||
use crate::FromAst;
|
||||
use crate::Identifier;
|
||||
use crate::MonoidalDirector;
|
||||
use crate::ReturnPathReducer;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::Type;
|
||||
use crate::Variable;
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
BlockStatement,
|
||||
Circuit,
|
||||
FromAst,
|
||||
Identifier,
|
||||
MonoidalDirector,
|
||||
ReturnPathReducer,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Type,
|
||||
Variable,
|
||||
};
|
||||
use indexmap::IndexMap;
|
||||
use leo_ast::FunctionInput;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::cell::RefCell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub enum FunctionQualifier {
|
||||
|
@ -24,20 +24,11 @@ pub use circuit::*;
|
||||
mod function;
|
||||
pub use function::*;
|
||||
|
||||
use crate::ArenaNode;
|
||||
use crate::AsgContext;
|
||||
use crate::AsgConvertError;
|
||||
use crate::ImportResolver;
|
||||
use crate::Input;
|
||||
use crate::Scope;
|
||||
use leo_ast::Identifier;
|
||||
use leo_ast::PackageAccess;
|
||||
use leo_ast::PackageOrPackages;
|
||||
use leo_ast::Span;
|
||||
use crate::{ArenaNode, AsgContext, AsgConvertError, ImportResolver, Input, Scope};
|
||||
use leo_ast::{Identifier, PackageAccess, PackageOrPackages, Span};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::cell::Cell;
|
||||
use std::cell::RefCell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
||||
/// Stores the Leo program abstract semantic graph (ASG).
|
||||
#[derive(Clone)]
|
||||
|
@ -15,9 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::*;
|
||||
use crate::expression::*;
|
||||
use crate::program::*;
|
||||
use crate::statement::*;
|
||||
use crate::{expression::*, program::*, statement::*};
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
|
@ -14,10 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::expression::*;
|
||||
use crate::program::*;
|
||||
use crate::statement::*;
|
||||
use crate::Monoid;
|
||||
use crate::{expression::*, program::*, statement::*, Monoid};
|
||||
|
||||
#[allow(unused_variables)]
|
||||
pub trait MonoidalReducerExpression<'a, T: Monoid> {
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
use crate::expression::*;
|
||||
use crate::program::*;
|
||||
use crate::statement::*;
|
||||
use crate::{expression::*, program::*, statement::*};
|
||||
|
||||
pub enum VisitResult {
|
||||
VisitChildren,
|
||||
|
@ -15,12 +15,9 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::*;
|
||||
use crate::expression::*;
|
||||
use crate::program::*;
|
||||
use crate::statement::*;
|
||||
use crate::{expression::*, program::*, statement::*};
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::marker::PhantomData;
|
||||
use std::{cell::Cell, marker::PhantomData};
|
||||
|
||||
pub struct VisitorDirector<'a, R: ExpressionVisitor<'a>> {
|
||||
visitor: R,
|
||||
|
@ -14,20 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::ArenaNode;
|
||||
use crate::AsgContext;
|
||||
use crate::AsgConvertError;
|
||||
use crate::Circuit;
|
||||
use crate::Expression;
|
||||
use crate::Function;
|
||||
use crate::Input;
|
||||
use crate::Statement;
|
||||
use crate::Type;
|
||||
use crate::Variable;
|
||||
use crate::{ArenaNode, AsgContext, AsgConvertError, Circuit, Expression, Function, Input, Statement, Type, Variable};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use std::cell::Cell;
|
||||
use std::cell::RefCell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
||||
/// An abstract data type that track the current bindings for variables, functions, and circuits.
|
||||
#[derive(Clone)]
|
||||
|
@ -14,22 +14,24 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::CircuitMember;
|
||||
use crate::ConstInt;
|
||||
use crate::ConstValue;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::Identifier;
|
||||
use crate::IntegerType;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::Type;
|
||||
use crate::Variable;
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
CircuitMember,
|
||||
ConstInt,
|
||||
ConstValue,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
Identifier,
|
||||
IntegerType,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Type,
|
||||
Variable,
|
||||
};
|
||||
pub use leo_ast::AssignOperation;
|
||||
use leo_ast::AssigneeAccess as AstAssigneeAccess;
|
||||
|
||||
|
@ -14,13 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::{AsgConvertError, FromAst, Node, PartialType, Scope, Span, Statement};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -14,16 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::BlockStatement;
|
||||
use crate::Expression;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, BlockStatement, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -14,15 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::Expression;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type};
|
||||
use leo_ast::ConsoleFunction as AstConsoleFunction;
|
||||
|
||||
use std::cell::Cell;
|
||||
|
@ -14,23 +14,23 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::InnerVariable;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::Type;
|
||||
use crate::Variable;
|
||||
use leo_ast::AstError;
|
||||
use leo_ast::DeprecatedError;
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
InnerVariable,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Type,
|
||||
Variable,
|
||||
};
|
||||
use leo_ast::{AstError, DeprecatedError};
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::cell::RefCell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DefinitionStatement<'a> {
|
||||
|
@ -14,14 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::Expression;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
|
@ -16,20 +16,21 @@
|
||||
|
||||
use leo_ast::IntegerType;
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::Expression;
|
||||
use crate::ExpressionNode;
|
||||
use crate::FromAst;
|
||||
use crate::InnerVariable;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::Variable;
|
||||
use crate::{
|
||||
AsgConvertError,
|
||||
Expression,
|
||||
ExpressionNode,
|
||||
FromAst,
|
||||
InnerVariable,
|
||||
Node,
|
||||
PartialType,
|
||||
Scope,
|
||||
Span,
|
||||
Statement,
|
||||
Variable,
|
||||
};
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::cell::RefCell;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct IterationStatement<'a> {
|
||||
|
@ -42,12 +42,7 @@ pub use iteration::*;
|
||||
mod return_;
|
||||
pub use return_::*;
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::{AsgConvertError, FromAst, Node, PartialType, Scope, Span};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Statement<'a> {
|
||||
|
@ -14,15 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::AsgConvertError;
|
||||
use crate::Expression;
|
||||
use crate::FromAst;
|
||||
use crate::Node;
|
||||
use crate::PartialType;
|
||||
use crate::Scope;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::Type;
|
||||
use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type};
|
||||
|
||||
use std::cell::Cell;
|
||||
#[derive(Clone)]
|
||||
|
@ -16,9 +16,7 @@
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
use crate::Expression;
|
||||
use crate::Statement;
|
||||
use crate::Type;
|
||||
use crate::{Expression, Statement, Type};
|
||||
use leo_ast::Identifier;
|
||||
|
||||
/// Specifies how a program variable was declared.
|
||||
|
@ -14,8 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
use crate::make_test_context;
|
||||
use crate::{load_asg, make_test_context};
|
||||
use leo_ast::Ast;
|
||||
use leo_grammar::Grammar;
|
||||
|
||||
|
@ -14,10 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::load_asg;
|
||||
use crate::load_asg_imports;
|
||||
use crate::make_test_context;
|
||||
use crate::mocked_resolver;
|
||||
use crate::{load_asg, load_asg_imports, make_test_context, mocked_resolver};
|
||||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
|
@ -17,11 +17,8 @@
|
||||
use leo_ast::Ast;
|
||||
use leo_grammar::Grammar;
|
||||
|
||||
use criterion::criterion_group;
|
||||
use criterion::criterion_main;
|
||||
use criterion::Criterion;
|
||||
use std::path::Path;
|
||||
use std::time::Duration;
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use std::{path::Path, time::Duration};
|
||||
|
||||
fn ast(ast: &Grammar) -> Ast {
|
||||
Ast::new("leo_tree", &ast).unwrap()
|
||||
|
@ -14,18 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Circuit;
|
||||
use crate::DeprecatedError;
|
||||
use crate::Function;
|
||||
use crate::FunctionInput;
|
||||
use crate::Identifier;
|
||||
use crate::ImportStatement;
|
||||
use crate::TestFunction;
|
||||
use leo_grammar::annotations::Annotation;
|
||||
use leo_grammar::annotations::AnnotationArguments;
|
||||
use leo_grammar::annotations::AnnotationName;
|
||||
use leo_grammar::definitions::AnnotatedDefinition;
|
||||
use leo_grammar::definitions::Definition;
|
||||
use crate::{Circuit, DeprecatedError, Function, FunctionInput, Identifier, ImportStatement, TestFunction};
|
||||
use leo_grammar::{
|
||||
annotations::{Annotation, AnnotationArguments, AnnotationName},
|
||||
definitions::{AnnotatedDefinition, Definition},
|
||||
};
|
||||
|
||||
use std::convert::TryFrom;
|
||||
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::CircuitMember;
|
||||
use crate::Identifier;
|
||||
use crate::{CircuitMember, Identifier};
|
||||
use leo_grammar::circuits::Circuit as GrammarCircuit;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Expression;
|
||||
use crate::Identifier;
|
||||
use crate::{Expression, Identifier};
|
||||
use leo_grammar::circuits::CircuitImpliedVariable;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct CircuitImpliedVariableDefinition {
|
||||
|
@ -14,15 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Function;
|
||||
use crate::Identifier;
|
||||
use crate::Type;
|
||||
use leo_grammar::circuits::CircuitMember as GrammarCircuitMember;
|
||||
use leo_grammar::circuits::CircuitVariableDefinition as GrammarCircuitVariableDefinition;
|
||||
use leo_grammar::functions::Function as GrammarFunction;
|
||||
use crate::{Function, Identifier, Type};
|
||||
use leo_grammar::{
|
||||
circuits::{CircuitMember as GrammarCircuitMember, CircuitVariableDefinition as GrammarCircuitVariableDefinition},
|
||||
functions::Function as GrammarFunction,
|
||||
};
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Expression;
|
||||
use crate::Identifier;
|
||||
use crate::{Expression, Identifier};
|
||||
use leo_grammar::circuits::CircuitVariable;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct CircuitVariableDefinition {
|
||||
|
@ -18,8 +18,7 @@ use crate::PositiveNumber;
|
||||
use leo_grammar::types::ArrayDimensions as GrammarArrayDimensions;
|
||||
use leo_input::types::ArrayDimensions as InputArrayDimensions;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// A vector of positive numbers that represent array dimensions.
|
||||
|
@ -14,33 +14,39 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::InputKeyword;
|
||||
use crate::MutSelfKeyword;
|
||||
use crate::SelfKeyword;
|
||||
use crate::Span;
|
||||
use leo_grammar::annotations::AnnotationArgument;
|
||||
use leo_grammar::common::Identifier as GrammarIdentifier;
|
||||
use leo_grammar::common::KeywordOrIdentifier;
|
||||
use leo_grammar::common::MutSelfKeyword as GrammarMutSelfKeyword;
|
||||
use leo_grammar::common::SelfKeyword as GrammarSelfKeyword;
|
||||
use leo_grammar::common::SelfKeywordOrIdentifier;
|
||||
use leo_grammar::expressions::CircuitName;
|
||||
use leo_grammar::functions::InputKeyword as GrammarInputKeyword;
|
||||
use leo_grammar::imports::PackageName as GrammarPackageName;
|
||||
use leo_grammar::types::SelfType;
|
||||
use crate::{InputKeyword, MutSelfKeyword, SelfKeyword, Span};
|
||||
use leo_grammar::{
|
||||
annotations::AnnotationArgument,
|
||||
common::{
|
||||
Identifier as GrammarIdentifier,
|
||||
KeywordOrIdentifier,
|
||||
MutSelfKeyword as GrammarMutSelfKeyword,
|
||||
SelfKeyword as GrammarSelfKeyword,
|
||||
SelfKeywordOrIdentifier,
|
||||
},
|
||||
expressions::CircuitName,
|
||||
functions::InputKeyword as GrammarInputKeyword,
|
||||
imports::PackageName as GrammarPackageName,
|
||||
types::SelfType,
|
||||
};
|
||||
use leo_input::common::Identifier as InputIdentifier;
|
||||
|
||||
use crate::Node;
|
||||
use serde::de::Visitor;
|
||||
use serde::de::{self};
|
||||
use serde::Deserialize;
|
||||
use serde::Deserializer;
|
||||
use serde::Serialize;
|
||||
use serde::Serializer;
|
||||
use std::collections::BTreeMap;
|
||||
use std::fmt;
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hasher;
|
||||
use serde::{
|
||||
de::{
|
||||
Visitor,
|
||||
{self},
|
||||
},
|
||||
Deserialize,
|
||||
Deserializer,
|
||||
Serialize,
|
||||
Serializer,
|
||||
};
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
fmt,
|
||||
hash::{Hash, Hasher},
|
||||
};
|
||||
|
||||
/// An identifier in the constrained program.
|
||||
///
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::{Node, Span};
|
||||
use leo_grammar::functions::InputKeyword as GrammarInputKeyword;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// The `input` keyword can view program register, record, and state values.
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::{Node, Span};
|
||||
use leo_grammar::common::MutSelfKeyword as GrammarMutSelfKeyword;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// The `mut self` keyword can view and modify circuit values inside of a circuit function.
|
||||
|
@ -17,8 +17,7 @@
|
||||
use leo_grammar::values::PositiveNumber as GrammarPositiveNumber;
|
||||
use leo_input::values::PositiveNumber as InputPositiveNumber;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// A number string guaranteed to be positive by the pest grammar.
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::{Node, Span};
|
||||
use leo_grammar::common::SelfKeyword as GrammarSelfKeyword;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// The `self` keyword can view circuit values inside of a circuit function.
|
||||
|
@ -15,10 +15,8 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use pest::Span as GrammarSpan;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hasher;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
pub struct Span {
|
||||
|
@ -14,14 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Expression;
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use leo_grammar::common::SpreadOrExpression as GrammarSpreadOrExpression;
|
||||
use leo_grammar::expressions::Expression as GrammarExpression;
|
||||
use crate::{Expression, Node, Span};
|
||||
use leo_grammar::{
|
||||
common::SpreadOrExpression as GrammarSpreadOrExpression,
|
||||
expressions::Expression as GrammarExpression,
|
||||
};
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// Spread or expression
|
||||
|
@ -14,13 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Error as FormattedError;
|
||||
use crate::Span;
|
||||
use leo_grammar::annotations::AnnotationName;
|
||||
use leo_grammar::definitions::Deprecated;
|
||||
use crate::{Error as FormattedError, Span};
|
||||
use leo_grammar::{annotations::AnnotationName, definitions::Deprecated};
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::path::Path;
|
||||
use std::{convert::TryFrom, path::Path};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DeprecatedError {
|
||||
|
@ -16,8 +16,7 @@
|
||||
|
||||
use crate::Span;
|
||||
|
||||
use std::fmt;
|
||||
use std::path::Path;
|
||||
use std::{fmt, path::Path};
|
||||
|
||||
pub const INDENT: &str = " ";
|
||||
|
||||
|
@ -14,43 +14,44 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::ArrayDimensions;
|
||||
use crate::CircuitImpliedVariableDefinition;
|
||||
use crate::GroupValue;
|
||||
use crate::Identifier;
|
||||
use crate::IntegerType;
|
||||
use crate::PositiveNumber;
|
||||
use crate::Span;
|
||||
use crate::SpreadOrExpression;
|
||||
use leo_grammar::access::Access;
|
||||
use leo_grammar::access::AssigneeAccess;
|
||||
use leo_grammar::access::SelfAccess;
|
||||
use leo_grammar::common::Assignee;
|
||||
use leo_grammar::common::Identifier as GrammarIdentifier;
|
||||
use leo_grammar::common::RangeOrExpression as GrammarRangeOrExpression;
|
||||
use leo_grammar::expressions::ArrayInitializerExpression;
|
||||
use leo_grammar::expressions::ArrayInlineExpression as GrammarArrayInlineExpression;
|
||||
use leo_grammar::expressions::BinaryExpression as GrammarBinaryExpression;
|
||||
use leo_grammar::expressions::CircuitInlineExpression;
|
||||
use leo_grammar::expressions::Expression as GrammarExpression;
|
||||
use leo_grammar::expressions::PostfixExpression;
|
||||
use leo_grammar::expressions::SelfPostfixExpression;
|
||||
use leo_grammar::expressions::TernaryExpression as GrammarTernaryExpression;
|
||||
use leo_grammar::expressions::UnaryExpression as GrammarUnaryExpression;
|
||||
use leo_grammar::operations::BinaryOperation as GrammarBinaryOperation;
|
||||
use leo_grammar::operations::UnaryOperation as GrammarUnaryOperation;
|
||||
use leo_grammar::values::AddressValue;
|
||||
use leo_grammar::values::BooleanValue;
|
||||
use leo_grammar::values::FieldValue;
|
||||
use leo_grammar::values::GroupValue as GrammarGroupValue;
|
||||
use leo_grammar::values::IntegerValue;
|
||||
use leo_grammar::values::NumberValue as GrammarNumber;
|
||||
use leo_grammar::values::Value;
|
||||
use crate::{
|
||||
ArrayDimensions,
|
||||
CircuitImpliedVariableDefinition,
|
||||
GroupValue,
|
||||
Identifier,
|
||||
IntegerType,
|
||||
PositiveNumber,
|
||||
Span,
|
||||
SpreadOrExpression,
|
||||
};
|
||||
use leo_grammar::{
|
||||
access::{Access, AssigneeAccess, SelfAccess},
|
||||
common::{Assignee, Identifier as GrammarIdentifier, RangeOrExpression as GrammarRangeOrExpression},
|
||||
expressions::{
|
||||
ArrayInitializerExpression,
|
||||
ArrayInlineExpression as GrammarArrayInlineExpression,
|
||||
BinaryExpression as GrammarBinaryExpression,
|
||||
CircuitInlineExpression,
|
||||
Expression as GrammarExpression,
|
||||
PostfixExpression,
|
||||
SelfPostfixExpression,
|
||||
TernaryExpression as GrammarTernaryExpression,
|
||||
UnaryExpression as GrammarUnaryExpression,
|
||||
},
|
||||
operations::{BinaryOperation as GrammarBinaryOperation, UnaryOperation as GrammarUnaryOperation},
|
||||
values::{
|
||||
AddressValue,
|
||||
BooleanValue,
|
||||
FieldValue,
|
||||
GroupValue as GrammarGroupValue,
|
||||
IntegerValue,
|
||||
NumberValue as GrammarNumber,
|
||||
Value,
|
||||
},
|
||||
};
|
||||
|
||||
use leo_grammar::access::TupleAccess;
|
||||
use leo_grammar::expressions::TupleExpression;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use leo_grammar::{access::TupleAccess, expressions::TupleExpression};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
use crate::Node;
|
||||
|
@ -14,16 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Block;
|
||||
use crate::FunctionInput;
|
||||
use crate::Identifier;
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{Block, FunctionInput, Identifier, Node, Span, Type};
|
||||
use leo_grammar::functions::Function as GrammarFunction;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
|
@ -14,14 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Identifier;
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{Identifier, Node, Span, Type};
|
||||
use leo_grammar::functions::FunctionInput as GrammarFunctionInput;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -14,16 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::FunctionInputVariable;
|
||||
use crate::InputKeyword;
|
||||
use crate::MutSelfKeyword;
|
||||
use crate::Node;
|
||||
use crate::SelfKeyword;
|
||||
use crate::Span;
|
||||
use crate::{FunctionInputVariable, InputKeyword, MutSelfKeyword, Node, SelfKeyword, Span};
|
||||
use leo_grammar::functions::input::Input as GrammarInput;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// Enumerates the possible inputs to a function.
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Function;
|
||||
use crate::Identifier;
|
||||
use crate::{Function, Identifier};
|
||||
use leo_grammar::functions::TestFunction as GrammarTestFunction;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct TestFunction {
|
||||
|
@ -15,19 +15,22 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::common::span::Span;
|
||||
use leo_grammar::values::GroupCoordinate as GrammarGroupCoordinate;
|
||||
use leo_grammar::values::Inferred as GrammarInferred;
|
||||
use leo_grammar::values::NumberValue as GrammarNumberValue;
|
||||
use leo_grammar::values::SignHigh as GrammarSignHigh;
|
||||
use leo_grammar::values::SignLow as GrammarSignLow;
|
||||
use leo_input::values::GroupCoordinate as InputGroupCoordinate;
|
||||
use leo_input::values::Inferred as InputInferred;
|
||||
use leo_input::values::NumberValue as InputNumberValue;
|
||||
use leo_input::values::SignHigh as InputSignHigh;
|
||||
use leo_input::values::SignLow as InputSignLow;
|
||||
use leo_grammar::values::{
|
||||
GroupCoordinate as GrammarGroupCoordinate,
|
||||
Inferred as GrammarInferred,
|
||||
NumberValue as GrammarNumberValue,
|
||||
SignHigh as GrammarSignHigh,
|
||||
SignLow as GrammarSignLow,
|
||||
};
|
||||
use leo_input::values::{
|
||||
GroupCoordinate as InputGroupCoordinate,
|
||||
Inferred as InputInferred,
|
||||
NumberValue as InputNumberValue,
|
||||
SignHigh as InputSignHigh,
|
||||
SignLow as InputSignLow,
|
||||
};
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -14,17 +14,19 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::common::span::Span;
|
||||
use crate::groups::GroupCoordinate;
|
||||
use leo_grammar::values::GroupRepresentation as GrammarGroupRepresentation;
|
||||
use leo_grammar::values::GroupTuple as GrammarGroupTuple;
|
||||
use leo_grammar::values::GroupValue as GrammarGroupValue;
|
||||
use leo_input::values::GroupRepresentation as InputGroupRepresentation;
|
||||
use leo_input::values::GroupTuple as InputGroupTuple;
|
||||
use leo_input::values::GroupValue as InputGroupValue;
|
||||
use crate::{common::span::Span, groups::GroupCoordinate};
|
||||
use leo_grammar::values::{
|
||||
GroupRepresentation as GrammarGroupRepresentation,
|
||||
GroupTuple as GrammarGroupTuple,
|
||||
GroupValue as GrammarGroupValue,
|
||||
};
|
||||
use leo_input::values::{
|
||||
GroupRepresentation as InputGroupRepresentation,
|
||||
GroupTuple as InputGroupTuple,
|
||||
GroupValue as InputGroupValue,
|
||||
};
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::PackageOrPackages;
|
||||
use crate::Span;
|
||||
use crate::{PackageOrPackages, Span};
|
||||
use leo_grammar::imports::Import as GrammarImport;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// Represents an import statement in a Leo program.
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Identifier;
|
||||
use crate::Span;
|
||||
use crate::{Identifier, Span};
|
||||
use leo_grammar::imports::ImportSymbol as GrammarImportSymbol;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -14,13 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::common::Identifier;
|
||||
use crate::PackageAccess;
|
||||
use crate::Span;
|
||||
use crate::{common::Identifier, PackageAccess, Span};
|
||||
use leo_grammar::imports::Package as GrammarPackage;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -14,14 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::ImportSymbol;
|
||||
use crate::Package;
|
||||
use crate::Packages;
|
||||
use crate::Span;
|
||||
use crate::{ImportSymbol, Package, Packages, Span};
|
||||
use leo_grammar::imports::PackageAccess as GrammarPackageAccess;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Package;
|
||||
use crate::Packages;
|
||||
use crate::{Package, Packages};
|
||||
use leo_grammar::imports::PackageOrPackages as GrammarPackageOrPackages;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -14,13 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::common::Identifier;
|
||||
use crate::PackageAccess;
|
||||
use crate::Span;
|
||||
use crate::{common::Identifier, PackageAccess, Span};
|
||||
use leo_grammar::imports::Packages as GrammarPackages;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -14,17 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::InputValue;
|
||||
use crate::MainInput;
|
||||
use crate::ProgramInput;
|
||||
use crate::ProgramState;
|
||||
use crate::Record;
|
||||
use crate::Registers;
|
||||
use crate::State;
|
||||
use crate::StateLeaf;
|
||||
use leo_input::files::File;
|
||||
use leo_input::files::TableOrSection;
|
||||
use leo_input::InputParserError;
|
||||
use crate::{InputValue, MainInput, ProgramInput, ProgramState, Record, Registers, State, StateLeaf};
|
||||
use leo_input::{
|
||||
files::{File, TableOrSection},
|
||||
InputParserError,
|
||||
};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
pub struct Input {
|
||||
|
@ -14,25 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::ArrayDimensions;
|
||||
use crate::GroupValue;
|
||||
use leo_input::errors::InputParserError;
|
||||
use leo_input::expressions::ArrayInitializerExpression;
|
||||
use leo_input::expressions::ArrayInlineExpression;
|
||||
use leo_input::expressions::Expression;
|
||||
use leo_input::expressions::TupleExpression;
|
||||
use leo_input::types::ArrayType;
|
||||
use leo_input::types::DataType;
|
||||
use leo_input::types::IntegerType;
|
||||
use leo_input::types::TupleType;
|
||||
use leo_input::types::Type;
|
||||
use leo_input::values::Address;
|
||||
use leo_input::values::AddressValue;
|
||||
use leo_input::values::BooleanValue;
|
||||
use leo_input::values::FieldValue;
|
||||
use leo_input::values::GroupValue as InputGroupValue;
|
||||
use leo_input::values::NumberValue;
|
||||
use leo_input::values::Value;
|
||||
use crate::{ArrayDimensions, GroupValue};
|
||||
use leo_input::{
|
||||
errors::InputParserError,
|
||||
expressions::{ArrayInitializerExpression, ArrayInlineExpression, Expression, TupleExpression},
|
||||
types::{ArrayType, DataType, IntegerType, TupleType, Type},
|
||||
values::{Address, AddressValue, BooleanValue, FieldValue, GroupValue as InputGroupValue, NumberValue, Value},
|
||||
};
|
||||
use pest::Span;
|
||||
|
||||
use std::fmt;
|
||||
|
@ -14,9 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Identifier;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{Identifier, Span, Type};
|
||||
use leo_input::parameters::Parameter as GrammarParameter;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -15,8 +15,7 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::InputValue;
|
||||
use leo_input::definitions::Definition;
|
||||
use leo_input::InputParserError;
|
||||
use leo_input::{definitions::Definition, InputParserError};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
|
@ -14,12 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::InputValue;
|
||||
use crate::MainInput;
|
||||
use crate::Registers;
|
||||
use leo_input::sections::Header;
|
||||
use leo_input::sections::Section;
|
||||
use leo_input::InputParserError;
|
||||
use crate::{InputValue, MainInput, Registers};
|
||||
use leo_input::{
|
||||
sections::{Header, Section},
|
||||
InputParserError,
|
||||
};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Default)]
|
||||
pub struct ProgramInput {
|
||||
|
@ -14,10 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::InputValue;
|
||||
use crate::Parameter;
|
||||
use leo_input::definitions::Definition;
|
||||
use leo_input::InputParserError;
|
||||
use crate::{InputValue, Parameter};
|
||||
use leo_input::{definitions::Definition, InputParserError};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Record;
|
||||
use crate::StateLeaf;
|
||||
use leo_input::sections::Header;
|
||||
use leo_input::sections::Section;
|
||||
use leo_input::InputParserError;
|
||||
use crate::{Record, StateLeaf};
|
||||
use leo_input::{
|
||||
sections::{Header, Section},
|
||||
InputParserError,
|
||||
};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Default)]
|
||||
pub struct PrivateState {
|
||||
|
@ -14,10 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::InputValue;
|
||||
use crate::Parameter;
|
||||
use leo_input::definitions::Definition;
|
||||
use leo_input::InputParserError;
|
||||
use crate::{InputValue, Parameter};
|
||||
use leo_input::{definitions::Definition, InputParserError};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
|
@ -14,10 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::InputValue;
|
||||
use crate::Parameter;
|
||||
use leo_input::definitions::Definition;
|
||||
use leo_input::InputParserError;
|
||||
use crate::{InputValue, Parameter};
|
||||
use leo_input::{definitions::Definition, InputParserError};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
|
@ -14,14 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::PrivateState;
|
||||
use crate::PublicState;
|
||||
use crate::Record;
|
||||
use crate::State;
|
||||
use crate::StateLeaf;
|
||||
use leo_input::tables::Table;
|
||||
use leo_input::tables::Visibility;
|
||||
use leo_input::InputParserError;
|
||||
use crate::{PrivateState, PublicState, Record, State, StateLeaf};
|
||||
use leo_input::{
|
||||
tables::{Table, Visibility},
|
||||
InputParserError,
|
||||
};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Default)]
|
||||
pub struct ProgramState {
|
||||
|
@ -15,9 +15,10 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::State;
|
||||
use leo_input::sections::Header;
|
||||
use leo_input::sections::Section;
|
||||
use leo_input::InputParserError;
|
||||
use leo_input::{
|
||||
sections::{Header, Section},
|
||||
InputParserError,
|
||||
};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Default)]
|
||||
pub struct PublicState {
|
||||
|
@ -14,10 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::InputValue;
|
||||
use crate::Parameter;
|
||||
use leo_input::definitions::Definition;
|
||||
use leo_input::InputParserError;
|
||||
use crate::{InputValue, Parameter};
|
||||
use leo_input::{definitions::Definition, InputParserError};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
|
@ -14,12 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_ast::Ast;
|
||||
use leo_ast::AstError;
|
||||
use leo_ast::{Ast, AstError};
|
||||
use leo_grammar::Grammar;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::{env, fs, path::Path};
|
||||
|
||||
fn to_leo_tree(filepath: &Path) -> Result<String, AstError> {
|
||||
// Loads the Leo code as a string from the given file path.
|
||||
|
@ -17,20 +17,20 @@
|
||||
//! A Leo program consists of import, circuit, and function definitions.
|
||||
//! Each defined type consists of ast statements and expressions.
|
||||
|
||||
use crate::load_annotation;
|
||||
use crate::Circuit;
|
||||
use crate::DeprecatedError;
|
||||
use crate::Function;
|
||||
use crate::FunctionInput;
|
||||
use crate::Identifier;
|
||||
use crate::ImportStatement;
|
||||
use crate::TestFunction;
|
||||
use leo_grammar::definitions::Definition;
|
||||
use leo_grammar::files::File;
|
||||
use crate::{
|
||||
load_annotation,
|
||||
Circuit,
|
||||
DeprecatedError,
|
||||
Function,
|
||||
FunctionInput,
|
||||
Identifier,
|
||||
ImportStatement,
|
||||
TestFunction,
|
||||
};
|
||||
use leo_grammar::{definitions::Definition, files::File};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// Stores the Leo program abstract syntax tree.
|
||||
|
@ -14,18 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Expression;
|
||||
use crate::Identifier;
|
||||
use crate::PositiveNumber;
|
||||
use crate::Span;
|
||||
use leo_grammar::access::ArrayAccess;
|
||||
use leo_grammar::access::AssigneeAccess as GrammarAssigneeAccess;
|
||||
use leo_grammar::common::Assignee as GrammarAssignee;
|
||||
use leo_grammar::common::Range;
|
||||
use leo_grammar::common::RangeOrExpression;
|
||||
use crate::{Expression, Identifier, PositiveNumber, Span};
|
||||
use leo_grammar::{
|
||||
access::{ArrayAccess, AssigneeAccess as GrammarAssigneeAccess},
|
||||
common::{Assignee as GrammarAssignee, Range, RangeOrExpression},
|
||||
};
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -14,14 +14,11 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Expression;
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::{Expression, Node, Span};
|
||||
|
||||
pub use leo_grammar::operations::AssignOperation as GrammarAssignOperation;
|
||||
use leo_grammar::statements::AssignStatement as GrammarAssignStatement;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
mod assignee;
|
||||
|
@ -14,13 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use crate::{Node, Span, Statement};
|
||||
use leo_grammar::statements::Block as GrammarBlock;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
|
@ -14,16 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Block;
|
||||
use crate::Expression;
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::Statement;
|
||||
use leo_grammar::statements::ConditionalNestedOrEndStatement;
|
||||
use leo_grammar::statements::ConditionalStatement as GrammarConditionalStatement;
|
||||
use crate::{Block, Expression, Node, Span, Statement};
|
||||
use leo_grammar::statements::{ConditionalNestedOrEndStatement, ConditionalStatement as GrammarConditionalStatement};
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
|
@ -14,16 +14,16 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Expression;
|
||||
use crate::FormattedString;
|
||||
use leo_grammar::console::ConsoleAssert as GrammarConsoleAssert;
|
||||
use leo_grammar::console::ConsoleDebug as GrammarConsoleDebug;
|
||||
use leo_grammar::console::ConsoleError as GrammarConsoleError;
|
||||
use leo_grammar::console::ConsoleFunction as GrammarConsoleFunction;
|
||||
use leo_grammar::console::ConsoleLog as GrammarConsoleLog;
|
||||
use crate::{Expression, FormattedString};
|
||||
use leo_grammar::console::{
|
||||
ConsoleAssert as GrammarConsoleAssert,
|
||||
ConsoleDebug as GrammarConsoleDebug,
|
||||
ConsoleError as GrammarConsoleError,
|
||||
ConsoleFunction as GrammarConsoleFunction,
|
||||
ConsoleLog as GrammarConsoleLog,
|
||||
};
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -14,13 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::ConsoleFunction;
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::{ConsoleFunction, Node, Span};
|
||||
use leo_grammar::console::ConsoleFunctionCall as GrammarConsoleFunctionCall;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -14,12 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::{Node, Span};
|
||||
use leo_grammar::console::FormattedContainer as GrammarFormattedContainer;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
|
@ -14,14 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Expression;
|
||||
use crate::FormattedContainer;
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::{Expression, FormattedContainer, Node, Span};
|
||||
use leo_grammar::console::FormattedString as GrammarFormattedString;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
|
@ -16,8 +16,7 @@
|
||||
|
||||
use leo_grammar::common::Declare as GrammarDeclare;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -14,13 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::Expression;
|
||||
use crate::Node;
|
||||
use crate::Span;
|
||||
use crate::Type;
|
||||
use crate::{Expression, Node, Span, Type};
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
mod variable_name;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user