mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 14:13:52 +01:00
read_line now returns (String)/()
so that closed stdin is handled by the programmer instead of (probably) causing an infinite loop
This commit is contained in:
parent
eb2949334e
commit
206457489c
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mers"
|
name = "mers"
|
||||||
version = "0.8.5"
|
version = "0.8.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
description = "dynamically typed but type-checked programming language"
|
description = "dynamically typed but type-checked programming language"
|
||||||
@ -11,7 +11,7 @@ repository = "https://github.com/Dummi26/mers"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
mers_lib = "0.8.5"
|
mers_lib = "0.8.6"
|
||||||
# mers_lib = { path = "../mers_lib" }
|
# mers_lib = { path = "../mers_lib" }
|
||||||
clap = { version = "4.3.19", features = ["derive"] }
|
clap = { version = "4.3.19", features = ["derive"] }
|
||||||
colored = "2.1.0"
|
colored = "2.1.0"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mers_lib"
|
name = "mers_lib"
|
||||||
version = "0.8.5"
|
version = "0.8.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
description = "library to use the mers language in other projects"
|
description = "library to use the mers language in other projects"
|
||||||
|
@ -28,7 +28,10 @@ impl Config {
|
|||||||
info_check: Arc::new(Mutex::new(CheckInfo::neverused())),
|
info_check: Arc::new(Mutex::new(CheckInfo::neverused())),
|
||||||
out: Arc::new(|a, _i| {
|
out: Arc::new(|a, _i| {
|
||||||
if a.is_zero_tuple() {
|
if a.is_zero_tuple() {
|
||||||
Ok(Type::new(data::string::StringT))
|
Ok(Type::newm(vec![Arc::new(data::tuple::TupleT(vec![
|
||||||
|
Type::new(data::string::StringT),
|
||||||
|
Type::empty_tuple(),
|
||||||
|
]))]))
|
||||||
} else {
|
} else {
|
||||||
Err(format!(
|
Err(format!(
|
||||||
"expected (), got {}",
|
"expected (), got {}",
|
||||||
@ -39,8 +42,11 @@ impl Config {
|
|||||||
}),
|
}),
|
||||||
run: Arc::new(|_a, _i| {
|
run: Arc::new(|_a, _i| {
|
||||||
let mut line = String::new();
|
let mut line = String::new();
|
||||||
_ = std::io::stdin().read_line(&mut line);
|
if std::io::stdin().read_line(&mut line).is_err() && line.is_empty() {
|
||||||
Data::new(data::string::String(line))
|
Data::empty_tuple()
|
||||||
|
} else {
|
||||||
|
Data::one_tuple(Data::new(data::string::String(line)))
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
inner_statements: None,
|
inner_statements: None,
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user