From 7adb06a43d8ede28c0000b7f02bf6b41b8e47d5d Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 7 Apr 2022 19:43:49 +0300 Subject: [PATCH] )r --- docs/commands.md | 4 ++++ src/main.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/docs/commands.md b/docs/commands.md index 871a93a6..785c751a 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -6,6 +6,10 @@ These are commands usable from a CBQN REPL that, for one reason or another, aren Execute the contents of the file as if it were REPL input (but allowing multiline definitions). Not a system function because modifying the list of global variables during execution is not allowed. +## `)r expr` + +Execute the expression, but don't print its result. + ## `)t expr` / `)time expr` / `)t:n expr` / `)time:n expr` Time the argument expression. `n` specifies the number of times to repeat. Exists to allow not escaping quotes and less overhead for timing very fast & small expressions. diff --git a/src/main.c b/src/main.c index 2cd3ff77..04d55437 100644 --- a/src/main.c +++ b/src/main.c @@ -53,6 +53,9 @@ void cbqn_runLine0(char* ln, i64 read) { B path = fromUTF8l(cmdE); code = path_chars(path); output = 0; + } else if (isCmd(cmdS, &cmdE, "r ")) { + code = fromUTF8l(cmdE); + output = 0; } else if (isCmd(cmdS, &cmdE, "t ") || isCmd(cmdS, &cmdE, "time ")) { code = fromUTF8l(cmdE); time = -1;