rename leo-core -> leo-core-packages

This commit is contained in:
collin 2020-10-30 13:02:44 -07:00
parent 7589fa65c5
commit 5a46cb5bb0
27 changed files with 52 additions and 56 deletions

35
Cargo.lock generated
View File

@ -1252,8 +1252,8 @@ dependencies = [
"bincode",
"hex",
"leo-ast",
"leo-core",
"leo-core-ast",
"leo-core-packages",
"leo-gadgets",
"leo-imports",
"leo-input",
@ -1281,7 +1281,21 @@ dependencies = [
]
[[package]]
name = "leo-core"
name = "leo-core-ast"
version = "1.0.3"
dependencies = [
"criterion",
"leo-ast",
"leo-input",
"pest",
"serde",
"serde_json",
"snarkos-errors",
"snarkos-models",
]
[[package]]
name = "leo-core-packages"
version = "1.0.3"
dependencies = [
"leo-core-ast",
@ -1296,20 +1310,6 @@ dependencies = [
"thiserror",
]
[[package]]
name = "leo-core-ast"
version = "1.0.3"
dependencies = [
"criterion",
"leo-ast",
"leo-input",
"pest",
"serde",
"serde_json",
"snarkos-errors",
"snarkos-models",
]
[[package]]
name = "leo-gadgets"
version = "1.0.3"
@ -1363,7 +1363,6 @@ dependencies = [
"from-pest",
"lazy_static",
"leo-compiler",
"leo-core",
"leo-core-ast",
"leo-gadgets",
"leo-imports",
@ -1435,8 +1434,8 @@ name = "leo-symbol-table"
version = "1.0.3"
dependencies = [
"leo-ast",
"leo-core",
"leo-core-ast",
"leo-core-packages",
"leo-imports",
"serde",
"thiserror",

View File

@ -29,7 +29,7 @@ members = [
"ast",
"compiler",
"core-ast",
"core",
"core-packages",
"gadgets",
"imports",
"input",
@ -44,10 +44,6 @@ members = [
path = "./compiler"
version = "1.0.3"
[dependencies.leo-core]
path = "./core"
version = "1.0.1"
[dependencies.leo-core-ast]
path = "./core-ast"
version = "1.0.3"

View File

@ -21,14 +21,14 @@ edition = "2018"
path = "../ast"
version = "1.0.3"
[dependencies.leo-core]
path = "../core"
version = "1.0.3"
[dependencies.leo-core-ast]
path = "../core-ast"
version = "1.0.3"
[dependencies.leo-core-packages]
path = "../core-packages"
version = "1.0.3"
[dependencies.leo-gadgets]
path = "../gadgets"
version = "1.0.3"

View File

@ -15,8 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::errors::{AddressError, BooleanError, FieldError, FunctionError, GroupError, IntegerError, ValueError};
use leo_core::LeoCoreError;
use leo_core_ast::{Error as FormattedError, Identifier, Span};
use leo_core_packages::LeoCorePackageError;
use snarkos_errors::gadgets::SynthesisError;
use std::path::Path;
@ -45,7 +45,7 @@ pub enum ExpressionError {
IntegerError(#[from] IntegerError),
#[error("{}", _0)]
LeoCoreError(#[from] LeoCoreError),
LeoCoreError(#[from] LeoCorePackageError),
#[error("{}", _0)]
ValueError(#[from] ValueError),

View File

@ -14,8 +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 leo_core::LeoCoreError;
use leo_core_ast::{Error as FormattedError, Identifier, ImportSymbol, Span};
use leo_core_packages::LeoCorePackageError;
#[derive(Debug, Error)]
pub enum ImportError {
@ -23,7 +23,7 @@ pub enum ImportError {
Error(#[from] FormattedError),
#[error("{}", _0)]
LeoCoreError(#[from] LeoCoreError),
LeoCoreError(#[from] LeoCorePackageError),
}
impl ImportError {

View File

@ -16,8 +16,8 @@
use crate::{program::ConstrainedProgram, value::ConstrainedValue, GroupType};
use crate::errors::{ExpressionError, FunctionError};
use leo_core::call_core_circuit;
use leo_core_ast::{Expression, Span, Type};
use leo_core_packages::call_core_circuit;
use snarkos_models::{
curves::{Field, PrimeField},
gadgets::r1cs::ConstraintSystem,

View File

@ -17,11 +17,11 @@
use crate::{new_scope, ConstrainedProgram, ConstrainedValue, GroupType};
use leo_core_ast::Package;
use leo_core::{CorePackageList, LeoCoreError};
use leo_core_packages::{CorePackageList, LeoCorePackageError};
use snarkos_models::curves::{Field, PrimeField};
impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
pub(crate) fn store_core_package(&mut self, scope: &str, package: Package) -> Result<(), LeoCoreError> {
pub(crate) fn store_core_package(&mut self, scope: &str, package: Package) -> Result<(), LeoCorePackageError> {
// Create list of imported core packages.
let list = CorePackageList::from_package_access(package.access)?;

View File

@ -26,8 +26,8 @@ use crate::{
GroupType,
Integer,
};
use leo_core::Value;
use leo_core_ast::{Circuit, Function, GroupValue, Identifier, Span, Type};
use leo_core_packages::Value;
use snarkos_errors::gadgets::SynthesisError;
use snarkos_models::{

View File

@ -1,5 +1,5 @@
[package]
name = "leo-core"
name = "leo-core-packages"
version = "1.0.3"
authors = [ "The Aleo Team <hello@aleo.org>" ]
description = "Core package dependencies of the Leo programming language"

View File

@ -20,7 +20,7 @@ use leo_core_ast::{Error as FormattedError, Span};
use std::path::Path;
#[derive(Debug, Error)]
pub enum LeoCoreError {
pub enum LeoCorePackageError {
#[error("{}", _0)]
CoreCircuitError(#[from] CoreCircuitError),
@ -31,17 +31,17 @@ pub enum LeoCoreError {
Error(#[from] FormattedError),
}
impl LeoCoreError {
impl LeoCorePackageError {
pub fn set_path(&mut self, path: &Path) {
match self {
LeoCoreError::CoreCircuitError(error) => error.set_path(path),
LeoCoreError::CorePackageListError(error) => error.set_path(path),
LeoCoreError::Error(error) => error.set_path(path),
LeoCorePackageError::CoreCircuitError(error) => error.set_path(path),
LeoCorePackageError::CorePackageListError(error) => error.set_path(path),
LeoCorePackageError::Error(error) => error.set_path(path),
}
}
fn new_from_span(message: String, span: Span) -> Self {
LeoCoreError::Error(FormattedError::new_from_span(message, span))
LeoCorePackageError::Error(FormattedError::new_from_span(message, span))
}
pub fn undefined_core_circuit(circuit_name: String, span: Span) -> Self {

View File

@ -23,5 +23,5 @@ pub use self::core_package::*;
pub mod core_package_list;
pub use self::core_package_list::*;
pub mod leo_core;
pub use self::leo_core::*;
pub mod leo_core_package;
pub use self::leo_core_package::*;

View File

@ -28,6 +28,7 @@ pub use self::types::*;
use crate::CoreCircuit;
use leo_core_ast::Span;
use snarkos_models::{
curves::{Field, PrimeField},
gadgets::r1cs::ConstraintSystem,
@ -40,10 +41,10 @@ pub fn call_core_circuit<F: Field + PrimeField, CS: ConstraintSystem<F>>(
circuit_name: String,
arguments: Vec<Value>,
span: Span,
) -> Result<Vec<Value>, LeoCoreError> {
) -> Result<Vec<Value>, LeoCorePackageError> {
// Match core circuit name
Ok(match circuit_name.as_str() {
CORE_UNSTABLE_BLAKE2S_NAME => Blake2sCircuit::call(cs, arguments, span)?,
_ => return Err(LeoCoreError::undefined_core_circuit(circuit_name, span)),
_ => return Err(LeoCorePackageError::undefined_core_circuit(circuit_name, span)),
})
}

View File

@ -21,18 +21,18 @@ edition = "2018"
path = "../ast"
version = "1.0.3"
[dependencies.leo-core]
path = "../core"
[dependencies.leo-core-ast]
path = "../core-ast"
version = "1.0.3"
[dependencies.leo-core-packages]
path = "../core-packages"
version = "1.0.3"
[dependencies.leo-imports]
path = "../imports"
version = "1.0.3"
[dependencies.leo-core-ast]
path = "../core-ast"
version = "1.0.3"
[dependencies.serde]
version = "1.0"

View File

@ -15,8 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{TypeError, UserDefinedType};
use leo_core::{CorePackageListError, LeoCoreError};
use leo_core_ast::{Error as FormattedError, ImportSymbol, Program, Span};
use leo_core_packages::{CorePackageListError, LeoCorePackageError};
use std::path::Path;
@ -30,7 +30,7 @@ pub enum SymbolTableError {
Error(#[from] FormattedError),
#[error("{}", _0)]
LeoCoreError(#[from] LeoCoreError),
LeoCorePackageError(#[from] LeoCorePackageError),
#[error("{}", _0)]
TypeError(#[from] TypeError),
@ -44,7 +44,7 @@ impl SymbolTableError {
match self {
SymbolTableError::CorePackageListError(error) => error.set_path(path),
SymbolTableError::Error(error) => error.set_path(path),
SymbolTableError::LeoCoreError(error) => error.set_path(path),
SymbolTableError::LeoCorePackageError(error) => error.set_path(path),
SymbolTableError::TypeError(error) => error.set_path(path),
}
}

View File

@ -15,8 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use crate::{CircuitType, CircuitVariableType, FunctionType, ImportedSymbols, SymbolTableError, UserDefinedType};
use leo_core::CorePackageList;
use leo_core_ast::{Circuit, Function, Identifier, ImportStatement, ImportSymbol, Input, Package, Program};
use leo_core_packages::CorePackageList;
use leo_imports::ImportParser;
use std::collections::{HashMap, HashSet};