Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions crates/sui-transactional-test-runner/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ use crate::test_adapter::{FakeID, SuiTestAdapter};
use anyhow::{bail, ensure};
use clap;
use clap::{Args, Parser};
use move_command_line_common::parser::{parse_u256, parse_u64};
use move_command_line_common::values::{ParsableValue, ParsedValue};
use move_command_line_common::{parser::Parser as MoveCLParser, values::ValueToken};
use move_compiler::editions::Flavor;
use move_core_types::parsing::{
parser::Parser as MoveCLParser,
parser::{parse_u256, parse_u64},
values::ValueToken,
values::{ParsableValue, ParsedValue},
};
use move_core_types::runtime_value::{MoveStruct, MoveValue};
use move_core_types::u256::U256;
use move_symbol_pool::Symbol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::{borrow::BorrowMut, marker::PhantomData, str::FromStr};

use move_command_line_common::{
use move_core_types::parsing::{
parser::{Parser, Token},
types::{ParsedType, TypeToken},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
use std::fmt::{self, Display};

use anyhow::bail;
use move_command_line_common::parser::Token;
use move_core_types::identifier;
use move_core_types::parsing::parser::Token;

#[derive(Eq, PartialEq, Debug, Clone, Copy)]
pub enum CommandToken {
Expand Down
5 changes: 2 additions & 3 deletions crates/sui-transactional-test-runner/src/test_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ use fastcrypto::encoding::{Base64, Encoding};
use fastcrypto::traits::ToFromBytes;
use move_binary_format::CompiledModule;
use move_bytecode_utils::module_cache::GetModule;
use move_command_line_common::{
address::ParsedAddress, files::verify_and_create_named_address_mapping,
};
use move_command_line_common::files::verify_and_create_named_address_mapping;
use move_compiler::{
editions::{Edition, Flavor},
shared::{NumberFormat, NumericalAddress, PackageConfig, PackagePaths},
Flags, FullyCompiledProgram,
};
use move_core_types::ident_str;
use move_core_types::parsing::address::ParsedAddress;
use move_core_types::{
account_address::AccountAddress,
identifier::IdentStr,
Expand Down
10 changes: 5 additions & 5 deletions crates/sui-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn sui_framework_address_concat_string(suffix: &str) -> String {
/// Parsing succeeds if and only if `s` matches one of these formats exactly, with no remaining
/// suffix. This function is intended for use within the authority codebases.
pub fn parse_sui_address(s: &str) -> anyhow::Result<SuiAddress> {
use move_command_line_common::address::ParsedAddress;
use move_core_types::parsing::address::ParsedAddress;
Ok(ParsedAddress::parse(s)?
.into_account_address(&resolve_address)?
.into())
Expand All @@ -163,7 +163,7 @@ pub fn parse_sui_address(s: &str) -> anyhow::Result<SuiAddress> {
/// module name (an identifier). Parsing succeeds if and only if `s` matches this format exactly,
/// with no remaining input. This function is intended for use within the authority codebases.
pub fn parse_sui_module_id(s: &str) -> anyhow::Result<ModuleId> {
use move_command_line_common::types::ParsedModuleId;
use move_core_types::parsing::types::ParsedModuleId;
ParsedModuleId::parse(s)?.into_module_id(&resolve_address)
}

Expand All @@ -172,7 +172,7 @@ pub fn parse_sui_module_id(s: &str) -> anyhow::Result<ModuleId> {
/// format exactly, with no remaining input. This function is intended for use within the authority
/// codebases.
pub fn parse_sui_fq_name(s: &str) -> anyhow::Result<(ModuleId, String)> {
use move_command_line_common::types::ParsedFqName;
use move_core_types::parsing::types::ParsedFqName;
ParsedFqName::parse(s)?.into_fq_name(&resolve_address)
}

Expand All @@ -181,15 +181,15 @@ pub fn parse_sui_fq_name(s: &str) -> anyhow::Result<(ModuleId, String)> {
/// brackets). Parsing succeeds if and only if `s` matches this format exactly, with no remaining
/// input. This function is intended for use within the authority codebase.
pub fn parse_sui_struct_tag(s: &str) -> anyhow::Result<StructTag> {
use move_command_line_common::types::ParsedStructType;
use move_core_types::parsing::types::ParsedStructType;
ParsedStructType::parse(s)?.into_struct_tag(&resolve_address)
}

/// Parse `s` as a type: Either a struct type (see `parse_sui_struct_tag`), a primitive type, or a
/// vector with a type parameter. Parsing succeeds if and only if `s` matches this format exactly,
/// with no remaining input. This function is intended for use within the authority codebase.
pub fn parse_sui_type_tag(s: &str) -> anyhow::Result<TypeTag> {
use move_command_line_common::types::ParsedType;
use move_core_types::parsing::types::ParsedType;
ParsedType::parse(s)?.into_type_tag(&resolve_address)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/sui/src/client_ptb/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::fmt;

use move_command_line_common::{
use move_core_types::parsing::{
address::{NumericalAddress, ParsedAddress},
types::{ParsedFqName, ParsedModuleId, ParsedStructType, ParsedType},
};
Expand Down
2 changes: 1 addition & 1 deletion crates/sui/src/client_ptb/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use miette::Severity;
use move_binary_format::{
binary_config::BinaryConfig, file_format::SignatureToken, CompiledModule,
};
use move_command_line_common::{
use move_core_types::parsing::{
address::{NumericalAddress, ParsedAddress},
parser::NumberFormat,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/sui/src/client_ptb/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::iter::Peekable;

use move_command_line_common::{
use move_core_types::parsing::{
address::{NumericalAddress, ParsedAddress},
parser::{parse_u128, parse_u16, parse_u256, parse_u32, parse_u64, parse_u8},
types::{ParsedFqName, ParsedModuleId, ParsedStructType, ParsedType},
Expand Down
2 changes: 0 additions & 2 deletions external-crates/move/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion external-crates/move/crates/move-cli/src/sandbox/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
};
use anyhow::Result;
use clap::Parser;
use move_command_line_common::values::ParsedValue;
use move_core_types::parsing::values::ParsedValue;
use move_core_types::{language_storage::TypeTag, transaction_argument::TransactionArgument};
use move_package::compilation::package_layout::CompiledPackageLayout;
use move_vm_test_utils::gas_schedule::CostTable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ difference.workspace = true
walkdir.workspace = true
sha2.workspace = true
hex.workspace = true
num-bigint.workspace = true
once_cell.workspace = true
serde.workspace = true
dirs-next.workspace = true
Expand All @@ -27,9 +26,3 @@ move-binary-format.workspace = true

[dev-dependencies]
proptest.workspace = true
# Ok to do this since:
# edition = 2021 ==> resolver = 2
# * https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html#summary
# resolver = 2 ==> feature-resolver-version-2 which allows dev-dependencies to set features
# * https://doc.rust-lang.org/cargo/reference/resolver.html#feature-resolver-version-2
move-core-types = { workspace = true, features = ["fuzzing"] }
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,3 @@ pub mod error_bitset;
pub mod files;
pub mod interactive;
pub mod testing;

pub use move_core_types::parsing::address;
pub use move_core_types::parsing::parser;
pub use move_core_types::parsing::types;
pub use move_core_types::parsing::values;
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ use crate::{
},
FullyCompiledProgram,
};
use move_command_line_common::parser::{parse_u16, parse_u256, parse_u32};
use move_core_types::account_address::AccountAddress;
use move_core_types::parsing::parser::{parse_u16, parse_u256, parse_u32};
use move_ir_types::location::*;
use move_proc_macros::growing_stack;
use move_symbol_pool::Symbol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
unit_test::filter_test_members::UNIT_TEST_POISON_FUN_NAME,
};

use move_command_line_common::address::NumericalAddress;
use move_core_types::parsing::address::NumericalAddress;
use move_ir_types::location::Loc;
use move_symbol_pool::Symbol;

Expand Down
4 changes: 2 additions & 2 deletions external-crates/move/crates/move-compiler/src/shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub use ast_debug::AstDebug;
// Numbers
//**************************************************************************************************

pub use move_command_line_common::parser::{
pub use move_core_types::parsing::parser::{
parse_address_number as parse_address, parse_u128, parse_u16, parse_u256, parse_u32, parse_u64,
parse_u8, NumberFormat,
};
Expand All @@ -71,7 +71,7 @@ pub use move_command_line_common::parser::{
// Address
//**************************************************************************************************

pub use move_command_line_common::address::NumericalAddress;
pub use move_core_types::parsing::address::NumericalAddress;

pub fn parse_named_address(s: &str) -> anyhow::Result<(String, NumericalAddress)> {
let before_after = s.split('=').collect::<Vec<_>>();
Expand Down
1 change: 0 additions & 1 deletion external-crates/move/crates/move-core-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ bcs.workspace = true
leb128.workspace = true
thiserror.workspace = true
serde_with.workspace = true
num-bigint.workspace = true

[dev-dependencies]
proptest.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
account_address::AccountAddress,
gas_algebra::{AbstractMemorySize, BOX_ABSTRACT_SIZE, ENUM_BASE_ABSTRACT_SIZE},
identifier::{IdentStr, Identifier},
parsing::types::{ParsedStructType, ParsedType},
parsing::types::{ParsedModuleId, ParsedStructType, ParsedType},
};
use move_proc_macros::test_variant_order;
use once_cell::sync::Lazy;
Expand Down Expand Up @@ -327,6 +327,13 @@ impl Display for ModuleId {
}
}

impl FromStr for ModuleId {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
ParsedModuleId::parse(s)?.into_module_id(&|_| None)
}
}

impl ModuleId {
pub fn short_str_lossless(&self) -> String {
format!("0x{}::{}", self.address.short_str_lossless(), self.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use crate::account_address::AccountAddress;
use crate::parsing::parser::{parse_address_number, NumberFormat};
use anyhow::anyhow;
use num_bigint::BigUint;
use num::BigUint;
use std::{fmt, hash::Hash};

// Parsed Address, either a name or a numerical address
Expand Down
Loading
Loading