From ccf40472f78a22ccc19e85b5c4d746f06d02926a Mon Sep 17 00:00:00 2001 From: BanceDev Date: Wed, 25 Sep 2024 13:53:03 -0400 Subject: added || chaining operator --- src/lush.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lush.c b/src/lush.c index 78e7fb7..31a75d7 100644 --- a/src/lush.c +++ b/src/lush.c @@ -934,8 +934,6 @@ char **lush_split_commands(char *line) { while (isspace((unsigned char)*start)) start++; - // Check if entering or leaving a quoted string - // Check for operators int op_len = operator_length(start); if (op_len > 0) { @@ -1111,6 +1109,15 @@ int lush_execute_chain(lua_State *L, char ***commands, int num_commands) { commands++; } + if (last_result == 0 && i > 0) { + commands--; + if (is_operator(commands[0][0]) == OP_OR) { + commands += 3; + continue; + } + commands++; + } + // Handle other operations if (commands[1] != NULL) { int op_type = is_operator(commands[1][0]); -- cgit v1.2.3-59-g8ed1b