From 99b031d078c440096152c80e766454022442bd7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EF=BD=88=EF=BD=89=EF=BD=8C=EF=BD=8A=EF=BD=95=EF=BD=93?= =?UTF-8?q?=EF=BD=94=EF=BD=89?= Date: Sun, 11 Sep 2022 22:10:38 -0700 Subject: [PATCH] Add pls/printlns, update dtsh for interpreting stdin, add dtsh dev link --- dt-src/stdlib/display.dt | 7 +++++-- dtsh | 1 + src/bin/dtsh.rs | 5 ++--- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 120000 dtsh diff --git a/dt-src/stdlib/display.dt b/dt-src/stdlib/display.dt index e6c371a..54b7441 100644 --- a/dt-src/stdlib/display.dt +++ b/dt-src/stdlib/display.dt @@ -1,2 +1,5 @@ -[ p ] [ print ] def -[ pl ] [ println ] def +[ [ pl ] each ] [ pls ] def + +[ p ] [ print ] def +[ pl ] [ println ] def +[ pls ] [ printlns ] def diff --git a/dtsh b/dtsh new file mode 120000 index 0000000..4dad417 --- /dev/null +++ b/dtsh @@ -0,0 +1 @@ +./dt \ No newline at end of file diff --git a/src/bin/dtsh.rs b/src/bin/dtsh.rs index 325b95d..1692fc4 100644 --- a/src/bin/dtsh.rs +++ b/src/bin/dtsh.rs @@ -9,12 +9,11 @@ pub fn main() { let state = DtState::new_with_libs(args.no_stdlib, args.lib_list); match args.mode { - Some(Mode::Interactive) | None => DtPrompt::default().run(state), + Some(Mode::Interactive) | Some(Mode::RunStdin) | None => DtPrompt::default().run(state), Some(Mode::Run { file }) => { let tokens = loading::from_dt_source_file(file); state.run_tokens(tokens); } - Some(Mode::RunStdin) => unimplemented!("I don't know how to run stdin yet"), } } @@ -45,6 +44,6 @@ enum Mode { Run { file: String }, #[clap(name = "-")] - /// Read from standard input. + /// Interpret code from standard input. RunStdin, }