Merge pull request #2466 from Skgland/upgrade-deps
Upgrade dependencies
This commit is contained in:
1768
Cargo.lock
generated
1768
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
105
Cargo.toml
105
Cargo.toml
@@ -26,70 +26,75 @@ crypto-full = []
|
|||||||
"rust-version-1.80" = []
|
"rust-version-1.80" = []
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
indexmap = "1.0.2"
|
indexmap = "2.3.0"
|
||||||
proc-macro2 = "1.0.36"
|
proc-macro2 = "1.0.86"
|
||||||
quote = "1.0.15"
|
quote = "1.0.36"
|
||||||
strum = "0.23"
|
strum = "0.26"
|
||||||
strum_macros = "0.23"
|
strum_macros = "0.26"
|
||||||
syn = { version = "2.0.32", features = ['full', 'visit', 'extra-traits'] }
|
syn = { version = "2.0.72", features = ['full', 'visit', 'extra-traits'] }
|
||||||
to-syn-value = "0.1.1"
|
to-syn-value = "0.1.1"
|
||||||
to-syn-value_derive = "0.1.1"
|
to-syn-value_derive = "0.1.1"
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.12.3"
|
arcu = { version = "0.1.1", features = ["thread_local_counter"] }
|
||||||
bit-set = "0.5.3"
|
base64 = "0.22.1"
|
||||||
|
bit-set = "0.8.0"
|
||||||
bitvec = "1"
|
bitvec = "1"
|
||||||
blake2 = "0.8.1"
|
blake2 = "0.10.6"
|
||||||
bytes = "1"
|
bytes = "1"
|
||||||
chrono = "0.4.11"
|
chrono = "0.4.38"
|
||||||
cpu-time = "1.0.0"
|
cpu-time = "1.0.0"
|
||||||
crrl = "0.6.0"
|
crrl = "0.9.0"
|
||||||
dashu = "0.4.0"
|
dashu = "0.4.2"
|
||||||
derive_deref = "1.1.1"
|
derive_more = "0.99.18"
|
||||||
dirs-next = "2.0.0"
|
dirs-next = "2.0.0"
|
||||||
divrem = "0.1.0"
|
divrem = "1.0.0"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
fxhash = "0.2.1"
|
fxhash = "0.2.1"
|
||||||
git-version = "0.3.4"
|
git-version = "0.3.9"
|
||||||
indexmap = "1.0.2"
|
indexmap = "2.3.0"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.5.0"
|
||||||
lexical = "5.2.2"
|
lexical = "6.1.1"
|
||||||
libc = "0.2.62"
|
libc = "0.2.155"
|
||||||
libloading = "0.7"
|
libloading = "0.8"
|
||||||
scryer-modular-bitfield = "0.11.4"
|
scryer-modular-bitfield = "0.11.4"
|
||||||
num-order = { version = "1.2.0" }
|
num-order = { version = "1.2.0" }
|
||||||
ordered-float = "2.6.0"
|
ordered-float = "4.2.2"
|
||||||
phf = { version = "0.9", features = ["macros"] }
|
phf = { version = "0.11", features = ["macros"] }
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
regex = "1.9.1"
|
regex = "1.10.6"
|
||||||
ring = { version = "0.17.5", features = ["wasm32_unknown_unknown_js"] }
|
ring = { version = "0.17.8", features = ["wasm32_unknown_unknown_js"] }
|
||||||
ripemd160 = "0.8.0"
|
ripemd = "0.1.3"
|
||||||
roxmltree = "0.11.0"
|
roxmltree = "0.20.0"
|
||||||
ryu = "1.0.9"
|
ryu = "1.0.18"
|
||||||
select = "0.6.0"
|
sha3 = "0.10.8"
|
||||||
sha3 = "0.8.2"
|
smallvec = "1.13.2"
|
||||||
smallvec = "1.8.0"
|
|
||||||
static_assertions = "1.1.0"
|
static_assertions = "1.1.0"
|
||||||
|
|
||||||
serde_json = "1.0.95"
|
scraper = { version = "0.19.1", default-features = false, features = [
|
||||||
serde = "1.0.159"
|
"errors",
|
||||||
arcu = { version = "0.1.1", features = ["thread_local_counter"] }
|
] }
|
||||||
|
ego-tree = "0.6.2"
|
||||||
|
|
||||||
|
|
||||||
|
serde_json = "1.0.122"
|
||||||
|
serde = "1.0.204"
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
crossterm = { version = "0.20.0", optional = true }
|
crossterm = { version = "0.28.1", optional = true }
|
||||||
ctrlc = { version = "3.2.2", optional = true }
|
ctrlc = { version = "3.4.4", optional = true }
|
||||||
hostname = { version = "0.3.1", optional = true }
|
hostname = { version = "0.4.0", optional = true }
|
||||||
libffi = { version = "3.2.0", optional = true }
|
libffi = { version = "3.2.0", optional = true }
|
||||||
native-tls = { version = "0.2.4", optional = true }
|
native-tls = { version = "0.2.12", optional = true }
|
||||||
reqwest = { version = "0.11.18", optional = true }
|
reqwest = { version = "0.11.27", optional = true }
|
||||||
rustyline = { version = "12.0.0", optional = true }
|
rustyline = { version = "14.0.0", optional = true }
|
||||||
tokio = { version = "1.28.2", features = ["full"] }
|
tokio = { version = "1.39.2", features = ["full"] }
|
||||||
warp = { version = "=0.3.5", features = ["tls"], optional = true }
|
warp = { version = "0.3.7", features = ["tls"], optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
getrandom = { version = "0.2.10", features = ["js"] }
|
getrandom = { version = "0.2.15", features = ["js"] }
|
||||||
tokio = { version = "1.28.2", features = [
|
tokio = { version = "1.39.2", features = [
|
||||||
"sync",
|
"sync",
|
||||||
"macros",
|
"macros",
|
||||||
"io-util",
|
"io-util",
|
||||||
@@ -99,9 +104,9 @@ tokio = { version = "1.28.2", features = [
|
|||||||
|
|
||||||
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
|
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
|
||||||
console_error_panic_hook = "0.1"
|
console_error_panic_hook = "0.1"
|
||||||
wasm-bindgen = "0.2.87"
|
wasm-bindgen = "0.2.92"
|
||||||
wasm-bindgen-futures = "0.4"
|
wasm-bindgen-futures = "0.4"
|
||||||
serde-wasm-bindgen = "0.5"
|
serde-wasm-bindgen = "0.6"
|
||||||
web-sys = { version = "0.3", features = [
|
web-sys = { version = "0.3", features = [
|
||||||
"Document",
|
"Document",
|
||||||
"Window",
|
"Window",
|
||||||
@@ -112,14 +117,14 @@ js-sys = "0.3"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
maplit = "1.0.2"
|
maplit = "1.0.2"
|
||||||
predicates-core = "1.0.2"
|
predicates-core = "1.0.8"
|
||||||
serial_test = "2.0.0"
|
serial_test = "3.1.1"
|
||||||
|
|
||||||
[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dev-dependencies]
|
[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dev-dependencies]
|
||||||
assert_cmd = "1.0.3"
|
assert_cmd = "2.0.15"
|
||||||
criterion = "0.5.1"
|
criterion = "0.5.1"
|
||||||
iai-callgrind = "0.9.0"
|
iai-callgrind = "0.12.1"
|
||||||
trycmd = "0.14.19"
|
trycmd = "0.15.6"
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "windows", all(target_arch = "wasm32", target_os = "unknown"))))'.dev-dependencies]
|
[target.'cfg(not(any(target_os = "windows", all(target_arch = "wasm32", target_os = "unknown"))))'.dev-dependencies]
|
||||||
pprof = { version = "0.13.0", features = ["criterion", "flamegraph"] }
|
pprof = { version = "0.13.0", features = ["criterion", "flamegraph"] }
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ use crate::machine::machine_errors::*;
|
|||||||
use dashu::base::Abs;
|
use dashu::base::Abs;
|
||||||
use dashu::base::BitTest;
|
use dashu::base::BitTest;
|
||||||
use num_order::NumOrd;
|
use num_order::NumOrd;
|
||||||
use ordered_float::*;
|
use ordered_float::{Float, OrderedFloat};
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::cmp::{max, min, Ordering};
|
use std::cmp::{max, min, Ordering};
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ impl ForeignFunctionTable {
|
|||||||
FunctionImpl {
|
FunctionImpl {
|
||||||
cif,
|
cif,
|
||||||
args,
|
args,
|
||||||
code_ptr: CodePtr(code_ptr.into_raw().into_raw() as *mut _),
|
code_ptr: CodePtr(code_ptr.into_raw().as_raw_ptr()),
|
||||||
return_struct_name,
|
return_struct_name,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -707,7 +707,7 @@ pub(crate) fn remove_constant_indices(
|
|||||||
Some(IndexingCodePtr::DynamicExternal(_))
|
Some(IndexingCodePtr::DynamicExternal(_))
|
||||||
| Some(IndexingCodePtr::External(_))
|
| Some(IndexingCodePtr::External(_))
|
||||||
| Some(IndexingCodePtr::Fail) => {
|
| Some(IndexingCodePtr::Fail) => {
|
||||||
constants.remove(&constant);
|
constants.swap_remove(&constant);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Some(IndexingCodePtr::Internal(o)) => {
|
Some(IndexingCodePtr::Internal(o)) => {
|
||||||
@@ -846,7 +846,7 @@ pub(crate) fn remove_structure_index(
|
|||||||
match structures.get(&(name, arity)).cloned() {
|
match structures.get(&(name, arity)).cloned() {
|
||||||
Some(IndexingCodePtr::DynamicExternal(_))
|
Some(IndexingCodePtr::DynamicExternal(_))
|
||||||
| Some(IndexingCodePtr::External(_)) => {
|
| Some(IndexingCodePtr::External(_)) => {
|
||||||
structures.remove(&(name, arity));
|
structures.swap_remove(&(name, arity));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Some(IndexingCodePtr::Internal(o)) => {
|
Some(IndexingCodePtr::Internal(o)) => {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use crate::types::*;
|
|||||||
|
|
||||||
use crate::fixnum;
|
use crate::fixnum;
|
||||||
|
|
||||||
use ordered_float::*;
|
use ordered_float::{Float, OrderedFloat};
|
||||||
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn remove_replaced_in_situ_module(&mut self, module_name: Atom) {
|
pub(super) fn remove_replaced_in_situ_module(&mut self, module_name: Atom) {
|
||||||
let mut removed_module = match self.wam_prelude.indices.modules.remove(&module_name) {
|
let mut removed_module = match self.wam_prelude.indices.modules.swap_remove(&module_name) {
|
||||||
Some(module) => module,
|
Some(module) => module,
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
@@ -526,7 +526,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn remove_module_exports(&mut self, module_name: Atom) {
|
pub(super) fn remove_module_exports(&mut self, module_name: Atom) {
|
||||||
let removed_module = match self.wam_prelude.indices.modules.remove(&module_name) {
|
let removed_module = match self.wam_prelude.indices.modules.swap_remove(&module_name) {
|
||||||
Some(module) => module,
|
Some(module) => module,
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
@@ -555,8 +555,10 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ModuleExport::OpDecl(op_decl) => {
|
ModuleExport::OpDecl(op_decl) => {
|
||||||
let op_dir_value_opt = op_dir
|
let op_dir_value_opt = op_dir.swap_remove(&(
|
||||||
.remove(&(op_decl.name, fixity(op_decl.op_desc.get_spec() as u32)));
|
op_decl.name,
|
||||||
|
fixity(op_decl.op_desc.get_spec() as u32),
|
||||||
|
));
|
||||||
|
|
||||||
if let Some(op_desc) = op_dir_value_opt {
|
if let Some(op_desc) = op_dir_value_opt {
|
||||||
retraction_info.push_record(op_retractor(*op_decl, op_desc));
|
retraction_info.push_record(op_retractor(*op_decl, op_desc));
|
||||||
@@ -1017,7 +1019,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
|
|
||||||
self.reset_in_situ_module(module_decl.clone(), &listing_src);
|
self.reset_in_situ_module(module_decl.clone(), &listing_src);
|
||||||
|
|
||||||
let mut module = match self.wam_prelude.indices.modules.remove(&module_name) {
|
let mut module = match self.wam_prelude.indices.modules.swap_remove(&module_name) {
|
||||||
Some(mut module) => {
|
Some(mut module) => {
|
||||||
module.listing_src = listing_src;
|
module.listing_src = listing_src;
|
||||||
module
|
module
|
||||||
@@ -1059,7 +1061,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn import_module(&mut self, module_name: Atom) -> Result<(), SessionError> {
|
pub(super) fn import_module(&mut self, module_name: Atom) -> Result<(), SessionError> {
|
||||||
if let Some(module) = self.wam_prelude.indices.modules.remove(&module_name) {
|
if let Some(module) = self.wam_prelude.indices.modules.swap_remove(&module_name) {
|
||||||
let payload_compilation_target = self.payload.compilation_target;
|
let payload_compilation_target = self.payload.compilation_target;
|
||||||
|
|
||||||
match &payload_compilation_target {
|
match &payload_compilation_target {
|
||||||
@@ -1115,7 +1117,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
module_name: Atom,
|
module_name: Atom,
|
||||||
exports: IndexSet<ModuleExport>,
|
exports: IndexSet<ModuleExport>,
|
||||||
) -> Result<(), SessionError> {
|
) -> Result<(), SessionError> {
|
||||||
if let Some(module) = self.wam_prelude.indices.modules.remove(&module_name) {
|
if let Some(module) = self.wam_prelude.indices.modules.swap_remove(&module_name) {
|
||||||
let payload_compilation_target = self.payload.compilation_target;
|
let payload_compilation_target = self.payload.compilation_target;
|
||||||
|
|
||||||
let result = match &payload_compilation_target {
|
let result = match &payload_compilation_target {
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
RetractionRecord::AddedMetaPredicate(target_module_name, key) => {
|
RetractionRecord::AddedMetaPredicate(target_module_name, key) => {
|
||||||
match target_module_name {
|
match target_module_name {
|
||||||
atom!("user") => {
|
atom!("user") => {
|
||||||
self.wam_prelude.indices.meta_predicates.remove(&key);
|
self.wam_prelude.indices.meta_predicates.swap_remove(&key);
|
||||||
}
|
}
|
||||||
_ => match self
|
_ => match self
|
||||||
.wam_prelude
|
.wam_prelude
|
||||||
@@ -583,7 +583,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
.get_mut(&target_module_name)
|
.get_mut(&target_module_name)
|
||||||
{
|
{
|
||||||
Some(ref mut module) => {
|
Some(ref mut module) => {
|
||||||
module.meta_predicates.remove(&key);
|
module.meta_predicates.swap_remove(&key);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
@@ -617,7 +617,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RetractionRecord::AddedModule(module_name) => {
|
RetractionRecord::AddedModule(module_name) => {
|
||||||
self.wam_prelude.indices.modules.remove(&module_name);
|
self.wam_prelude.indices.modules.swap_remove(&module_name);
|
||||||
}
|
}
|
||||||
RetractionRecord::ReplacedModule(
|
RetractionRecord::ReplacedModule(
|
||||||
module_decl,
|
module_decl,
|
||||||
@@ -713,7 +713,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
if let Some(ref mut module) =
|
if let Some(ref mut module) =
|
||||||
self.wam_prelude.indices.modules.get_mut(&module_name)
|
self.wam_prelude.indices.modules.get_mut(&module_name)
|
||||||
{
|
{
|
||||||
module.code_dir.remove(&key);
|
module.code_dir.swap_remove(&key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RetractionRecord::ReplacedModulePredicate(module_name, key, old_code_idx) => {
|
RetractionRecord::ReplacedModulePredicate(module_name, key, old_code_idx) => {
|
||||||
@@ -738,7 +738,7 @@ impl<'a, LS: LoadState<'a>> Loader<'a, LS> {
|
|||||||
op_decl.insert_into_op_dir(&mut self.wam_prelude.indices.op_dir);
|
op_decl.insert_into_op_dir(&mut self.wam_prelude.indices.op_dir);
|
||||||
}
|
}
|
||||||
RetractionRecord::AddedUserPredicate(key) => {
|
RetractionRecord::AddedUserPredicate(key) => {
|
||||||
self.wam_prelude.indices.code_dir.remove(&key);
|
self.wam_prelude.indices.code_dir.swap_remove(&key);
|
||||||
}
|
}
|
||||||
RetractionRecord::ReplacedUserPredicate(key, old_code_idx) => {
|
RetractionRecord::ReplacedUserPredicate(key, old_code_idx) => {
|
||||||
if let Some(code_idx) = self.wam_prelude.indices.code_dir.get_mut(&key) {
|
if let Some(code_idx) = self.wam_prelude.indices.code_dir.get_mut(&key) {
|
||||||
|
|||||||
@@ -397,10 +397,10 @@ impl IndexStore {
|
|||||||
key: &PredicateKey,
|
key: &PredicateKey,
|
||||||
) -> Option<PredicateSkeleton> {
|
) -> Option<PredicateSkeleton> {
|
||||||
match compilation_target {
|
match compilation_target {
|
||||||
CompilationTarget::User => self.extensible_predicates.remove(key),
|
CompilationTarget::User => self.extensible_predicates.swap_remove(key),
|
||||||
CompilationTarget::Module(ref module_name) => {
|
CompilationTarget::Module(ref module_name) => {
|
||||||
if let Some(module) = self.modules.get_mut(module_name) {
|
if let Some(module) = self.modules.get_mut(module_name) {
|
||||||
module.extensible_predicates.remove(key)
|
module.extensible_predicates.swap_remove(key)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use crate::parser::ast::*;
|
use crate::parser::ast::*;
|
||||||
use crate::parser::parser::*;
|
use crate::parser::parser::*;
|
||||||
|
|
||||||
|
use base64::Engine;
|
||||||
use dashu::integer::{Sign, UBig};
|
use dashu::integer::{Sign, UBig};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use num_order::NumOrd;
|
use num_order::NumOrd;
|
||||||
@@ -72,13 +73,13 @@ use crossterm::event::{read, Event, KeyCode, KeyEvent, KeyModifiers};
|
|||||||
#[cfg(feature = "repl")]
|
#[cfg(feature = "repl")]
|
||||||
use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
|
use crossterm::terminal::{disable_raw_mode, enable_raw_mode};
|
||||||
|
|
||||||
use blake2::{Blake2b, Blake2s};
|
use blake2::{Blake2b512, Blake2s256};
|
||||||
use ring::rand::{SecureRandom, SystemRandom};
|
use ring::rand::{SecureRandom, SystemRandom};
|
||||||
use ring::{digest, hkdf, hmac, pbkdf2};
|
use ring::{digest, hkdf, hmac, pbkdf2};
|
||||||
|
|
||||||
#[cfg(feature = "crypto-full")]
|
#[cfg(feature = "crypto-full")]
|
||||||
use ring::aead;
|
use ring::aead;
|
||||||
use ripemd160::{Digest, Ripemd160};
|
use ripemd::{Digest, Ripemd160};
|
||||||
use sha3::{Sha3_224, Sha3_256, Sha3_384, Sha3_512};
|
use sha3::{Sha3_224, Sha3_256, Sha3_384, Sha3_512};
|
||||||
|
|
||||||
use crrl::{ed25519, secp256k1, x25519};
|
use crrl::{ed25519, secp256k1, x25519};
|
||||||
@@ -88,7 +89,6 @@ use native_tls::{Identity, TlsAcceptor, TlsConnector};
|
|||||||
|
|
||||||
use base64;
|
use base64;
|
||||||
use roxmltree;
|
use roxmltree;
|
||||||
use select;
|
|
||||||
|
|
||||||
#[cfg(feature = "http")]
|
#[cfg(feature = "http")]
|
||||||
use futures::future;
|
use futures::future;
|
||||||
@@ -3713,14 +3713,9 @@ impl Machine {
|
|||||||
#[cfg(feature = "repl")]
|
#[cfg(feature = "repl")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub(crate) fn get_single_char(&mut self) -> CallResult {
|
pub(crate) fn get_single_char(&mut self) -> CallResult {
|
||||||
let ctrl_c = KeyEvent {
|
|
||||||
code: KeyCode::Char('c'),
|
|
||||||
modifiers: KeyModifiers::CONTROL,
|
|
||||||
};
|
|
||||||
|
|
||||||
let key = get_key();
|
let key = get_key();
|
||||||
|
|
||||||
if key == ctrl_c {
|
if key.code == KeyCode::Char('c') && key.modifiers == KeyModifiers::CONTROL {
|
||||||
let stub = functor_stub(atom!("get_single_char"), 1);
|
let stub = functor_stub(atom!("get_single_char"), 1);
|
||||||
let err = self.machine_st.interrupt_error();
|
let err = self.machine_st.interrupt_error();
|
||||||
let err = self.machine_st.error_form(err, stub);
|
let err = self.machine_st.error_form(err, stub);
|
||||||
@@ -3815,7 +3810,7 @@ impl Machine {
|
|||||||
|
|
||||||
if !stream.is_stdin() && !stream.is_stdout() && !stream.is_stderr() {
|
if !stream.is_stdin() && !stream.is_stdout() && !stream.is_stderr() {
|
||||||
if let Some(alias) = stream.options().get_alias() {
|
if let Some(alias) = stream.options().get_alias() {
|
||||||
self.indices.stream_aliases.remove(&alias);
|
self.indices.stream_aliases.swap_remove(&alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
let close_result = stream.close();
|
let close_result = stream.close();
|
||||||
@@ -4301,15 +4296,14 @@ impl Machine {
|
|||||||
let client = reqwest::Client::builder().build().unwrap();
|
let client = reqwest::Client::builder().build().unwrap();
|
||||||
|
|
||||||
// request
|
// request
|
||||||
let mut req = reqwest::Request::new(method, address);
|
let mut req = client.request(method, address).headers(headers);
|
||||||
|
|
||||||
*req.headers_mut() = headers;
|
|
||||||
if !bytes.is_empty() {
|
if !bytes.is_empty() {
|
||||||
*req.body_mut() = Some(reqwest::Body::from(bytes));
|
req = req.body(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do it!
|
// do it!
|
||||||
match futures::executor::block_on(client.execute(req)) {
|
match futures::executor::block_on(req.send()) {
|
||||||
Ok(resp) => {
|
Ok(resp) => {
|
||||||
// status code
|
// status code
|
||||||
let status = resp.status().as_u16();
|
let status = resp.status().as_u16();
|
||||||
@@ -7283,90 +7277,83 @@ impl Machine {
|
|||||||
let ints_list = match algorithm {
|
let ints_list = match algorithm {
|
||||||
atom!("sha3_224") => {
|
atom!("sha3_224") => {
|
||||||
let mut context = Sha3_224::new();
|
let mut context = Sha3_224::new();
|
||||||
context.input(&bytes);
|
context.update(&bytes);
|
||||||
|
|
||||||
heap_loc_as_cell!(iter_to_heap_list(
|
heap_loc_as_cell!(iter_to_heap_list(
|
||||||
&mut self.machine_st.heap,
|
&mut self.machine_st.heap,
|
||||||
context
|
context
|
||||||
.result()
|
.finalize()
|
||||||
.as_ref()
|
|
||||||
.iter()
|
.iter()
|
||||||
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
atom!("sha3_256") => {
|
atom!("sha3_256") => {
|
||||||
let mut context = Sha3_256::new();
|
let mut context = Sha3_256::new();
|
||||||
context.input(&bytes);
|
context.update(&bytes);
|
||||||
heap_loc_as_cell!(iter_to_heap_list(
|
heap_loc_as_cell!(iter_to_heap_list(
|
||||||
&mut self.machine_st.heap,
|
&mut self.machine_st.heap,
|
||||||
context
|
context
|
||||||
.result()
|
.finalize()
|
||||||
.as_ref()
|
|
||||||
.iter()
|
.iter()
|
||||||
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
atom!("sha3_384") => {
|
atom!("sha3_384") => {
|
||||||
let mut context = Sha3_384::new();
|
let mut context = Sha3_384::new();
|
||||||
context.input(&bytes);
|
context.update(&bytes);
|
||||||
|
|
||||||
heap_loc_as_cell!(iter_to_heap_list(
|
heap_loc_as_cell!(iter_to_heap_list(
|
||||||
&mut self.machine_st.heap,
|
&mut self.machine_st.heap,
|
||||||
context
|
context
|
||||||
.result()
|
.finalize()
|
||||||
.as_ref()
|
|
||||||
.iter()
|
.iter()
|
||||||
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
atom!("sha3_512") => {
|
atom!("sha3_512") => {
|
||||||
let mut context = Sha3_512::new();
|
let mut context = Sha3_512::new();
|
||||||
context.input(&bytes);
|
context.update(&bytes);
|
||||||
|
|
||||||
heap_loc_as_cell!(iter_to_heap_list(
|
heap_loc_as_cell!(iter_to_heap_list(
|
||||||
&mut self.machine_st.heap,
|
&mut self.machine_st.heap,
|
||||||
context
|
context
|
||||||
.result()
|
.finalize()
|
||||||
.as_ref()
|
|
||||||
.iter()
|
.iter()
|
||||||
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
atom!("blake2s256") => {
|
atom!("blake2s256") => {
|
||||||
let mut context = Blake2s::new();
|
let mut context = Blake2s256::new();
|
||||||
context.input(&bytes);
|
context.update(&bytes);
|
||||||
|
|
||||||
heap_loc_as_cell!(iter_to_heap_list(
|
heap_loc_as_cell!(iter_to_heap_list(
|
||||||
&mut self.machine_st.heap,
|
&mut self.machine_st.heap,
|
||||||
context
|
context
|
||||||
.result()
|
.finalize()
|
||||||
.as_ref()
|
|
||||||
.iter()
|
.iter()
|
||||||
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
atom!("blake2b512") => {
|
atom!("blake2b512") => {
|
||||||
let mut context = Blake2b::new();
|
let mut context = Blake2b512::new();
|
||||||
context.input(&bytes);
|
context.update(&bytes);
|
||||||
|
|
||||||
heap_loc_as_cell!(iter_to_heap_list(
|
heap_loc_as_cell!(iter_to_heap_list(
|
||||||
&mut self.machine_st.heap,
|
&mut self.machine_st.heap,
|
||||||
context
|
context
|
||||||
.result()
|
.finalize()
|
||||||
.as_ref()
|
|
||||||
.iter()
|
.iter()
|
||||||
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
atom!("ripemd160") => {
|
atom!("ripemd160") => {
|
||||||
let mut context = Ripemd160::new();
|
let mut context = Ripemd160::new();
|
||||||
context.input(&bytes);
|
context.update(&bytes);
|
||||||
|
|
||||||
heap_loc_as_cell!(iter_to_heap_list(
|
heap_loc_as_cell!(iter_to_heap_list(
|
||||||
&mut self.machine_st.heap,
|
&mut self.machine_st.heap,
|
||||||
context
|
context
|
||||||
.result()
|
.finalize()
|
||||||
.as_ref()
|
|
||||||
.iter()
|
.iter()
|
||||||
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
.map(|b| fixnum_as_cell!(Fixnum::build_with(*b as i64))),
|
||||||
))
|
))
|
||||||
@@ -7784,8 +7771,8 @@ impl Machine {
|
|||||||
.machine_st
|
.machine_st
|
||||||
.value_to_str_like(self.machine_st.registers[1])
|
.value_to_str_like(self.machine_st.registers[1])
|
||||||
{
|
{
|
||||||
let doc = select::document::Document::from_read(string.as_str().as_bytes()).unwrap();
|
let document = scraper::Html::parse_document(&string.as_str());
|
||||||
let result = self.html_node_to_term(doc.nth(0).unwrap());
|
let result = self.html_node_to_term(document.tree.root());
|
||||||
|
|
||||||
unify!(self.machine_st, self.machine_st.registers[2], result);
|
unify!(self.machine_st, self.machine_st.registers[2], result);
|
||||||
} else {
|
} else {
|
||||||
@@ -7938,11 +7925,11 @@ impl Machine {
|
|||||||
let padding = cell_as_atom!(self.deref_register(3));
|
let padding = cell_as_atom!(self.deref_register(3));
|
||||||
let charset = cell_as_atom!(self.deref_register(4));
|
let charset = cell_as_atom!(self.deref_register(4));
|
||||||
|
|
||||||
let config = match (padding, charset) {
|
let b64_engine = match (padding, charset) {
|
||||||
(atom!("true"), atom!("standard")) => base64::STANDARD,
|
(atom!("true"), atom!("standard")) => base64::engine::general_purpose::STANDARD,
|
||||||
(atom!("true"), _) => base64::URL_SAFE,
|
(atom!("true"), _) => base64::engine::general_purpose::URL_SAFE,
|
||||||
(_, atom!("standard")) => base64::STANDARD_NO_PAD,
|
(_, atom!("standard")) => base64::engine::general_purpose::STANDARD_NO_PAD,
|
||||||
(_, _) => base64::URL_SAFE_NO_PAD,
|
(_, _) => base64::engine::general_purpose::URL_SAFE_NO_PAD,
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.deref_register(1).is_var() {
|
if self.deref_register(1).is_var() {
|
||||||
@@ -7950,7 +7937,8 @@ impl Machine {
|
|||||||
.machine_st
|
.machine_st
|
||||||
.value_to_str_like(self.machine_st.registers[2])
|
.value_to_str_like(self.machine_st.registers[2])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let bytes = base64::decode_config(&*b64.as_str(), config);
|
|
||||||
|
let bytes = b64_engine.decode(&*b64.as_str());
|
||||||
|
|
||||||
match bytes {
|
match bytes {
|
||||||
Ok(bs) => {
|
Ok(bs) => {
|
||||||
@@ -7975,7 +7963,7 @@ impl Machine {
|
|||||||
bytes.push(c as u8);
|
bytes.push(c as u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
let b64 = base64::encode_config(bytes, config);
|
let b64 = b64_engine.encode(bytes);
|
||||||
let string = self.u8s_to_string(b64.as_bytes());
|
let string = self.u8s_to_string(b64.as_bytes());
|
||||||
|
|
||||||
unify!(self.machine_st, self.machine_st.registers[2], string);
|
unify!(self.machine_st, self.machine_st.registers[2], string);
|
||||||
@@ -8229,17 +8217,20 @@ impl Machine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn html_node_to_term(&mut self, node: select::node::Node) -> HeapCellValue {
|
pub(super) fn html_node_to_term(
|
||||||
match node.name() {
|
&mut self,
|
||||||
|
node: ego_tree::NodeRef<'_, scraper::Node>,
|
||||||
|
) -> HeapCellValue {
|
||||||
|
match node.value().as_element() {
|
||||||
None => put_complete_string(
|
None => put_complete_string(
|
||||||
&mut self.machine_st.heap,
|
&mut self.machine_st.heap,
|
||||||
&node.text(),
|
&node.value().as_text().unwrap().text,
|
||||||
&self.machine_st.atom_tbl,
|
&self.machine_st.atom_tbl,
|
||||||
),
|
),
|
||||||
Some(name) => {
|
Some(element) => {
|
||||||
let mut avec = Vec::new();
|
let mut avec = Vec::new();
|
||||||
|
|
||||||
for attr in node.attrs() {
|
for attr in element.attrs() {
|
||||||
let name = AtomTable::build_with(&self.machine_st.atom_tbl, attr.0);
|
let name = AtomTable::build_with(&self.machine_st.atom_tbl, attr.0);
|
||||||
let value = put_complete_string(
|
let value = put_complete_string(
|
||||||
&mut self.machine_st.heap,
|
&mut self.machine_st.heap,
|
||||||
@@ -8270,7 +8261,7 @@ impl Machine {
|
|||||||
cvec.into_iter()
|
cvec.into_iter()
|
||||||
));
|
));
|
||||||
|
|
||||||
let tag = AtomTable::build_with(&self.machine_st.atom_tbl, name);
|
let tag = AtomTable::build_with(&self.machine_st.atom_tbl, element.name());
|
||||||
let result = str_loc_as_cell!(self.machine_st.heap.len());
|
let result = str_loc_as_cell!(self.machine_st.heap.len());
|
||||||
|
|
||||||
self.machine_st
|
self.machine_st
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use crate::types::*;
|
|||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
use derive_deref::*;
|
use derive_more::*;
|
||||||
use fxhash::FxBuildHasher;
|
use fxhash::FxBuildHasher;
|
||||||
use indexmap::IndexSet;
|
use indexmap::IndexSet;
|
||||||
use num_order::NumOrd;
|
use num_order::NumOrd;
|
||||||
@@ -734,6 +734,7 @@ fn bind_with_occurs_check<U: Unifier>(unifier: &mut U, r: Ref, value: HeapCellVa
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deref, DerefMut)]
|
#[derive(Deref, DerefMut)]
|
||||||
|
#[deref(forward)]
|
||||||
pub(crate) struct DefaultUnifier<'a> {
|
pub(crate) struct DefaultUnifier<'a> {
|
||||||
machine_st: &'a mut MachineState,
|
machine_st: &'a mut MachineState,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use lexical::parse_lossy;
|
|
||||||
|
|
||||||
use crate::atom_table::*;
|
use crate::atom_table::*;
|
||||||
pub use crate::machine::machine_state::*;
|
pub use crate::machine::machine_state::*;
|
||||||
use crate::parser::ast::*;
|
use crate::parser::ast::*;
|
||||||
@@ -638,7 +636,9 @@ impl<'a, R: CharRead> Lexer<'a, R> {
|
|||||||
|
|
||||||
fn vacate_with_float(&mut self, mut token: String) -> Result<Token, ParserError> {
|
fn vacate_with_float(&mut self, mut token: String) -> Result<Token, ParserError> {
|
||||||
self.return_char(token.pop().unwrap());
|
self.return_char(token.pop().unwrap());
|
||||||
let n = parse_lossy::<f64, _>(token.as_bytes())?;
|
|
||||||
|
let n = parse_float_lossy(&token)?;
|
||||||
|
|
||||||
Ok(Token::Literal(Literal::from(float_alloc!(
|
Ok(Token::Literal(Literal::from(float_alloc!(
|
||||||
n,
|
n,
|
||||||
self.machine_st.arena
|
self.machine_st.arena
|
||||||
@@ -756,7 +756,7 @@ impl<'a, R: CharRead> Lexer<'a, R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let n = parse_lossy::<f64, _>(token.as_bytes())?;
|
let n = parse_float_lossy(&token)?;
|
||||||
Ok(Token::Literal(Literal::from(float_alloc!(
|
Ok(Token::Literal(Literal::from(float_alloc!(
|
||||||
n,
|
n,
|
||||||
self.machine_st.arena
|
self.machine_st.arena
|
||||||
@@ -765,7 +765,7 @@ impl<'a, R: CharRead> Lexer<'a, R> {
|
|||||||
return self.vacate_with_float(token);
|
return self.vacate_with_float(token);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let n = parse_lossy::<f64, _>(token.as_bytes())?;
|
let n = parse_float_lossy(&token)?;
|
||||||
Ok(Token::Literal(Literal::from(float_alloc!(
|
Ok(Token::Literal(Literal::from(float_alloc!(
|
||||||
n,
|
n,
|
||||||
self.machine_st.arena
|
self.machine_st.arena
|
||||||
@@ -1102,3 +1102,13 @@ impl<'a, R: CharRead> Lexer<'a, R> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_float_lossy(token: &str) -> Result<f64, ParserError> {
|
||||||
|
const FORMAT: u128 = lexical::format::STANDARD;
|
||||||
|
let options = lexical::ParseFloatOptions::builder()
|
||||||
|
.lossy(true)
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
let n = lexical::parse_with_options::<f64, _, FORMAT>(token.as_bytes(), &options)?;
|
||||||
|
Ok(n)
|
||||||
|
}
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ impl Highlighter for Helper {
|
|||||||
self.highligher.highlight(line, pos)
|
self.highligher.highlight(line, pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn highlight_char(&self, line: &str, pos: usize) -> bool {
|
fn highlight_char(&self, line: &str, pos: usize, forced: bool) -> bool {
|
||||||
self.highligher.highlight_char(line, pos)
|
self.highligher.highlight_char(line, pos, forced)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user