itemize imports

This commit is contained in:
howardwu 2021-03-04 10:33:51 -08:00
parent c9f70800fd
commit 4f50b44a63
471 changed files with 2935 additions and 2020 deletions

View File

@ -10,7 +10,7 @@ use_try_shorthand = true
# Nightly configurations
imports_layout = "HorizontalVertical"
license_template_path = ".resources/license_header"
imports_granularity = "Crate"
imports_granularity = "Item"
overflow_delimited_expr = true
reorder_impl_items = true
version = "Two"

View File

@ -14,16 +14,14 @@
// 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::*,
BoolAnd,
Expression,
Monoid,
MonoidalReducerExpression,
MonoidalReducerStatement,
Node,
Span,
};
use crate::statement::*;
use crate::BoolAnd;
use crate::Expression;
use crate::Monoid;
use crate::MonoidalReducerExpression;
use crate::MonoidalReducerStatement;
use crate::Node;
use crate::Span;
pub struct ReturnPathReducer {
pub errors: Vec<(Span, String)>,

View File

@ -14,10 +14,14 @@
// 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, IntegerType, Span, Type};
use crate::AsgConvertError;
use crate::IntegerType;
use crate::Span;
use crate::Type;
use num_bigint::BigInt;
use std::{convert::TryInto, fmt};
use std::convert::TryInto;
use std::fmt;
/// Constant integer values in a program.
#[derive(Clone, Debug, PartialEq)]

View File

@ -14,7 +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 std::{cell::Cell, unimplemented};
use std::cell::Cell;
use std::unimplemented;
use typed_arena::Arena;

View File

@ -17,7 +17,8 @@
//! Errors encountered when attempting to convert to an asg from an ast.
use crate::Span;
use leo_ast::{AstError, Error as FormattedError};
use leo_ast::AstError;
use leo_ast::Error as FormattedError;
use leo_grammar::ParserError;
#[derive(Debug, Error)]

View File

@ -14,7 +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::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
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 leo_ast::IntegerType;
use std::cell::Cell;

View File

@ -14,7 +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::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
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 std::cell::Cell;

View File

@ -14,7 +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::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
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 leo_ast::SpreadOrExpression;
use std::cell::Cell;

View File

@ -14,7 +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::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
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 leo_ast::IntegerType;
use std::cell::Cell;

View File

@ -14,8 +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::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
pub use leo_ast::{BinaryOperation, BinaryOperationClass};
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 std::cell::Cell;

View File

@ -14,22 +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,
CircuitMember,
ConstValue,
Expression,
ExpressionNode,
FromAst,
Function,
FunctionQualifier,
Node,
PartialType,
Scope,
Span,
Type,
};
pub use leo_ast::{BinaryOperation, Node as AstNode};
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 std::cell::Cell;

View File

@ -14,21 +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::{
AsgConvertError,
Circuit,
CircuitMember,
ConstValue,
Expression,
ExpressionNode,
FromAst,
Identifier,
Node,
PartialType,
Scope,
Span,
Type,
};
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 std::cell::Cell;

View File

@ -14,23 +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,
Circuit,
CircuitMember,
ConstValue,
Expression,
ExpressionNode,
FromAst,
Identifier,
Node,
PartialType,
Scope,
Span,
Type,
};
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 indexmap::{IndexMap, IndexSet};
use indexmap::IndexMap;
use indexmap::IndexSet;
use std::cell::Cell;
#[derive(Clone)]

View File

@ -14,20 +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::{
AsgConvertError,
ConstInt,
ConstValue,
Expression,
ExpressionNode,
FromAst,
GroupValue,
Node,
PartialType,
Scope,
Span,
Type,
};
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 std::cell::Cell;

View File

@ -62,7 +62,14 @@ pub use unary::*;
mod variable_ref;
pub use variable_ref::*;
use crate::{AsgConvertError, ConstValue, FromAst, Node, PartialType, Scope, Span, Type};
use crate::AsgConvertError;
use crate::ConstValue;
use crate::FromAst;
use crate::Node;
use crate::PartialType;
use crate::Scope;
use crate::Span;
use crate::Type;
#[derive(Clone)]
pub enum Expression<'a> {

View File

@ -14,7 +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::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
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 std::cell::Cell;

View File

@ -14,7 +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::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
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 std::cell::Cell;

View File

@ -14,7 +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::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
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 std::cell::Cell;

View File

@ -14,7 +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::{AsgConvertError, ConstValue, Expression, ExpressionNode, FromAst, Node, PartialType, Scope, Span, Type};
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::UnaryOperation;
use std::cell::Cell;

View File

@ -14,22 +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,
ConstValue,
Constant,
DefinitionStatement,
Expression,
ExpressionNode,
FromAst,
Node,
PartialType,
Scope,
Span,
Statement,
Type,
Variable,
};
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 std::cell::Cell;

View File

@ -18,7 +18,10 @@
use std::marker::PhantomData;
use crate::{AsgContext, AsgConvertError, Program, Span};
use crate::AsgContext;
use crate::AsgConvertError;
use crate::Program;
use crate::Span;
use indexmap::IndexMap;

View File

@ -14,7 +14,12 @@
// 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, CircuitMember, Identifier, Scope, Type, Variable};
use crate::Circuit;
use crate::CircuitMember;
use crate::Identifier;
use crate::Scope;
use crate::Type;
use crate::Variable;
use indexmap::IndexMap;
use std::cell::RefCell;

View File

@ -74,7 +74,9 @@ pub use pass::*;
pub mod context;
pub use context::*;
pub use leo_ast::{Ast, Identifier, Span};
pub use leo_ast::Ast;
pub use leo_ast::Identifier;
pub use leo_ast::Span;
use std::path::Path;

View File

@ -14,18 +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::{
AsgContextInner,
AsgConvertError,
Circuit,
Expression,
Function,
PartialType,
Scope,
Span,
Statement,
Variable,
};
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;
/// A node in the abstract semantic graph.
pub trait Node {

View File

@ -16,7 +16,9 @@
// TODO (protryon): We should merge this with core
use crate::{AsgContext, AsgConvertError, Program};
use crate::AsgContext;
use crate::AsgConvertError;
use crate::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

View File

@ -14,7 +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::{AsgConvertError, Function, Identifier, Node, Scope, Span, Type};
use crate::AsgConvertError;
use crate::Function;
use crate::Identifier;
use crate::Node;
use crate::Scope;
use crate::Span;
use crate::Type;
use indexmap::IndexMap;
use std::cell::RefCell;

View File

@ -14,24 +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,
BlockStatement,
Circuit,
FromAst,
Identifier,
MonoidalDirector,
ReturnPathReducer,
Scope,
Span,
Statement,
Type,
Variable,
};
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 indexmap::IndexMap;
use leo_ast::FunctionInput;
use std::cell::{Cell, RefCell};
use std::cell::Cell;
use std::cell::RefCell;
#[derive(Clone, Copy, PartialEq)]
pub enum FunctionQualifier {

View File

@ -24,11 +24,20 @@ pub use circuit::*;
mod function;
pub use function::*;
use crate::{ArenaNode, AsgContext, AsgConvertError, ImportResolver, Input, Scope};
use leo_ast::{Identifier, PackageAccess, PackageOrPackages, Span};
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 indexmap::IndexMap;
use std::cell::{Cell, RefCell};
use std::cell::Cell;
use std::cell::RefCell;
/// Stores the Leo program abstract semantic graph (ASG).
#[derive(Clone)]

View File

@ -15,7 +15,9 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use super::*;
use crate::{expression::*, program::*, statement::*};
use crate::expression::*;
use crate::program::*;
use crate::statement::*;
use std::marker::PhantomData;

View File

@ -14,7 +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::*, program::*, statement::*, Monoid};
use crate::expression::*;
use crate::program::*;
use crate::statement::*;
use crate::Monoid;
#[allow(unused_variables)]
pub trait MonoidalReducerExpression<'a, T: Monoid> {

View File

@ -16,7 +16,9 @@
use std::cell::Cell;
use crate::{expression::*, program::*, statement::*};
use crate::expression::*;
use crate::program::*;
use crate::statement::*;
pub enum VisitResult {
VisitChildren,

View File

@ -15,9 +15,12 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use super::*;
use crate::{expression::*, program::*, statement::*};
use crate::expression::*;
use crate::program::*;
use crate::statement::*;
use std::{cell::Cell, marker::PhantomData};
use std::cell::Cell;
use std::marker::PhantomData;
pub struct VisitorDirector<'a, R: ExpressionVisitor<'a>> {
visitor: R,

View File

@ -14,10 +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::{ArenaNode, AsgContext, AsgConvertError, Circuit, Expression, Function, Input, Statement, Type, Variable};
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 indexmap::IndexMap;
use std::cell::{Cell, RefCell};
use std::cell::Cell;
use std::cell::RefCell;
/// An abstract data type that track the current bindings for variables, functions, and circuits.
#[derive(Clone)]

View File

@ -14,24 +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,
CircuitMember,
ConstInt,
ConstValue,
Expression,
ExpressionNode,
FromAst,
Identifier,
IntegerType,
Node,
PartialType,
Scope,
Span,
Statement,
Type,
Variable,
};
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;
pub use leo_ast::AssignOperation;
use leo_ast::AssigneeAccess as AstAssigneeAccess;

View File

@ -14,7 +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::{AsgConvertError, FromAst, Node, PartialType, Scope, Span, Statement};
use crate::AsgConvertError;
use crate::FromAst;
use crate::Node;
use crate::PartialType;
use crate::Scope;
use crate::Span;
use crate::Statement;
use std::cell::Cell;

View File

@ -14,7 +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::{AsgConvertError, BlockStatement, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type};
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 std::cell::Cell;

View File

@ -14,7 +14,15 @@
// 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, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type};
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 leo_ast::ConsoleFunction as AstConsoleFunction;
use std::cell::Cell;

View File

@ -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,
Expression,
ExpressionNode,
FromAst,
InnerVariable,
Node,
PartialType,
Scope,
Span,
Statement,
Type,
Variable,
};
use leo_ast::{AstError, DeprecatedError};
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 std::cell::{Cell, RefCell};
use std::cell::Cell;
use std::cell::RefCell;
#[derive(Clone)]
pub struct DefinitionStatement<'a> {

View File

@ -14,7 +14,14 @@
// 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, Expression, FromAst, Node, PartialType, Scope, Span, Statement};
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 std::cell::Cell;

View File

@ -16,21 +16,20 @@
use leo_ast::IntegerType;
use crate::{
AsgConvertError,
Expression,
ExpressionNode,
FromAst,
InnerVariable,
Node,
PartialType,
Scope,
Span,
Statement,
Variable,
};
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 std::cell::{Cell, RefCell};
use std::cell::Cell;
use std::cell::RefCell;
#[derive(Clone)]
pub struct IterationStatement<'a> {

View File

@ -42,7 +42,12 @@ pub use iteration::*;
mod return_;
pub use return_::*;
use crate::{AsgConvertError, FromAst, Node, PartialType, Scope, Span};
use crate::AsgConvertError;
use crate::FromAst;
use crate::Node;
use crate::PartialType;
use crate::Scope;
use crate::Span;
#[derive(Clone)]
pub enum Statement<'a> {

View File

@ -14,7 +14,15 @@
// 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, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type};
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 std::cell::Cell;
#[derive(Clone)]

View File

@ -16,7 +16,9 @@
use std::cell::RefCell;
use crate::{Expression, Statement, Type};
use crate::Expression;
use crate::Statement;
use crate::Type;
use leo_ast::Identifier;
/// Specifies how a program variable was declared.

View File

@ -14,7 +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::{load_asg, make_test_context};
use crate::load_asg;
use crate::make_test_context;
use leo_ast::Ast;
use leo_grammar::Grammar;

View File

@ -14,7 +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::{load_asg, load_asg_imports, make_test_context, mocked_resolver};
use crate::load_asg;
use crate::load_asg_imports;
use crate::make_test_context;
use crate::mocked_resolver;
#[test]
fn test_basic() {

View File

@ -17,8 +17,11 @@
use leo_ast::Ast;
use leo_grammar::Grammar;
use criterion::{criterion_group, criterion_main, Criterion};
use std::{path::Path, time::Duration};
use criterion::criterion_group;
use criterion::criterion_main;
use criterion::Criterion;
use std::path::Path;
use std::time::Duration;
fn ast(ast: &Grammar) -> Ast {
Ast::new("leo_tree", &ast).unwrap()

View File

@ -14,11 +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::{Circuit, DeprecatedError, Function, FunctionInput, Identifier, ImportStatement, TestFunction};
use leo_grammar::{
annotations::{Annotation, AnnotationArguments, AnnotationName},
definitions::{AnnotatedDefinition, Definition},
};
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 std::convert::TryFrom;

View File

@ -14,10 +14,12 @@
// 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, Identifier};
use crate::CircuitMember;
use crate::Identifier;
use leo_grammar::circuits::Circuit as GrammarCircuit;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,10 +14,12 @@
// 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, Identifier};
use crate::Expression;
use crate::Identifier;
use leo_grammar::circuits::CircuitImpliedVariable;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CircuitImpliedVariableDefinition {

View File

@ -14,13 +14,15 @@
// 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, Identifier, Type};
use leo_grammar::{
circuits::{CircuitMember as GrammarCircuitMember, CircuitVariableDefinition as GrammarCircuitVariableDefinition},
functions::Function as GrammarFunction,
};
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 serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,10 +14,12 @@
// 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, Identifier};
use crate::Expression;
use crate::Identifier;
use leo_grammar::circuits::CircuitVariable;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct CircuitVariableDefinition {

View File

@ -18,7 +18,8 @@ use crate::PositiveNumber;
use leo_grammar::types::ArrayDimensions as GrammarArrayDimensions;
use leo_input::types::ArrayDimensions as InputArrayDimensions;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
/// A vector of positive numbers that represent array dimensions.

View File

@ -14,36 +14,33 @@
// 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, 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 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 leo_input::common::Identifier as InputIdentifier;
use crate::Node;
use serde::{
de::{self, Visitor},
Deserialize,
Deserializer,
Serialize,
Serializer,
};
use std::{
collections::BTreeMap,
fmt,
hash::{Hash, Hasher},
};
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;
/// An identifier in the constrained program.
///

View File

@ -14,10 +14,12 @@
// 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, Span};
use crate::Node;
use crate::Span;
use leo_grammar::functions::InputKeyword as GrammarInputKeyword;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
/// The `input` keyword can view program register, record, and state values.

View File

@ -14,10 +14,12 @@
// 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, Span};
use crate::Node;
use crate::Span;
use leo_grammar::common::MutSelfKeyword as GrammarMutSelfKeyword;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
/// The `mut self` keyword can view and modify circuit values inside of a circuit function.

View File

@ -17,7 +17,8 @@
use leo_grammar::values::PositiveNumber as GrammarPositiveNumber;
use leo_input::values::PositiveNumber as InputPositiveNumber;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
/// A number string guaranteed to be positive by the pest grammar.

View File

@ -14,10 +14,12 @@
// 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, Span};
use crate::Node;
use crate::Span;
use leo_grammar::common::SelfKeyword as GrammarSelfKeyword;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
/// The `self` keyword can view circuit values inside of a circuit function.

View File

@ -15,8 +15,10 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use pest::Span as GrammarSpan;
use serde::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
use serde::Deserialize;
use serde::Serialize;
use std::hash::Hash;
use std::hash::Hasher;
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct Span {

View File

@ -14,13 +14,14 @@
// 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, Node, Span};
use leo_grammar::{
common::SpreadOrExpression as GrammarSpreadOrExpression,
expressions::Expression as GrammarExpression,
};
use crate::Expression;
use crate::Node;
use crate::Span;
use leo_grammar::common::SpreadOrExpression as GrammarSpreadOrExpression;
use leo_grammar::expressions::Expression as GrammarExpression;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
/// Spread or expression

View File

@ -14,10 +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::{Error as FormattedError, Span};
use leo_grammar::{annotations::AnnotationName, definitions::Deprecated};
use crate::Error as FormattedError;
use crate::Span;
use leo_grammar::annotations::AnnotationName;
use leo_grammar::definitions::Deprecated;
use std::{convert::TryFrom, path::Path};
use std::convert::TryFrom;
use std::path::Path;
#[derive(Debug, Error)]
pub enum DeprecatedError {

View File

@ -16,7 +16,8 @@
use crate::Span;
use std::{fmt, path::Path};
use std::fmt;
use std::path::Path;
pub const INDENT: &str = " ";

View File

@ -14,44 +14,43 @@
// 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,
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 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 leo_grammar::{access::TupleAccess, expressions::TupleExpression};
use serde::{Deserialize, Serialize};
use leo_grammar::access::TupleAccess;
use leo_grammar::expressions::TupleExpression;
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
use crate::Node;

View File

@ -14,10 +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::{Block, FunctionInput, Identifier, Node, Span, Type};
use crate::Block;
use crate::FunctionInput;
use crate::Identifier;
use crate::Node;
use crate::Span;
use crate::Type;
use leo_grammar::functions::Function as GrammarFunction;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, Serialize, Deserialize)]

View File

@ -14,10 +14,14 @@
// 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, Node, Span, Type};
use crate::Identifier;
use crate::Node;
use crate::Span;
use crate::Type;
use leo_grammar::functions::FunctionInput as GrammarFunctionInput;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,10 +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::{FunctionInputVariable, InputKeyword, MutSelfKeyword, Node, SelfKeyword, Span};
use crate::FunctionInputVariable;
use crate::InputKeyword;
use crate::MutSelfKeyword;
use crate::Node;
use crate::SelfKeyword;
use crate::Span;
use leo_grammar::functions::input::Input as GrammarInput;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
/// Enumerates the possible inputs to a function.

View File

@ -14,10 +14,12 @@
// 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, Identifier};
use crate::Function;
use crate::Identifier;
use leo_grammar::functions::TestFunction as GrammarTestFunction;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct TestFunction {

View File

@ -15,22 +15,19 @@
// 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,
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 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 serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,19 +14,17 @@
// 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, 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 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 serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,10 +14,12 @@
// 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, Span};
use crate::PackageOrPackages;
use crate::Span;
use leo_grammar::imports::Import as GrammarImport;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
/// Represents an import statement in a Leo program.

View File

@ -14,10 +14,12 @@
// 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, Span};
use crate::Identifier;
use crate::Span;
use leo_grammar::imports::ImportSymbol as GrammarImportSymbol;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]

View File

@ -14,10 +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::{common::Identifier, PackageAccess, Span};
use crate::common::Identifier;
use crate::PackageAccess;
use crate::Span;
use leo_grammar::imports::Package as GrammarPackage;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]

View File

@ -14,10 +14,14 @@
// 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, Package, Packages, Span};
use crate::ImportSymbol;
use crate::Package;
use crate::Packages;
use crate::Span;
use leo_grammar::imports::PackageAccess as GrammarPackageAccess;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]

View File

@ -14,10 +14,12 @@
// 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, Packages};
use crate::Package;
use crate::Packages;
use leo_grammar::imports::PackageOrPackages as GrammarPackageOrPackages;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]

View File

@ -14,10 +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::{common::Identifier, PackageAccess, Span};
use crate::common::Identifier;
use crate::PackageAccess;
use crate::Span;
use leo_grammar::imports::Packages as GrammarPackages;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, Eq, Hash, PartialEq, Serialize, Deserialize)]

View File

@ -14,11 +14,17 @@
// 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, MainInput, ProgramInput, ProgramState, Record, Registers, State, StateLeaf};
use leo_input::{
files::{File, TableOrSection},
InputParserError,
};
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;
#[derive(Clone, PartialEq, Eq)]
pub struct Input {

View File

@ -14,13 +14,25 @@
// 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, 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 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 pest::Span;
use std::fmt;

View File

@ -14,7 +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::{Identifier, Span, Type};
use crate::Identifier;
use crate::Span;
use crate::Type;
use leo_input::parameters::Parameter as GrammarParameter;
#[derive(Clone, PartialEq, Eq, Hash)]

View File

@ -15,7 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::InputValue;
use leo_input::{definitions::Definition, InputParserError};
use leo_input::definitions::Definition;
use leo_input::InputParserError;
use indexmap::IndexMap;

View File

@ -14,11 +14,12 @@
// 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, MainInput, Registers};
use leo_input::{
sections::{Header, Section},
InputParserError,
};
use crate::InputValue;
use crate::MainInput;
use crate::Registers;
use leo_input::sections::Header;
use leo_input::sections::Section;
use leo_input::InputParserError;
#[derive(Clone, PartialEq, Eq, Default)]
pub struct ProgramInput {

View File

@ -14,8 +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::{InputValue, Parameter};
use leo_input::{definitions::Definition, InputParserError};
use crate::InputValue;
use crate::Parameter;
use leo_input::definitions::Definition;
use leo_input::InputParserError;
use indexmap::IndexMap;

View File

@ -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, StateLeaf};
use leo_input::{
sections::{Header, Section},
InputParserError,
};
use crate::Record;
use crate::StateLeaf;
use leo_input::sections::Header;
use leo_input::sections::Section;
use leo_input::InputParserError;
#[derive(Clone, PartialEq, Eq, Default)]
pub struct PrivateState {

View File

@ -14,8 +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::{InputValue, Parameter};
use leo_input::{definitions::Definition, InputParserError};
use crate::InputValue;
use crate::Parameter;
use leo_input::definitions::Definition;
use leo_input::InputParserError;
use indexmap::IndexMap;

View File

@ -14,8 +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::{InputValue, Parameter};
use leo_input::{definitions::Definition, InputParserError};
use crate::InputValue;
use crate::Parameter;
use leo_input::definitions::Definition;
use leo_input::InputParserError;
use indexmap::IndexMap;

View File

@ -14,11 +14,14 @@
// 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, PublicState, Record, State, StateLeaf};
use leo_input::{
tables::{Table, Visibility},
InputParserError,
};
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;
#[derive(Clone, PartialEq, Eq, Default)]
pub struct ProgramState {

View File

@ -15,10 +15,9 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::State;
use leo_input::{
sections::{Header, Section},
InputParserError,
};
use leo_input::sections::Header;
use leo_input::sections::Section;
use leo_input::InputParserError;
#[derive(Clone, PartialEq, Eq, Default)]
pub struct PublicState {

View File

@ -14,8 +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::{InputValue, Parameter};
use leo_input::{definitions::Definition, InputParserError};
use crate::InputValue;
use crate::Parameter;
use leo_input::definitions::Definition;
use leo_input::InputParserError;
use indexmap::IndexMap;

View File

@ -14,9 +14,12 @@
// 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, AstError};
use leo_ast::Ast;
use leo_ast::AstError;
use leo_grammar::Grammar;
use std::{env, fs, path::Path};
use std::env;
use std::fs;
use std::path::Path;
fn to_leo_tree(filepath: &Path) -> Result<String, AstError> {
// Loads the Leo code as a string from the given file path.

View File

@ -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,
Circuit,
DeprecatedError,
Function,
FunctionInput,
Identifier,
ImportStatement,
TestFunction,
};
use leo_grammar::{definitions::Definition, files::File};
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 indexmap::IndexMap;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
/// Stores the Leo program abstract syntax tree.

View File

@ -14,13 +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::{Expression, Identifier, PositiveNumber, Span};
use leo_grammar::{
access::{ArrayAccess, AssigneeAccess as GrammarAssigneeAccess},
common::{Assignee as GrammarAssignee, Range, RangeOrExpression},
};
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 serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,11 +14,14 @@
// 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, Node, Span};
use crate::Expression;
use crate::Node;
use crate::Span;
pub use leo_grammar::operations::AssignOperation as GrammarAssignOperation;
use leo_grammar::statements::AssignStatement as GrammarAssignStatement;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
mod assignee;

View File

@ -14,10 +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::{Node, Span, Statement};
use crate::Node;
use crate::Span;
use crate::Statement;
use leo_grammar::statements::Block as GrammarBlock;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]

View File

@ -14,10 +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::{Block, Expression, Node, Span, Statement};
use leo_grammar::statements::{ConditionalNestedOrEndStatement, ConditionalStatement as GrammarConditionalStatement};
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 serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]

View File

@ -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, FormattedString};
use leo_grammar::console::{
ConsoleAssert as GrammarConsoleAssert,
ConsoleDebug as GrammarConsoleDebug,
ConsoleError as GrammarConsoleError,
ConsoleFunction as GrammarConsoleFunction,
ConsoleLog as GrammarConsoleLog,
};
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 serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,10 +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::{ConsoleFunction, Node, Span};
use crate::ConsoleFunction;
use crate::Node;
use crate::Span;
use leo_grammar::console::ConsoleFunctionCall as GrammarConsoleFunctionCall;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,10 +14,12 @@
// 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, Span};
use crate::Node;
use crate::Span;
use leo_grammar::console::FormattedContainer as GrammarFormattedContainer;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]

View File

@ -14,10 +14,14 @@
// 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, FormattedContainer, Node, Span};
use crate::Expression;
use crate::FormattedContainer;
use crate::Node;
use crate::Span;
use leo_grammar::console::FormattedString as GrammarFormattedString;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]

View File

@ -16,7 +16,8 @@
use leo_grammar::common::Declare as GrammarDeclare;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,9 +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, Node, Span, Type};
use crate::Expression;
use crate::Node;
use crate::Span;
use crate::Type;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
mod variable_name;

View File

@ -14,10 +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::{Identifier, Node, Span};
use crate::Identifier;
use crate::Node;
use crate::Span;
use leo_grammar::common::VariableName as GrammarVariableName;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -14,10 +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, Node, Span};
use crate::Expression;
use crate::Node;
use crate::Span;
use leo_grammar::statements::ExpressionStatement as GrammarExpressionStatement;
use serde::{Deserialize, Serialize};
use serde::Deserialize;
use serde::Serialize;
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]

Some files were not shown because too many files have changed in this diff Show More